@skmtc/core 0.0.417 → 0.0.418
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/dsl/File.d.ts +7 -0
- package/esm/dsl/File.d.ts.map +1 -1
- package/esm/dsl/File.js +10 -5
- package/esm/dsl/File.test.d.ts.map +1 -0
- package/package.json +1 -1
- package/script/dsl/File.d.ts +7 -0
- package/script/dsl/File.d.ts.map +1 -1
- package/script/dsl/File.js +12 -6
- package/script/dsl/File.test.d.ts.map +1 -0
package/esm/dsl/File.d.ts
CHANGED
|
@@ -13,4 +13,11 @@ export declare class File {
|
|
|
13
13
|
get generatorKeys(): Set<GeneratorKey>;
|
|
14
14
|
toString(): string;
|
|
15
15
|
}
|
|
16
|
+
export type NormaliseModuleNameArgs = {
|
|
17
|
+
destinationPath: string;
|
|
18
|
+
moduleImportMap: Map<string, string>;
|
|
19
|
+
exportPath: string;
|
|
20
|
+
settings: ClientSettings | undefined;
|
|
21
|
+
};
|
|
22
|
+
export declare const normaliseModuleName: ({ destinationPath, moduleImportMap, exportPath, settings }: NormaliseModuleNameArgs) => string;
|
|
16
23
|
//# sourceMappingURL=File.d.ts.map
|
package/esm/dsl/File.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"File.d.ts","sourceRoot":"","sources":["../../src/dsl/File.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1D,qBAAa,IAAI;;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;IACnD,OAAO,EAAE,GAAG,CAAC,MA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;IAClB,QAAQ,EAAE,cAAc,GAAG,SAAS,CAAA;CACrC,CAAA;AAED,eAAO,MAAM,mBAAmB,+DAK7B,uBAAuB,WAsBzB,CAAA"}
|
package/esm/dsl/File.js
CHANGED
|
@@ -63,7 +63,7 @@ export class File {
|
|
|
63
63
|
}
|
|
64
64
|
toString() {
|
|
65
65
|
const reExports = Array.from(this.reExports.entries()).flatMap(([module, entityTypes]) => {
|
|
66
|
-
const updatedModuleName =
|
|
66
|
+
const updatedModuleName = normaliseModuleName({
|
|
67
67
|
destinationPath: this.path,
|
|
68
68
|
moduleImportMap: this.moduleImportMap,
|
|
69
69
|
exportPath: module,
|
|
@@ -75,7 +75,7 @@ export class File {
|
|
|
75
75
|
});
|
|
76
76
|
});
|
|
77
77
|
const imports = Array.from(this.imports.entries()).map(([module, importItems]) => {
|
|
78
|
-
const updatedModuleName =
|
|
78
|
+
const updatedModuleName = normaliseModuleName({
|
|
79
79
|
destinationPath: this.path,
|
|
80
80
|
moduleImportMap: this.moduleImportMap,
|
|
81
81
|
exportPath: module,
|
|
@@ -91,15 +91,20 @@ export class File {
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
_File_generatorKeys = new WeakMap();
|
|
94
|
-
const
|
|
94
|
+
export const normaliseModuleName = ({ destinationPath, moduleImportMap, exportPath, settings }) => {
|
|
95
|
+
// If import is from within package and matches appRoot, make path relative to appRoot
|
|
96
|
+
for (const appRoot of settings?.appRoots ?? []) {
|
|
97
|
+
if (exportPath.startsWith(appRoot) && destinationPath.startsWith(appRoot)) {
|
|
98
|
+
return exportPath.replace(appRoot, '@');
|
|
99
|
+
}
|
|
100
|
+
}
|
|
95
101
|
const matchedModuleImport = [...moduleImportMap.entries()].find(([key]) => exportPath.startsWith(key));
|
|
96
102
|
// If exportPath does not match any module imports, return the original exportPath
|
|
97
103
|
if (!matchedModuleImport) {
|
|
98
104
|
return exportPath;
|
|
99
105
|
}
|
|
100
106
|
const [matchedPath, moduleName] = matchedModuleImport;
|
|
101
|
-
const matchedRoot = settings?.appRoots?.find(root => matchedPath.startsWith(root)) ?? matchedPath;
|
|
102
107
|
// If module import is imported from inside module, turn into a local absolute path starting with '@/'
|
|
103
108
|
// Otherwise, if module import is imported from outside module, use module name
|
|
104
|
-
return destinationPath.startsWith(matchedPath) ? exportPath.replace(
|
|
109
|
+
return destinationPath.startsWith(matchedPath) ? exportPath.replace(matchedPath, '@') : moduleName;
|
|
105
110
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"File.test.d.ts","sourceRoot":"","sources":["../../src/dsl/File.test.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
package/script/dsl/File.d.ts
CHANGED
|
@@ -13,4 +13,11 @@ export declare class File {
|
|
|
13
13
|
get generatorKeys(): Set<GeneratorKey>;
|
|
14
14
|
toString(): string;
|
|
15
15
|
}
|
|
16
|
+
export type NormaliseModuleNameArgs = {
|
|
17
|
+
destinationPath: string;
|
|
18
|
+
moduleImportMap: Map<string, string>;
|
|
19
|
+
exportPath: string;
|
|
20
|
+
settings: ClientSettings | undefined;
|
|
21
|
+
};
|
|
22
|
+
export declare const normaliseModuleName: ({ destinationPath, moduleImportMap, exportPath, settings }: NormaliseModuleNameArgs) => string;
|
|
16
23
|
//# sourceMappingURL=File.d.ts.map
|
package/script/dsl/File.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"File.d.ts","sourceRoot":"","sources":["../../src/dsl/File.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1D,qBAAa,IAAI;;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAA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CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACpC,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,cAAc,GAAG,SAAS,CAAA;CACrC,CAAA;AAED,eAAO,MAAM,mBAAmB,+DAK7B,uBAAuB,WAsBzB,CAAA"}
|
package/script/dsl/File.js
CHANGED
|
@@ -12,7 +12,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
12
12
|
};
|
|
13
13
|
var _File_generatorKeys;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.File = void 0;
|
|
15
|
+
exports.normaliseModuleName = exports.File = void 0;
|
|
16
16
|
const Import_js_1 = require("./Import.js");
|
|
17
17
|
class File {
|
|
18
18
|
constructor(path, settings) {
|
|
@@ -66,7 +66,7 @@ class File {
|
|
|
66
66
|
}
|
|
67
67
|
toString() {
|
|
68
68
|
const reExports = Array.from(this.reExports.entries()).flatMap(([module, entityTypes]) => {
|
|
69
|
-
const updatedModuleName =
|
|
69
|
+
const updatedModuleName = (0, exports.normaliseModuleName)({
|
|
70
70
|
destinationPath: this.path,
|
|
71
71
|
moduleImportMap: this.moduleImportMap,
|
|
72
72
|
exportPath: module,
|
|
@@ -78,7 +78,7 @@ class File {
|
|
|
78
78
|
});
|
|
79
79
|
});
|
|
80
80
|
const imports = Array.from(this.imports.entries()).map(([module, importItems]) => {
|
|
81
|
-
const updatedModuleName =
|
|
81
|
+
const updatedModuleName = (0, exports.normaliseModuleName)({
|
|
82
82
|
destinationPath: this.path,
|
|
83
83
|
moduleImportMap: this.moduleImportMap,
|
|
84
84
|
exportPath: module,
|
|
@@ -95,15 +95,21 @@ class File {
|
|
|
95
95
|
}
|
|
96
96
|
exports.File = File;
|
|
97
97
|
_File_generatorKeys = new WeakMap();
|
|
98
|
-
const
|
|
98
|
+
const normaliseModuleName = ({ destinationPath, moduleImportMap, exportPath, settings }) => {
|
|
99
|
+
// If import is from within package and matches appRoot, make path relative to appRoot
|
|
100
|
+
for (const appRoot of settings?.appRoots ?? []) {
|
|
101
|
+
if (exportPath.startsWith(appRoot) && destinationPath.startsWith(appRoot)) {
|
|
102
|
+
return exportPath.replace(appRoot, '@');
|
|
103
|
+
}
|
|
104
|
+
}
|
|
99
105
|
const matchedModuleImport = [...moduleImportMap.entries()].find(([key]) => exportPath.startsWith(key));
|
|
100
106
|
// If exportPath does not match any module imports, return the original exportPath
|
|
101
107
|
if (!matchedModuleImport) {
|
|
102
108
|
return exportPath;
|
|
103
109
|
}
|
|
104
110
|
const [matchedPath, moduleName] = matchedModuleImport;
|
|
105
|
-
const matchedRoot = settings?.appRoots?.find(root => matchedPath.startsWith(root)) ?? matchedPath;
|
|
106
111
|
// If module import is imported from inside module, turn into a local absolute path starting with '@/'
|
|
107
112
|
// Otherwise, if module import is imported from outside module, use module name
|
|
108
|
-
return destinationPath.startsWith(matchedPath) ? exportPath.replace(
|
|
113
|
+
return destinationPath.startsWith(matchedPath) ? exportPath.replace(matchedPath, '@') : moduleName;
|
|
109
114
|
};
|
|
115
|
+
exports.normaliseModuleName = normaliseModuleName;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"File.test.d.ts","sourceRoot":"","sources":["../../src/dsl/File.test.ts"],"names":[],"mappings":""}
|