@skmtc/core 0.0.401 → 0.0.402
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.js +4 -16
- package/package.json +1 -1
- package/script/dsl/File.js +4 -16
package/esm/dsl/File.js
CHANGED
|
@@ -65,25 +65,13 @@ export class File {
|
|
|
65
65
|
}
|
|
66
66
|
_File_generatorKeys = new WeakMap();
|
|
67
67
|
const updateModuleName = ({ destinationPath, moduleImportMap, exportPath }) => {
|
|
68
|
-
console.log('DESTINATION PATH', destinationPath);
|
|
69
|
-
console.log('MODULE IMPORT MAP', moduleImportMap);
|
|
70
|
-
console.log('EXPORT PATH', exportPath);
|
|
71
68
|
const matchedModuleImport = [...moduleImportMap.entries()].find(([key]) => exportPath.startsWith(key));
|
|
69
|
+
// If exportPath does not match any module imports, return the original exportPath
|
|
72
70
|
if (!matchedModuleImport) {
|
|
73
71
|
return exportPath;
|
|
74
72
|
}
|
|
75
|
-
console.log('MATCHED MODULE IMPORT', matchedModuleImport);
|
|
76
73
|
const [matchedPath, moduleName] = matchedModuleImport;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const updatedExportPath = exportPath.replace(matchedPath, moduleName);
|
|
81
|
-
console.log('UPDATED EXPORT PATH', updatedExportPath);
|
|
82
|
-
return updatedExportPath;
|
|
83
|
-
}
|
|
84
|
-
const result = destinationPath.startsWith(matchedPath)
|
|
85
|
-
? exportPath.replace(matchedPath, '@')
|
|
86
|
-
: moduleName;
|
|
87
|
-
console.log('RESULT', result);
|
|
88
|
-
return result;
|
|
74
|
+
// If module import is imported from inside module, turn into a local absolute path starting with '@/'
|
|
75
|
+
// Otherwise, if module import is imported from outside module, use module name
|
|
76
|
+
return destinationPath.startsWith(matchedPath) ? exportPath.replace(matchedPath, '@') : moduleName;
|
|
89
77
|
};
|
package/package.json
CHANGED
package/script/dsl/File.js
CHANGED
|
@@ -69,25 +69,13 @@ class File {
|
|
|
69
69
|
exports.File = File;
|
|
70
70
|
_File_generatorKeys = new WeakMap();
|
|
71
71
|
const updateModuleName = ({ destinationPath, moduleImportMap, exportPath }) => {
|
|
72
|
-
console.log('DESTINATION PATH', destinationPath);
|
|
73
|
-
console.log('MODULE IMPORT MAP', moduleImportMap);
|
|
74
|
-
console.log('EXPORT PATH', exportPath);
|
|
75
72
|
const matchedModuleImport = [...moduleImportMap.entries()].find(([key]) => exportPath.startsWith(key));
|
|
73
|
+
// If exportPath does not match any module imports, return the original exportPath
|
|
76
74
|
if (!matchedModuleImport) {
|
|
77
75
|
return exportPath;
|
|
78
76
|
}
|
|
79
|
-
console.log('MATCHED MODULE IMPORT', matchedModuleImport);
|
|
80
77
|
const [matchedPath, moduleName] = matchedModuleImport;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const updatedExportPath = exportPath.replace(matchedPath, moduleName);
|
|
85
|
-
console.log('UPDATED EXPORT PATH', updatedExportPath);
|
|
86
|
-
return updatedExportPath;
|
|
87
|
-
}
|
|
88
|
-
const result = destinationPath.startsWith(matchedPath)
|
|
89
|
-
? exportPath.replace(matchedPath, '@')
|
|
90
|
-
: moduleName;
|
|
91
|
-
console.log('RESULT', result);
|
|
92
|
-
return result;
|
|
78
|
+
// If module import is imported from inside module, turn into a local absolute path starting with '@/'
|
|
79
|
+
// Otherwise, if module import is imported from outside module, use module name
|
|
80
|
+
return destinationPath.startsWith(matchedPath) ? exportPath.replace(matchedPath, '@') : moduleName;
|
|
93
81
|
};
|