@cloudflare/worker-bundler 0.2.1 → 0.2.2

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/README.md CHANGED
@@ -397,7 +397,7 @@ const result = await createApp({
397
397
  const worker = env.LOADER.get(loaderId, () => ({
398
398
  mainModule: result.mainModule,
399
399
  modules: result.modules,
400
- compatibilityDate: "2026-01-28"
400
+ compatibilityDate: "2026-06-11"
401
401
  }));
402
402
 
403
403
  // Mount as a facet for persistent storage
package/dist/esbuild.wasm CHANGED
Binary file
package/dist/index.js CHANGED
@@ -188,7 +188,7 @@ function parseImports(code) {
188
188
  */
189
189
  function parseImportsRegex(code) {
190
190
  const imports = [];
191
- for (const match of code.matchAll(/import\s+(?:(?:[\w*{}\s,]+)\s+from\s+)?['"]([^'"]+)['"]/g)) {
191
+ for (const match of code.matchAll(/\bimport\b\s+(?:(?:(?!\b(?:import|export)\b)[\w*{},])+(?:\s+(?:(?!\b(?:import|export)\b)[\w*{},])+)*\s+from\s+)?['"]([^'"]+)['"]/g)) {
192
192
  const specifier = match[1];
193
193
  if (specifier) imports.push(specifier);
194
194
  }
@@ -196,7 +196,7 @@ function parseImportsRegex(code) {
196
196
  const specifier = match[1];
197
197
  if (specifier) imports.push(specifier);
198
198
  }
199
- for (const match of code.matchAll(/export\s+(?:[\w*{}\s,]+\s+)?from\s+['"]([^'"]+)['"]/g)) {
199
+ for (const match of code.matchAll(/\bexport\b\s+(?:(?:(?!\b(?:import|export)\b)[\w*{},])+(?:\s+(?:(?!\b(?:import|export)\b)[\w*{},])+)*\s+)?from\s+['"]([^'"]+)['"]/g)) {
200
200
  const specifier = match[1];
201
201
  if (specifier) imports.push(specifier);
202
202
  }
@@ -713,7 +713,7 @@ async function transformAndResolve(files, entryPoint, externals) {
713
713
  * This is necessary because the Worker Loader expects imports to match registered module names.
714
714
  */
715
715
  function rewriteImports(code, importer, files, pathMap, externals) {
716
- const importExportRegex = /(import\s+(?:[\w*{}\s,]+\s+from\s+)?|export\s+(?:[\w*{}\s,]+\s+)?from\s+)(['"])([^'"]+)\2/g;
716
+ const importExportRegex = /(\bimport\b\s+(?:(?:(?!\b(?:import|export)\b)[\w*{},])+(?:\s+(?:(?!\b(?:import|export)\b)[\w*{},])+)*\s+from\s+)?|\bexport\b\s+(?:(?:(?!\b(?:import|export)\b)[\w*{},])+(?:\s+(?:(?!\b(?:import|export)\b)[\w*{},])+)*\s+)?from\s+)(['"])([^'"]+)\2/g;
717
717
  const importerOutputPath = pathMap.get(importer) ?? importer;
718
718
  return code.replace(importExportRegex, (match, prefix, quote, specifier) => {
719
719
  if (externals.includes(specifier) || externals.some((e) => specifier.startsWith(`${e}/`) || specifier.startsWith(e))) return match;