@timber-js/app 0.2.0-alpha.63 → 0.2.0-alpha.64

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/dist/index.js CHANGED
@@ -12590,7 +12590,9 @@ var SHIM_MAP = {
12590
12590
  "next/navigation": resolve(SHIMS_DIR, "navigation.ts"),
12591
12591
  "next/headers": resolve(SHIMS_DIR, "headers.ts"),
12592
12592
  "next/font/google": "\0@timber/fonts/google",
12593
- "next/font/local": "\0@timber/fonts/local"
12593
+ "next/font/local": "\0@timber/fonts/local",
12594
+ "@timber-js/app/fonts/google": "\0@timber/fonts/google",
12595
+ "@timber-js/app/fonts/local": "\0@timber/fonts/local"
12594
12596
  };
12595
12597
  /**
12596
12598
  * Strip .js extension from an import specifier.
@@ -13578,7 +13580,7 @@ function detectDynamicFontCall(source, importedNames) {
13578
13580
  * The shims plugin resolves `next/font/google` to the same virtual module,
13579
13581
  * but the source code still contains the original import specifier.
13580
13582
  */
13581
- var GOOGLE_FONT_IMPORT_RE = /import\s*\{([^}]+)\}\s*from\s*['"](?:@timber\/fonts\/google|next\/font\/google)['"]/g;
13583
+ var GOOGLE_FONT_IMPORT_RE = /import\s*\{([^}]+)\}\s*from\s*['"](?:@timber\/fonts\/google|@timber-js\/app\/fonts\/google|next\/font\/google)['"]/g;
13582
13584
  /**
13583
13585
  * Parse the original (remote) font family names from imports.
13584
13586
  *
@@ -13694,7 +13696,7 @@ function generateAllFontCss(registry) {
13694
13696
  * import myLoader from '@timber/fonts/local'
13695
13697
  */
13696
13698
  function parseLocalFontImportName(source) {
13697
- const match = source.match(/import\s+(\w+)\s+from\s*['"](?:@timber\/fonts\/local|next\/font\/local)['"]/);
13699
+ const match = source.match(/import\s+(\w+)\s+from\s*['"](?:@timber\/fonts\/local|@timber-js\/app\/fonts\/local|next\/font\/local)['"]/);
13698
13700
  return match ? match[1] : null;
13699
13701
  }
13700
13702
  /**
@@ -13724,7 +13726,7 @@ function transformLocalFonts(transformedCode, originalCode, importerId, registry
13724
13726
  const replacement = `const ${varName} = ${extracted.variable ? `{ className: "${extracted.className}", style: { fontFamily: "${extracted.fontFamily}" }, variable: "${extracted.variable}" }` : `{ className: "${extracted.className}", style: { fontFamily: "${extracted.fontFamily}" } }`}`;
13725
13727
  transformedCode = transformedCode.replace(fullMatch, replacement);
13726
13728
  }
13727
- transformedCode = transformedCode.replace(/import\s+\w+\s+from\s*['"](?:@timber\/fonts\/local|next\/font\/local)['"];?\s*\n?/g, "");
13729
+ transformedCode = transformedCode.replace(/import\s+\w+\s+from\s*['"](?:@timber\/fonts\/local|@timber-js\/app\/fonts\/local|next\/font\/local)['"];?\s*\n?/g, "");
13728
13730
  return transformedCode;
13729
13731
  }
13730
13732
  /**
@@ -13802,8 +13804,8 @@ function timberFonts(ctx) {
13802
13804
  },
13803
13805
  transform(code, id) {
13804
13806
  if (id.startsWith("\0") || id.includes("node_modules")) return null;
13805
- const hasGoogleImport = code.includes("@timber/fonts/google") || code.includes("next/font/google");
13806
- const hasLocalImport = code.includes("@timber/fonts/local") || code.includes("next/font/local");
13807
+ const hasGoogleImport = code.includes("@timber/fonts/google") || code.includes("@timber-js/app/fonts/google") || code.includes("next/font/google");
13808
+ const hasLocalImport = code.includes("@timber/fonts/local") || code.includes("@timber-js/app/fonts/local") || code.includes("next/font/local");
13807
13809
  if (!hasGoogleImport && !hasLocalImport) return null;
13808
13810
  let transformedCode = code;
13809
13811
  if (hasGoogleImport) {
@@ -13845,7 +13847,7 @@ function timberFonts(ctx) {
13845
13847
  transformedCode = transformedCode.replace(fullMatch, replacement);
13846
13848
  }
13847
13849
  }
13848
- transformedCode = transformedCode.replace(/import\s*\{[^}]+\}\s*from\s*['"](?:@timber\/fonts\/google|next\/font\/google)['"];?\s*\n?/g, "");
13850
+ transformedCode = transformedCode.replace(/import\s*\{[^}]+\}\s*from\s*['"](?:@timber\/fonts\/google|@timber-js\/app\/fonts\/google|next\/font\/google)['"];?\s*\n?/g, "");
13849
13851
  }
13850
13852
  }
13851
13853
  if (hasLocalImport) transformedCode = transformLocalFonts(transformedCode, code, id, registry, this.error.bind(this));