@idomatic/core 1.0.2 โ 1.0.3
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/lib/core.js +5 -8
- package/package.json +1 -1
package/lib/core.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { createRequire } from "module";
|
|
3
|
+
import { pathToFileURL } from "url";
|
|
3
4
|
|
|
4
5
|
const parserMap = {
|
|
5
6
|
".js": "@idomatic/parser-js",
|
|
@@ -11,8 +12,7 @@ const parserMap = {
|
|
|
11
12
|
".ng.html": "@idomatic/parser-html",
|
|
12
13
|
};
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
const requireFromUserProject = createRequire(process.cwd());
|
|
15
|
+
const requireFromProject = createRequire(process.cwd());
|
|
16
16
|
|
|
17
17
|
export async function processFile(filePath, config) {
|
|
18
18
|
const ext = path.extname(filePath).toLowerCase();
|
|
@@ -24,12 +24,9 @@ export async function processFile(filePath, config) {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
try {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
console.log(`๐งช Resolved "${parserPackage}" to:`, resolvedPath);
|
|
31
|
-
|
|
32
|
-
const parser = await import(resolvedPath);
|
|
27
|
+
const resolvedPath = requireFromProject.resolve(parserPackage);
|
|
28
|
+
const resolvedURL = pathToFileURL(resolvedPath).href;
|
|
29
|
+
const parser = await import(resolvedURL);
|
|
33
30
|
await parser.default(filePath, config);
|
|
34
31
|
console.log(`โ
Updated: ${filePath}`);
|
|
35
32
|
} catch (err) {
|