\\ 转 /
This commit is contained in:
parent
f591b95454
commit
1186517b35
|
|
@ -353,7 +353,9 @@ function analyzeEntity(filename, path, program, relativePath) {
|
||||||
var moduleSpecifier = node.moduleSpecifier, importClause = node.importClause;
|
var moduleSpecifier = node.moduleSpecifier, importClause = node.importClause;
|
||||||
if (ts.isStringLiteral(moduleSpecifier) && !moduleSpecifier.text.startsWith(env_1.LIB_OAK_DOMAIN)) {
|
if (ts.isStringLiteral(moduleSpecifier) && !moduleSpecifier.text.startsWith(env_1.LIB_OAK_DOMAIN)) {
|
||||||
// 编译后的路径默认要深一层
|
// 编译后的路径默认要深一层
|
||||||
var moduleSpecifier2Text = relativePath ? path_1.default.join(relativePath, moduleSpecifier.text) : path_1.default.join('..', moduleSpecifier.text);
|
var moduleSpecifier2Text = relativePath
|
||||||
|
? path_1.default.join(relativePath, moduleSpecifier.text).replace(/\\/g, '/')
|
||||||
|
: path_1.default.join('..', moduleSpecifier.text).replace(/\\/g, '/');
|
||||||
additionalImports.push(factory.updateImportDeclaration(node, undefined, undefined, importClause, factory.createStringLiteral(moduleSpecifier2Text), undefined));
|
additionalImports.push(factory.updateImportDeclaration(node, undefined, undefined, importClause, factory.createStringLiteral(moduleSpecifier2Text), undefined));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@
|
||||||
"@types/uuid": "^8.3.0",
|
"@types/uuid": "^8.3.0",
|
||||||
"assert": "^2.0.0",
|
"assert": "^2.0.0",
|
||||||
"cross-env": "^7.0.2",
|
"cross-env": "^7.0.2",
|
||||||
|
"cross-spawn": "^7.0.3",
|
||||||
"fs-extra": "^10.0.0",
|
"fs-extra": "^10.0.0",
|
||||||
"mocha": "^8.2.1",
|
"mocha": "^8.2.1",
|
||||||
"ts-node": "~10.9.1",
|
"ts-node": "~10.9.1",
|
||||||
|
|
|
||||||
|
|
@ -513,7 +513,15 @@ function analyzeEntity(filename: string, path: string, program: ts.Program, rela
|
||||||
const { moduleSpecifier, importClause } = node;
|
const { moduleSpecifier, importClause } = node;
|
||||||
if (ts.isStringLiteral(moduleSpecifier) && !moduleSpecifier.text.startsWith(LIB_OAK_DOMAIN)) {
|
if (ts.isStringLiteral(moduleSpecifier) && !moduleSpecifier.text.startsWith(LIB_OAK_DOMAIN)) {
|
||||||
// 编译后的路径默认要深一层
|
// 编译后的路径默认要深一层
|
||||||
const moduleSpecifier2Text = relativePath ? PathLib.join(relativePath, moduleSpecifier.text) : PathLib.join('..', moduleSpecifier.text);
|
const moduleSpecifier2Text = relativePath
|
||||||
|
? PathLib.join(
|
||||||
|
relativePath,
|
||||||
|
moduleSpecifier.text
|
||||||
|
).replace(/\\/g, '/')
|
||||||
|
: PathLib.join('..', moduleSpecifier.text).replace(
|
||||||
|
/\\/g,
|
||||||
|
'/'
|
||||||
|
);
|
||||||
additionalImports.push(
|
additionalImports.push(
|
||||||
factory.updateImportDeclaration(
|
factory.updateImportDeclaration(
|
||||||
node,
|
node,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue