@pylonsync/functions 0.4.14 → 0.4.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pylonsync/functions",
3
- "version": "0.4.14",
3
+ "version": "0.4.15",
4
4
  "description": "TypeScript function runtime for pylon — defines server-side queries, mutations, and actions.",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -1621,11 +1621,17 @@ async function _doBuildInner(
1621
1621
  // against; the build itself is fine.
1622
1622
  }
1623
1623
 
1624
- // Scan a built JS file for static `import` literals pointing
1625
- // at `./chunks/<file>.js` and return them resolved to outdir-
1626
- // relative paths. Bun's minified output uses simple double
1627
- // quotes for module specifiers, so a `matchAll` covers both
1628
- // `import X from "Y"` and bare `import "Y"`.
1624
+ // Scan a built JS file for STATIC `import` literals pointing at
1625
+ // `./chunks/<file>.js` and return them resolved to outdir-relative paths.
1626
+ // Bun's minified output uses simple double quotes for module specifiers,
1627
+ // so a `matchAll` covers both `import X from "Y"` and bare `import "Y"`.
1628
+ //
1629
+ // DYNAMIC `import("Y")` is deliberately NOT matched. This list becomes the
1630
+ // route's modulepreload set, and a chunk the author deferred behind
1631
+ // `import()` must not be downloaded eagerly anyway — that would split the
1632
+ // code out of the entry (so it isn't parsed on load) while still shipping
1633
+ // every byte, which is the expensive half of the cost with none of the
1634
+ // saving. The trailing `(` is what distinguishes the two forms.
1629
1635
  function scanChunkImports(jsAbsPath: string): string[] {
1630
1636
  let src: string;
1631
1637
  try {
@@ -1634,9 +1640,7 @@ async function _doBuildInner(
1634
1640
  return [];
1635
1641
  }
1636
1642
  const found = new Set<string>();
1637
- const matches = src.matchAll(
1638
- /(?:from\s*|import\s*\(?\s*)["']([^"']+)["']/g,
1639
- );
1643
+ const matches = src.matchAll(/(?:from\s*|import\s*)["']([^"']+)["']/g);
1640
1644
  for (const m of matches) {
1641
1645
  const spec = m[1];
1642
1646
  if (spec.startsWith("./chunks/") || spec.startsWith("chunks/")) {