@veryfront/ext-content-mdx 0.1.1043 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.1043",
3
+ "version": "0.1.1044",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "minimumDependencyAge": {
@@ -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,CAuLxB"}
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
- resolve({ success: false, code: 1 });
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;AA8ED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAWrF;AAED,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAyBjG"}
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
- return body
58
- .split(/\r?\n/)
59
- .map((line) => {
60
- const trimmed = line.trimStart();
61
- if (!trimmed.startsWith("import") && !trimmed.startsWith("export"))
62
- return line;
63
- return rewriteLine(line, basedir, config.target, config.baseUrl);
64
- })
65
- .join("\n");
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
- code = code.replace(/file:\/\/[A-Za-z0-9_\-./%]+/g, (match) => mapper(match));
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
  }
@@ -1,3 +1,3 @@
1
1
  /** Shared version value. */
2
- export declare const VERSION = "0.1.1043";
2
+ export declare const VERSION = "0.1.1044";
3
3
  //# sourceMappingURL=version-constant.d.ts.map
@@ -1,4 +1,4 @@
1
1
  // Keep in sync with deno.json version.
2
2
  // scripts/release.ts updates this constant during releases.
3
3
  /** Shared version value. */
4
- export const VERSION = "0.1.1043";
4
+ export const VERSION = "0.1.1044";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veryfront/ext-content-mdx",
3
- "version": "0.1.1043",
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.1043"
70
+ "veryfront": "^0.1.1044"
71
71
  },
72
72
  "type": "module",
73
73
  "types": "./esm/extensions/ext-content-mdx/src/index.d.ts",