@veryfront/ext-content-mdx 0.1.1042 → 0.1.1044
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/deno.js +1 -1
- package/esm/src/platform/compat/process/command.d.ts.map +1 -1
- package/esm/src/platform/compat/process/command.js +13 -2
- package/esm/src/transforms/mdx/compiler/import-rewriter.d.ts.map +1 -1
- package/esm/src/transforms/mdx/compiler/import-rewriter.js +17 -17
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +2 -2
package/esm/deno.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/process/command.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,gDAAgD;IAChD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mEAAmE;IACnE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,sEAAsE;IACtE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA6ED;;;;;;;;;GASG;AACH,wBAAsB,UAAU,CAC9B,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/process/command.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,gDAAgD;IAChD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mEAAmE;IACnE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,sEAAsE;IACtE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA6ED;;;;;;;;;GASG;AACH,wBAAsB,UAAU,CAC9B,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,aAAa,CAAC,CAkMxB"}
|
|
@@ -186,9 +186,20 @@ export async function runCommand(cmd, options = {}) {
|
|
|
186
186
|
stderr: capture ? stderr : undefined,
|
|
187
187
|
});
|
|
188
188
|
});
|
|
189
|
-
child.on("error", () => {
|
|
189
|
+
child.on("error", (spawnError) => {
|
|
190
190
|
timeout.clear();
|
|
191
|
-
|
|
191
|
+
// Include the spawn error message so callers can distinguish ENOENT
|
|
192
|
+
// ("command not found"), EACCES ("permission denied"), etc.
|
|
193
|
+
resolve({
|
|
194
|
+
success: false,
|
|
195
|
+
code: 1,
|
|
196
|
+
stdout: capture ? stdout : undefined,
|
|
197
|
+
stderr: capture
|
|
198
|
+
? (stderr
|
|
199
|
+
? `${stderr}\nSpawn error: ${spawnError.message}`
|
|
200
|
+
: `Spawn error: ${spawnError.message}`)
|
|
201
|
+
: undefined,
|
|
202
|
+
});
|
|
192
203
|
});
|
|
193
204
|
});
|
|
194
205
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-rewriter.d.ts","sourceRoot":"","sources":["../../../../../src/src/transforms/mdx/compiler/import-rewriter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;
|
|
1
|
+
{"version":3,"file":"import-rewriter.d.ts","sourceRoot":"","sources":["../../../../../src/src/transforms/mdx/compiler/import-rewriter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAuDD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAwBrF;AAED,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,oBAAoB,GAAG,MAAM,CA2BjG"}
|
|
@@ -45,24 +45,21 @@ function mapSpec(spec, basedir, target, baseUrl) {
|
|
|
45
45
|
return toBrowserFs(abs, baseUrl);
|
|
46
46
|
return abs.startsWith("http") ? abs : `file://${abs}`;
|
|
47
47
|
}
|
|
48
|
-
function rewriteLine(line, basedir, target, baseUrl) {
|
|
49
|
-
const mapper = (spec) => mapSpec(spec, basedir, target, baseUrl);
|
|
50
|
-
return line
|
|
51
|
-
.replace(/^(\s*import\s+[^'";]+?from\s+)(["'])([^"']+)(\2)/, (_m, p1, q, s, q2) => `${p1}${q}${mapper(s)}${q2}`)
|
|
52
|
-
.replace(/^(\s*import\s+)(["'])([^"']+)(\2)/, (_m, p1, q, s, q2) => `${p1}${q}${mapper(s)}${q2}`)
|
|
53
|
-
.replace(/^(\s*export\s+[^'";]+?from\s+)(["'])([^"']+)(\2)/, (_m, p1, q, s, q2) => `${p1}${q}${mapper(s)}${q2}`);
|
|
54
|
-
}
|
|
55
48
|
export function rewriteBodyImports(body, config) {
|
|
56
49
|
const basedir = dirname(config.filePath);
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
50
|
+
const mapper = (spec) => mapSpec(spec, basedir, config.target, config.baseUrl);
|
|
51
|
+
// Rewrite `import … from '…'` and `export … from '…'`, including multiline
|
|
52
|
+
// destructured imports. `[\s\S]*?` crosses newlines so that
|
|
53
|
+
// import {
|
|
54
|
+
// Foo,
|
|
55
|
+
// Bar
|
|
56
|
+
// } from "mod"
|
|
57
|
+
// is rewritten in one pass. The non-greedy match stops at the first `from`
|
|
58
|
+
// keyword, which is correct for well-formed ESM.
|
|
59
|
+
let result = body.replace(/(^[ \t]*(?:import|export)\s+[\s\S]*?\bfrom\b\s*)(["'])([^"']+)(\2)/gm, (_m, p1, q, s, q2) => `${p1}${q}${mapper(s)}${q2}`);
|
|
60
|
+
// Side-effect-only imports have no bindings or `from`: import "mod"
|
|
61
|
+
result = result.replace(/^([ \t]*import\s+)(["'])([^"']+)(\2)/gm, (_m, p1, q, s, q2) => `${p1}${q}${mapper(s)}${q2}`);
|
|
62
|
+
return result;
|
|
66
63
|
}
|
|
67
64
|
export function rewriteCompiledImports(compiledCode, config) {
|
|
68
65
|
const basedir = dirname(config.filePath);
|
|
@@ -82,6 +79,9 @@ export function rewriteCompiledImports(compiledCode, config) {
|
|
|
82
79
|
/(import\(\s*["'])(\.{1,2}\/[^"']+)(["']\s*\))/g,
|
|
83
80
|
/(import\(\s*["'])(file:\/\/[^"']+)(["']\s*\))/g,
|
|
84
81
|
]);
|
|
85
|
-
|
|
82
|
+
// Note: `file://` URLs in import positions are already fully covered by the
|
|
83
|
+
// patterns above (`from "file://…"` and `import("file://…")`). A blanket
|
|
84
|
+
// replacement across the whole code string would incorrectly rewrite URLs
|
|
85
|
+
// inside string literals and comments, so it is intentionally omitted here.
|
|
86
86
|
return code;
|
|
87
87
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veryfront/ext-content-mdx",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1044",
|
|
4
4
|
"description": "Veryfront first-party extension package for ext-content-mdx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"veryfront",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"vfile": "6.0.3"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"veryfront": "^0.1.
|
|
70
|
+
"veryfront": "^0.1.1044"
|
|
71
71
|
},
|
|
72
72
|
"type": "module",
|
|
73
73
|
"types": "./esm/extensions/ext-content-mdx/src/index.d.ts",
|