@absolutejs/absolute 0.19.0-beta.846 → 0.19.0-beta.848

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.
@@ -37,7 +37,7 @@ export declare const compileEmberFileSource: (entry: string) => Promise<string>;
37
37
  * lives in `compileEmber` itself, not in a separate cache layer.
38
38
  */
39
39
  export declare const clearEmberCompilerCache: () => void;
40
- export declare const getEmberCompiledRoot: (emberDir: string) => string;
40
+ export declare const getEmberCompiledRoot: (_emberDir?: string) => string;
41
41
  export declare const getEmberServerCompiledDir: (emberDir: string) => string;
42
42
  export declare const getEmberClientCompiledDir: (emberDir: string) => string;
43
43
  export { dirname, basename };
@@ -0,0 +1,3 @@
1
+ export type GeneratedFramework = 'angular' | 'vue' | 'svelte' | 'react' | 'ember';
2
+ export declare const getGeneratedRoot: (projectRoot?: string) => string;
3
+ export declare const getFrameworkGeneratedDir: (framework: GeneratedFramework, projectRoot?: string) => string;
@@ -749,11 +749,53 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
749
749
  code: await compileStyleSource(path, content, language, config)
750
750
  };
751
751
  }
752
- }), compileStyleFileIfNeeded = async (filePath, config) => {
753
- if (!isPreprocessableStylePath(filePath)) {
754
- return runPostcss(await readFile(filePath, "utf-8"), filePath, config);
752
+ }), CSS_IMPORT_PATTERN, resolveCssImportsAsync = async (content, baseDir, visited) => {
753
+ const matches = Array.from(content.matchAll(CSS_IMPORT_PATTERN));
754
+ if (matches.length === 0)
755
+ return content;
756
+ let cursor = 0;
757
+ const parts = [];
758
+ for (const match of matches) {
759
+ const importPath = match[1];
760
+ if (importPath === undefined)
761
+ continue;
762
+ const start = match.index ?? 0;
763
+ const end = start + match[0].length;
764
+ parts.push(content.slice(cursor, start));
765
+ const fullPath = isAbsolute(importPath) ? importPath : resolve2(baseDir, importPath);
766
+ if (visited.has(fullPath) || !existsSync2(fullPath)) {
767
+ parts.push(visited.has(fullPath) ? "" : match[0]);
768
+ cursor = end;
769
+ continue;
770
+ }
771
+ const nextVisited = new Set(visited);
772
+ nextVisited.add(fullPath);
773
+ const imported = await readFile(fullPath, "utf-8");
774
+ parts.push(await resolveCssImportsAsync(imported, dirname(fullPath), nextVisited));
775
+ cursor = end;
755
776
  }
756
- return compileStyleSource(filePath, undefined, undefined, config);
777
+ parts.push(content.slice(cursor));
778
+ return parts.join("");
779
+ }, compileStyleFileIfNeeded = async (filePath, config) => {
780
+ if (!isPreprocessableStylePath(filePath)) {
781
+ const raw = await readFile(filePath, "utf-8");
782
+ const processed = await runPostcss(raw, filePath, config);
783
+ return resolveCssImportsAsync(processed, dirname(filePath), new Set([filePath]));
784
+ }
785
+ const compiled = await compileStyleSource(filePath, undefined, undefined, config);
786
+ return resolveCssImportsAsync(compiled, dirname(filePath), new Set([filePath]));
787
+ }, resolveCssImportsSync = (content, baseDir, visited) => {
788
+ return content.replace(CSS_IMPORT_PATTERN, (match, importPath) => {
789
+ const fullPath = isAbsolute(importPath) ? importPath : resolve2(baseDir, importPath);
790
+ if (visited.has(fullPath))
791
+ return "";
792
+ if (!existsSync2(fullPath))
793
+ return match;
794
+ const nextVisited = new Set(visited);
795
+ nextVisited.add(fullPath);
796
+ const imported = readFileSync2(fullPath, "utf-8");
797
+ return resolveCssImportsSync(imported, dirname(fullPath), nextVisited);
798
+ });
757
799
  }, compileStyleFileIfNeededSync = (filePath, config) => {
758
800
  const rawContents = readFileSync2(filePath, "utf-8");
759
801
  const language = getStyleLanguage(filePath);
@@ -771,7 +813,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
771
813
  }
772
814
  const contents = withAdditionalData(rawContents, options.additionalData);
773
815
  const loadPaths = normalizeLoadPaths(filePath, options.loadPaths);
774
- return sass.compileString(contents, {
816
+ const compiled = sass.compileString(contents, {
775
817
  importers: [
776
818
  createSassImporter(filePath, loadPaths, language, config)
777
819
  ],
@@ -780,6 +822,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
780
822
  syntax: language === "sass" ? "indented" : "scss",
781
823
  url: new URL(`file://${filePath}`)
782
824
  }).css;
825
+ return resolveCssImportsSync(compiled, dirname(filePath), new Set([filePath]));
783
826
  }
784
827
  if (language === "less") {
785
828
  throw new Error(`Unable to compile ${filePath}: Less styleUrl preprocessing is async-only. Import the Less file from a bundled entrypoint or use SCSS/CSS for Angular styleUrl.`);
@@ -787,7 +830,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
787
830
  if (language === "stylus") {
788
831
  throw new Error(`Unable to compile ${filePath}: Stylus styleUrl preprocessing is async-only. Import the Stylus file from a bundled entrypoint or use SCSS/CSS for Angular styleUrl.`);
789
832
  }
790
- return rawContents;
833
+ return resolveCssImportsSync(rawContents, dirname(filePath), new Set([filePath]));
791
834
  }, getCssOutputExtension = (filePath) => isPreprocessableStylePath(filePath) ? ".css" : extname(filePath);
792
835
  var init_stylePreprocessor = __esm(() => {
793
836
  CSS_EXTENSION_PATTERN = /\.css$/i;
@@ -800,6 +843,7 @@ var init_stylePreprocessor = __esm(() => {
800
843
  styleDependencyGraph = new Map;
801
844
  styleOutputHashes = new Map;
802
845
  stylePreprocessorPlugin = createStylePreprocessorPlugin();
846
+ CSS_IMPORT_PATTERN = /@import\s+["']([^"']+)["']\s*;?/g;
803
847
  });
804
848
 
805
849
  // src/core/svelteServerModule.ts
@@ -3772,5 +3816,5 @@ export {
3772
3816
  createTypedIsland
3773
3817
  };
3774
3818
 
3775
- //# debugId=A6579D02DBD1FDED64756E2164756E21
3819
+ //# debugId=56694EE8B35B170664756E2164756E21
3776
3820
  //# sourceMappingURL=index.js.map