@stillwind/integration 0.8.0 → 0.10.0

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.
Files changed (80) hide show
  1. package/CHANGELOG.md +190 -0
  2. package/dist/astro/development.d.ts +2 -0
  3. package/dist/astro/development.js +2 -0
  4. package/dist/astro/development.js.map +1 -1
  5. package/dist/astro/index.d.ts +1 -1
  6. package/dist/astro/index.js +8 -2
  7. package/dist/astro/index.js.map +1 -1
  8. package/dist/{emission-BVi5aRbb.js → emission-BpaN4Z4m.js} +212 -69
  9. package/dist/emission-BpaN4Z4m.js.map +1 -0
  10. package/dist/fresh/index.d.ts +1 -1
  11. package/dist/fresh/index.js +1 -1
  12. package/dist/{index-DFfbZxNT.d.ts → index-B6EtrWus.d.ts} +2 -2
  13. package/dist/loader-cache-DfOGY8AJ.js +231 -0
  14. package/dist/loader-cache-DfOGY8AJ.js.map +1 -0
  15. package/dist/next/css-loader.d.ts +5 -2
  16. package/dist/next/css-loader.js +7 -2
  17. package/dist/next/css-loader.js.map +1 -1
  18. package/dist/next/index.js +2 -0
  19. package/dist/next/index.js.map +1 -1
  20. package/dist/{node-loader-D-3Ynpy1.d.ts → node-loader-Bqg7E5zq.d.ts} +6 -3
  21. package/dist/nuxt/index.d.ts +2 -2
  22. package/dist/nuxt/index.js +2 -1
  23. package/dist/nuxt/index.js.map +1 -1
  24. package/dist/{plugin-aV0zIIAe.d.ts → plugin-BAG0ZI1X.d.ts} +58 -6
  25. package/dist/{plugin-mPiBLdqa.js → plugin-D-45o54j.js} +5 -2
  26. package/dist/plugin-D-45o54j.js.map +1 -0
  27. package/dist/{plugin-ByYcpBcE.js → plugin-DQH8QlYh.js} +331 -36
  28. package/dist/plugin-DQH8QlYh.js.map +1 -0
  29. package/dist/{project-DUGu8g_L.d.ts → project-B_KFQist.d.ts} +2 -2
  30. package/dist/project-egWF2vWJ.js +428 -0
  31. package/dist/project-egWF2vWJ.js.map +1 -0
  32. package/dist/{project-BNw0nZBE.d.ts → project-mB7CODIs.d.ts} +46 -7
  33. package/dist/rsbuild/index.d.ts +4 -1
  34. package/dist/rsbuild/index.js +2 -2
  35. package/dist/rsbuild/index.js.map +1 -1
  36. package/dist/rspack/index.d.ts +1 -1
  37. package/dist/rspack/index.js +1 -1
  38. package/dist/session-Cxf4D6oQ.d.ts +163 -0
  39. package/dist/source-entries-J5azZ_-z.js +350 -0
  40. package/dist/source-entries-J5azZ_-z.js.map +1 -0
  41. package/dist/turbopack/css-loader.d.ts +5 -2
  42. package/dist/turbopack/css-loader.js +53 -17
  43. package/dist/turbopack/css-loader.js.map +1 -1
  44. package/dist/turbopack/index.d.ts +2 -2
  45. package/dist/turbopack/loader.d.ts +3 -2
  46. package/dist/turbopack/loader.js +10 -4
  47. package/dist/turbopack/loader.js.map +1 -1
  48. package/dist/turbopack/node-loader.d.ts +1 -1
  49. package/dist/turbopack/node-loader.js +1 -0
  50. package/dist/turbopack/node-loader.js.map +1 -1
  51. package/dist/vite/index.d.ts +2 -2
  52. package/dist/vite/index.js +1 -1
  53. package/dist/vite/runtime.d.ts +10 -3
  54. package/dist/vite/runtime.js +8 -1
  55. package/dist/vite/runtime.js.map +1 -1
  56. package/dist/webpack/css-loader.js +1 -1
  57. package/dist/webpack/document-loader.d.ts +4 -1
  58. package/dist/webpack/document-loader.js +5 -2
  59. package/dist/webpack/document-loader.js.map +1 -1
  60. package/dist/webpack/fragment-loader.d.ts +1 -0
  61. package/dist/webpack/fragment-loader.js +1 -0
  62. package/dist/webpack/fragment-loader.js.map +1 -1
  63. package/dist/webpack/index.d.ts +1 -1
  64. package/dist/webpack/index.js +1 -1
  65. package/dist/webpack/loader.js +15 -21
  66. package/dist/webpack/loader.js.map +1 -1
  67. package/dist/webpack/source-loader.d.ts +1 -0
  68. package/dist/webpack/source-loader.js +1 -0
  69. package/dist/webpack/source-loader.js.map +1 -1
  70. package/package.json +19 -17
  71. package/dist/binding-files-Ds5NpyVV.js +0 -45
  72. package/dist/binding-files-Ds5NpyVV.js.map +0 -1
  73. package/dist/emission-BVi5aRbb.js.map +0 -1
  74. package/dist/plugin-ByYcpBcE.js.map +0 -1
  75. package/dist/plugin-mPiBLdqa.js.map +0 -1
  76. package/dist/project-C3IH7geC.js +0 -182
  77. package/dist/project-C3IH7geC.js.map +0 -1
  78. package/dist/session-B9_rp9TH.d.ts +0 -72
  79. package/dist/session-DHUCQMG5.js +0 -117
  80. package/dist/session-DHUCQMG5.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/rsbuild/index.ts"],"sourcesContent":["import { fileURLToPath } from \"node:url\";\n\nimport type { RsbuildPlugin } from \"@rsbuild/core\";\nimport type { RspackOptions } from \"@rspack/core\";\nimport type { InlineConfig } from \"@stillwind/config\";\n\nimport { StillwindPlugin } from \"../webpack/plugin.ts\";\nimport { stillwindRules } from \"../webpack/rules.ts\";\n\nexport type { InlineConfig as IntegrationConfig } from \"@stillwind/config\";\n\n/** Rsbuild plugin that uses only the hook for updating the Rspack configuration. */\nexport interface StillwindRsbuildPlugin extends RsbuildPlugin {\n /**\n * Registers Stillwind's configuration changes through the host's Rspack hook.\n *\n * @param api - Host API that accepts a modifier for the mutable Rspack configuration.\n */\n setup(api: {\n /**\n * Registers a modifier for each generated Rspack configuration.\n * @param callback - Receives mutable host options and returns the configuration to use.\n */\n modifyRspackConfig(callback: (options: RspackOptions) => RspackOptions): void;\n }): void;\n}\n\n/**\n * Adapts existing CSS rules for Stillwind document carriers and source-map composition.\n *\n * The function excludes document carriers from matching CSS rules and inserts the Stillwind map\n * bridge before each Lightning CSS loader entry.\n *\n * @param rules - Mutable Rsbuild rule list, including any nested `oneOf` and `rules` lists.\n */\nfunction configureCssRules(rules: NonNullable<NonNullable<RspackOptions[\"module\"]>[\"rules\"]>) {\n for (const rule of rules) {\n if (!rule || typeof rule !== \"object\") {\n continue;\n }\n if (rule.test instanceof RegExp && rule.test.test(\"stillwind-webpack.css\")) {\n rule.exclude = [rule.exclude, /stillwind-webpack\\.css$/].filter(\n (condition): condition is NonNullable<typeof condition> => Boolean(condition),\n );\n }\n if (Array.isArray(rule.use)) {\n rule.use = rule.use.flatMap((use) => {\n const name =\n typeof use === \"string\"\n ? use\n : typeof use === \"object\" && use !== null\n ? use.loader\n : undefined;\n return name === \"builtin:lightningcss-loader\"\n ? [\n {\n loader: fileURLToPath(\n new URL(\n \"./css-map-loader.js\",\n import.meta.resolve(\"@stillwind/integration/webpack\"),\n ),\n ),\n },\n use,\n ]\n : [use];\n });\n }\n configureCssRules(rule.oneOf ?? []);\n configureCssRules(rule.rules ?? []);\n }\n}\n\n/**\n * Creates an Rsbuild plugin that installs Stillwind compilation and CSS rules.\n *\n * @param config - Configuration discovery and inline overrides shared by the generated rules.\n * @returns A plugin whose setup hook adjusts Rspack rules and registers a `StillwindPlugin`\n * instance.\n */\nexport function pluginStillwind(config: InlineConfig = {}): StillwindRsbuildPlugin {\n return {\n name: \"stillwind\",\n /**\n * Registers CSS rule adaptation and the compiler plugin on Rsbuild's Rspack configuration hook.\n * @param api - Host API that applies the registered modifier before compilation.\n */\n setup(api) {\n api.modifyRspackConfig((options) => {\n options.module ??= {};\n options.module.rules ??= [];\n configureCssRules(options.module.rules);\n options.plugins ??= [];\n options.plugins.push(new RsbuildStillwindPlugin(config));\n return options;\n });\n },\n };\n}\n\n/**\n * A Stillwind plugin that places producer compilation within the Rsbuild framework loader chain.\n */\nclass RsbuildStillwindPlugin extends StillwindPlugin {\n /**\n * Appends Stillwind rules after framework pre-loaders and before normal JSX lowering.\n *\n * Vue query blocks are excluded from the script rule. Document carriers use native CSS modules so\n * rebuilding them does not rerun the extraction loader.\n *\n * @param rules - Mutable Rspack rule list already configured by Rsbuild.\n */\n protected override configureRules(rules: unknown[]): void {\n const [javascript, ...stylesheets] = stillwindRules(this.config);\n // Framework pre-loaders must split routes/server functions before CSS\n // ownership is determined. Appending a normal loader still runs before SWC.\n delete javascript.enforce;\n const script = {\n ...javascript,\n resourceQuery: {\n not: [/[?&]vue(?:[=&]|$)/],\n },\n };\n // Document carriers are rebuilt after graph linking. Native CSS modules avoid\n // running Rsbuild's extraction loader again during that rebuild.\n rules.push(\n script,\n ...stylesheets.map((rule) =>\n rule.test.test(\"stillwind-webpack.css\")\n ? {\n ...rule,\n type: \"css\",\n }\n : rule,\n ),\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;AAmCA,SAAS,kBAAkB,OAAmE;CAC5F,KAAK,MAAM,QAAQ,OAAO;EACxB,IAAI,CAAC,QAAQ,OAAO,SAAS,UAC3B;EAEF,IAAI,KAAK,gBAAgB,UAAU,KAAK,KAAK,KAAK,uBAAuB,GACvE,KAAK,UAAU,CAAC,KAAK,SAAS,yBAAyB,CAAC,CAAC,QACtD,cAA0D,QAAQ,SAAS,CAC9E;EAEF,IAAI,MAAM,QAAQ,KAAK,GAAG,GACxB,KAAK,MAAM,KAAK,IAAI,SAAS,QAAQ;GAOnC,QALE,OAAO,QAAQ,WACX,MACA,OAAO,QAAQ,YAAY,QAAQ,OACjC,IAAI,SACJ,KAAA,OACQ,gCACZ,CACE,EACE,QAAQ,cACN,IAAI,IACF,uBACA,YAAY,QAAQ,gCAAgC,CACtD,CACF,EACF,GACA,GACF,IACA,CAAC,GAAG;EACV,CAAC;EAEH,kBAAkB,KAAK,SAAS,CAAC,CAAC;EAClC,kBAAkB,KAAK,SAAS,CAAC,CAAC;CACpC;AACF;;;;;;;;AASA,SAAgB,gBAAgB,SAAuB,CAAC,GAA2B;CACjF,OAAO;EACL,MAAM;;;;;EAKN,MAAM,KAAK;GACT,IAAI,oBAAoB,YAAY;IAClC,QAAQ,WAAW,CAAC;IACpB,QAAQ,OAAO,UAAU,CAAC;IAC1B,kBAAkB,QAAQ,OAAO,KAAK;IACtC,QAAQ,YAAY,CAAC;IACrB,QAAQ,QAAQ,KAAK,IAAI,uBAAuB,MAAM,CAAC;IACvD,OAAO;GACT,CAAC;EACH;CACF;AACF;;;;AAKA,IAAM,yBAAN,cAAqC,gBAAgB;;;;;;;;;CASnD,eAAkC,OAAwB;EACxD,MAAM,CAAC,YAAY,GAAG,eAAe,eAAe,KAAK,MAAM;EAG/D,OAAO,WAAW;EAClB,MAAM,SAAS;GACb,GAAG;GACH,eAAe,EACb,KAAK,CAAC,mBAAmB,EAC3B;EACF;EAGA,MAAM,KACJ,QACA,GAAG,YAAY,KAAK,SAClB,KAAK,KAAK,KAAK,uBAAuB,IAClC;GACE,GAAG;GACH,MAAM;EACR,IACA,IACN,CACF;CACF;AACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/rsbuild/index.ts"],"sourcesContent":["import { fileURLToPath } from \"node:url\";\n\nimport type { RsbuildPlugin } from \"@rsbuild/core\";\nimport type { RspackOptions } from \"@rspack/core\";\nimport type { InlineConfig } from \"@stillwind/config\";\n\nimport { StillwindPlugin } from \"../webpack/plugin.ts\";\nimport { stillwindRules } from \"../webpack/rules.ts\";\n\nexport type { InlineConfig as IntegrationConfig } from \"@stillwind/config\";\n\n/**\n * Rsbuild plugin that uses only the hook for updating the Rspack configuration.\n */\nexport interface StillwindRsbuildPlugin extends RsbuildPlugin {\n /**\n * Registers Stillwind's configuration changes through the host's Rspack hook.\n *\n * @param api - Host API that accepts a modifier for the mutable Rspack configuration.\n */\n setup(api: {\n /**\n * Registers a modifier for each generated Rspack configuration.\n *\n * @param callback - Receives mutable host options and returns the configuration to use.\n */\n modifyRspackConfig(callback: (options: RspackOptions) => RspackOptions): void;\n }): void;\n}\n\n/**\n * Adapts existing CSS rules for Stillwind document carriers and source-map composition.\n *\n * The function excludes document carriers from matching CSS rules and inserts the Stillwind map\n * bridge before each Lightning CSS loader entry.\n *\n * @param rules - Mutable Rsbuild rule list, including any nested `oneOf` and `rules` lists.\n */\nfunction configureCssRules(rules: NonNullable<NonNullable<RspackOptions[\"module\"]>[\"rules\"]>) {\n for (const rule of rules) {\n if (!rule || typeof rule !== \"object\") {\n continue;\n }\n if (rule.test instanceof RegExp && rule.test.test(\"stillwind-webpack.css\")) {\n rule.exclude = [rule.exclude, /stillwind-webpack\\.css$/].filter(\n (condition): condition is NonNullable<typeof condition> => Boolean(condition),\n );\n }\n if (Array.isArray(rule.use)) {\n rule.use = rule.use.flatMap((use) => {\n const name =\n typeof use === \"string\"\n ? use\n : typeof use === \"object\" && use !== null\n ? use.loader\n : undefined;\n return name === \"builtin:lightningcss-loader\"\n ? [\n {\n loader: fileURLToPath(\n new URL(\n \"./css-map-loader.js\",\n import.meta.resolve(\"@stillwind/integration/webpack\"),\n ),\n ),\n },\n use,\n ]\n : [use];\n });\n }\n configureCssRules(rule.oneOf ?? []);\n configureCssRules(rule.rules ?? []);\n }\n}\n\n/**\n * Creates an Rsbuild plugin that installs Stillwind compilation and CSS rules.\n *\n * @param config - Configuration discovery and inline overrides shared by the generated rules.\n * @returns A plugin whose setup hook adjusts Rspack rules and registers a `StillwindPlugin`\n * instance.\n */\nexport function pluginStillwind(config: InlineConfig = {}): StillwindRsbuildPlugin {\n return {\n name: \"stillwind\",\n /**\n * Registers CSS rule adaptation and the compiler plugin on Rsbuild's Rspack configuration hook.\n * @param api - Host API that applies the registered modifier before compilation.\n */\n setup(api) {\n api.modifyRspackConfig((options) => {\n options.module ??= {};\n options.module.rules ??= [];\n configureCssRules(options.module.rules);\n options.plugins ??= [];\n options.plugins.push(new RsbuildStillwindPlugin(config));\n return options;\n });\n },\n };\n}\n\n/**\n * A Stillwind plugin that places producer compilation within the Rsbuild framework loader chain.\n */\nclass RsbuildStillwindPlugin extends StillwindPlugin {\n /**\n * Appends Stillwind rules after framework pre-loaders and before normal JSX lowering.\n *\n * Vue query blocks are excluded from the script rule. Document carriers use native CSS modules so\n * rebuilding them does not rerun the extraction loader.\n *\n * @param rules - Mutable Rspack rule list already configured by Rsbuild.\n */\n protected override configureRules(rules: unknown[]): void {\n const [javascript, ...stylesheets] = stillwindRules(this.config);\n // Framework pre-loaders must split routes/server functions before CSS\n // ownership is determined. Appending a normal loader still runs before SWC.\n delete javascript.enforce;\n const script = {\n ...javascript,\n resourceQuery: {\n not: [/[?&]vue(?:[=&]|$)/],\n },\n };\n // Document carriers are rebuilt after graph linking. Native CSS modules avoid\n // running Rsbuild's extraction loader again during that rebuild.\n rules.push(\n script,\n ...stylesheets.map((rule) =>\n rule.test.test(\"stillwind-webpack.css\")\n ? {\n ...rule,\n type: \"css\",\n }\n : rule,\n ),\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;AAsCA,SAAS,kBAAkB,OAAmE;CAC5F,KAAK,MAAM,QAAQ,OAAO;EACxB,IAAI,CAAC,QAAQ,OAAO,SAAS,UAC3B;EAEF,IAAI,KAAK,gBAAgB,UAAU,KAAK,KAAK,KAAK,uBAAuB,GACvE,KAAK,UAAU,CAAC,KAAK,SAAS,yBAAyB,CAAC,CAAC,QACtD,cAA0D,QAAQ,SAAS,CAC9E;EAEF,IAAI,MAAM,QAAQ,KAAK,GAAG,GACxB,KAAK,MAAM,KAAK,IAAI,SAAS,QAAQ;GAOnC,QALE,OAAO,QAAQ,WACX,MACA,OAAO,QAAQ,YAAY,QAAQ,OACjC,IAAI,SACJ,KAAA,OACQ,gCACZ,CACE,EACE,QAAQ,cACN,IAAI,IACF,uBACA,YAAY,QAAQ,gCAAgC,CACtD,CACF,EACF,GACA,GACF,IACA,CAAC,GAAG;EACV,CAAC;EAEH,kBAAkB,KAAK,SAAS,CAAC,CAAC;EAClC,kBAAkB,KAAK,SAAS,CAAC,CAAC;CACpC;AACF;;;;;;;;AASA,SAAgB,gBAAgB,SAAuB,CAAC,GAA2B;CACjF,OAAO;EACL,MAAM;;;;;EAKN,MAAM,KAAK;GACT,IAAI,oBAAoB,YAAY;IAClC,QAAQ,WAAW,CAAC;IACpB,QAAQ,OAAO,UAAU,CAAC;IAC1B,kBAAkB,QAAQ,OAAO,KAAK;IACtC,QAAQ,YAAY,CAAC;IACrB,QAAQ,QAAQ,KAAK,IAAI,uBAAuB,MAAM,CAAC;IACvD,OAAO;GACT,CAAC;EACH;CACF;AACF;;;;AAKA,IAAM,yBAAN,cAAqC,gBAAgB;;;;;;;;;CASnD,eAAkC,OAAwB;EACxD,MAAM,CAAC,YAAY,GAAG,eAAe,eAAe,KAAK,MAAM;EAG/D,OAAO,WAAW;EAClB,MAAM,SAAS;GACb,GAAG;GACH,eAAe,EACb,KAAK,CAAC,mBAAmB,EAC3B;EACF;EAGA,MAAM,KACJ,QACA,GAAG,YAAY,KAAK,SAClB,KAAK,KAAK,KAAK,uBAAuB,IAClC;GACE,GAAG;GACH,MAAM;EACR,IACA,IACN,CACF;CACF;AACF"}
@@ -1,3 +1,3 @@
1
- import { t as StillwindPlugin } from "../plugin-aV0zIIAe.js";
1
+ import { t as StillwindPlugin } from "../plugin-BAG0ZI1X.js";
2
2
  import { InlineConfig as IntegrationConfig } from "@stillwind/config";
3
3
  export { type IntegrationConfig, StillwindPlugin };
@@ -1 +1 @@
1
- export { t as StillwindPlugin } from "../plugin-mPiBLdqa.js";
1
+ export { t as StillwindPlugin } from "../plugin-D-45o54j.js";
@@ -0,0 +1,163 @@
1
+ import { CompilationProject, CompilerHost, ModuleCompileOptions, PluginRuntime, TypeFactsEnvironment, TypeScriptFactsService } from "@stillwind/host";
2
+ import { NativeDesignSystemLoader, NativeProjectSession } from "@stillwind/native";
3
+ import { BuildConfig } from "@stillwind/config";
4
+ /**
5
+ * Prepared sources, scans, facts, and one checker that several adapter environments of one project
6
+ * share. Each environment resolves imports in its own resolver domain, and the shared project
7
+ * checks that the domains agree. Close it when the adapter releases the project.
8
+ */
9
+ declare class SharedTypeFacts {
10
+ #private;
11
+ readonly environment: TypeFactsEnvironment;
12
+ /** Sources, checker inputs, and facts for every environment that agrees on import resolution. */
13
+ readonly project: CompilationProject;
14
+ /**
15
+ * @param environment - TypeScript settings that every sharing environment uses.
16
+ */
17
+ constructor(environment: TypeFactsEnvironment);
18
+ /** Returns the shared checker, starting it on first use. */
19
+ facts(): TypeScriptFactsService;
20
+ /**
21
+ * Discards shared sources read from a file and every collected fact.
22
+ *
23
+ * @param file - Absolute path of a file that changed, was added, or was removed.
24
+ * @param entry - Whether the file was added or removed rather than changed.
25
+ */
26
+ sourceChanged(file: string, entry: boolean): void;
27
+ /** Closes the checker and discards shared sources. A later compilation starts a new checker. */
28
+ close(): void;
29
+ }
30
+ /**
31
+ * Owns a compiler session and a reusable checker for one adapter environment. TypeScript settings
32
+ * are selected at construction. Close the checker when the adapter releases or reloads the project.
33
+ */
34
+ declare class IntegrationSession {
35
+ #private;
36
+ /** Native compiler state retained across module updates. Closing this wrapper only releases its checker. */
37
+ readonly native: NativeProjectSession;
38
+ /** Absolute project directory captured when TypeScript settings were selected. */
39
+ readonly root: string;
40
+ /**
41
+ * Creates compiler state without starting the TypeScript checker.
42
+ *
43
+ * @param root - Absolute adapter project root used for module identities and TypeScript settings.
44
+ * @param loader - Completed design-system loader retained by the native session.
45
+ * @param config - Compiler settings, including the root-relative or absolute tsconfig selection.
46
+ * @param watch - Whether failed native updates retain the last successful output.
47
+ * @param mode - Native compilation mode selected by the adapter.
48
+ * @param plugins - Plugin runtime of the loader's CSS graph, which resolves dynamic utilities.
49
+ * @param fixedEntries - Present when no source file changes before the session closes. The
50
+ * session then scans each file once and gives the checker one project for every compilation.
51
+ * A compilation that finds the project empty prepares the files that these absolute paths reach,
52
+ * together with its own entry, so later compilations seldom add files to the checker project.
53
+ * @param watchedEntries - Present when the caller reports every source file change through
54
+ * {@link sourceChanged}. Compilations then share sources, scans, checker inputs, and facts
55
+ * until a change. Like `fixedEntries`, a compilation that finds the project empty prepares the
56
+ * files that these absolute paths reach. Ignored when `fixedEntries` is present.
57
+ * @param shared - State to share with the other environments of the project, used only with
58
+ * `fixedEntries` or `watchedEntries`. Its TypeScript settings must equal the settings that `root`
59
+ * and `config` select. The caller owns and closes it.
60
+ * @param domain - Name of this environment's resolver, which must differ between environments
61
+ * that use `shared`.
62
+ * @throws If the selected TypeScript configuration does not exist or native session creation fails.
63
+ */
64
+ constructor(root: string, loader: NativeDesignSystemLoader, config: BuildConfig, watch: boolean, mode: string, plugins?: PluginRuntime, fixedEntries?: readonly string[], watchedEntries?: readonly string[], shared?: SharedTypeFacts, domain?: string);
65
+ /**
66
+ * Compiles a module and records its resolver identities after compilation succeeds.
67
+ *
68
+ * @param code - Entry text before Stillwind transformation.
69
+ * @param id - Full adapter resolver identity, including any query suffix.
70
+ * @param host - Module descriptors, resolution, reads, and dependency tracking operations.
71
+ * @param transport - Diagnostics, checker inputs, and generated imports for this compilation.
72
+ * @returns The entry output, or undefined when compilation produces no entry code.
73
+ * @throws If module identities conflict or host, checker, or compiler operations fail.
74
+ */
75
+ compile(code: string, id: string, host: CompilerHost, transport?: ModuleCompileOptions): Promise<{
76
+ hasModuleCssImport: boolean;
77
+ compositionModules: string[];
78
+ compositionTopology: string;
79
+ diagnostics: import("@stillwind/native").BindingDiagnostic[];
80
+ reports: import("@stillwind/native").BindingReport[];
81
+ composition: Array<import("@stillwind/native").NativeStyleDependency>;
82
+ moduleId: string;
83
+ resources: Array<import("@stillwind/native").NativeModuleResource>;
84
+ css: string;
85
+ code: string | null;
86
+ mappings: Array<import("@stillwind/native").NativeTransformMapping>;
87
+ classes: Array<import("@stillwind/native").NativeGeneratedClass>;
88
+ symbols: Array<import("@stillwind/native").NativeGeneratedSymbol>;
89
+ rejectedNames: Array<import("@stillwind/native").BindingRejectedIdentifier>;
90
+ dynamicCandidates: Array<string>;
91
+ lintFindings: Array<import("@stillwind/native").BindingLintFinding>;
92
+ lintSettings: Record<string, "warn" | "deny" | "off">;
93
+ } | undefined>;
94
+ /**
95
+ * Starts the checker process that later compilations query, unless it is running. Compilations
96
+ * start it on demand, so a caller uses this only to start it before the first compilation.
97
+ *
98
+ * @throws If the checker process cannot start.
99
+ */
100
+ startChecker(): void;
101
+ /**
102
+ * Returns the host identity recorded after a compilation returned successfully.
103
+ *
104
+ * @param moduleId - Compiler identity previously observed during this session's compilation.
105
+ * @returns Full resolver identity, including any query suffix.
106
+ * @throws If this session has not recorded the module identity.
107
+ */
108
+ resolverId(moduleId: string): string;
109
+ /**
110
+ * Discards shared sources read from a file and every collected fact.
111
+ *
112
+ * @param file - Absolute path of a file that changed, was added, or was removed.
113
+ * @param entry - Whether the file was added or removed rather than changed.
114
+ */
115
+ sourceChanged(file: string, entry: boolean): void;
116
+ /**
117
+ * Tests whether the prepared sources hold the text of a file.
118
+ *
119
+ * @param file - Absolute file path.
120
+ * @returns True when a source read from the file without a query is prepared.
121
+ */
122
+ holdsSource(file: string): boolean;
123
+ /**
124
+ * Discards the shared sources read from a file when they hold text other than the file's current
125
+ * text, as {@link sourceChanged} does for a changed file. A caller that cannot learn about changes
126
+ * before a compilation reads a file reports the text that it read.
127
+ *
128
+ * @param file - Absolute file path.
129
+ * @param text - Text that the caller read from the file.
130
+ */
131
+ sourceRead(file: string, text: string): void;
132
+ /**
133
+ * Compares every shared source read from a file with the file's current text, and discards the
134
+ * sources whose file changed or no longer exists, as {@link sourceChanged} does. A caller that
135
+ * missed change reports uses it before the next compilation. Files added since the sources were
136
+ * read are not found, and a file that only query-qualified sources read is not compared.
137
+ *
138
+ * @param read - Reads a file, or returns undefined when it does not exist.
139
+ * @returns Completion of the comparison.
140
+ */
141
+ verifySources(read: (file: string) => Promise<string | undefined>): Promise<void>;
142
+ /**
143
+ * Tests whether a changed file exposes the same exports to other modules as before the change.
144
+ * When it does, compilations of the modules that import it give the same output as before,
145
+ * except for their checker diagnostics.
146
+ *
147
+ * @param file - Absolute path that {@link sourceChanged} received with `entry` false. A
148
+ * compilation must have prepared the file again since then.
149
+ * @returns False when the file was not compiled before and after the change, no other module
150
+ * imports it, or its exports cannot be compared.
151
+ * @throws If checker input installation fails.
152
+ */
153
+ keepsInterface(file: string): boolean;
154
+ /**
155
+ * Closes the current checker while retaining native compiler state and selected TypeScript settings.
156
+ * Later compilation can start a new checker. Repeated calls have no effect until that happens.
157
+ *
158
+ * @throws If checker cleanup fails.
159
+ */
160
+ close(): void;
161
+ }
162
+ export { IntegrationSession as t };
163
+ //# sourceMappingURL=session-Cxf4D6oQ.d.ts.map
@@ -0,0 +1,350 @@
1
+ import { CompilationProject, ResolutionMismatchError, TypeScriptFactsService, attachPlugins, cleanModuleId, compileModule, compilerOptions, resolveTypeFactsEnvironment } from "@stillwind/host";
2
+ import { NativeProjectSession } from "@stillwind/native";
3
+ import { listProjectFiles } from "@stillwind/config/node";
4
+ // src/session.ts
5
+ /**
6
+ * Selects native settings for build and development sessions with lint disabled.
7
+ *
8
+ * @param config - Shared project settings. Analysis hosts retain its lint configuration.
9
+ * @returns Compiler settings for generating JavaScript and CSS.
10
+ */
11
+ function buildCompilerOptions(config) {
12
+ return compilerOptions({
13
+ ...config,
14
+ lint: false
15
+ });
16
+ }
17
+ /**
18
+ * Reports each statement that loading skipped through a bundler warning channel. Build and
19
+ * development sessions run without stylesheet lint, so these warnings report the skipped statements.
20
+ *
21
+ * @param skipped - Skipped statements of a loaded graph.
22
+ * @param warn - Receives the lint rule, reason, and one-based authored location of each statement.
23
+ */
24
+ function warnSkippedCss(skipped, warn) {
25
+ for (const statement of skipped) warn(`stillwind: ${statement.rule}: ${statement.message} (${statement.sourceName}:${statement.line + 1}:${statement.column + 1})`);
26
+ }
27
+ /**
28
+ * Prepared sources, scans, facts, and one checker that several adapter environments of one project
29
+ * share. Each environment resolves imports in its own resolver domain, and the shared project
30
+ * checks that the domains agree. Close it when the adapter releases the project.
31
+ */
32
+ var SharedTypeFacts = class {
33
+ environment;
34
+ /** Sources, checker inputs, and facts for every environment that agrees on import resolution. */
35
+ project = new CompilationProject(true);
36
+ /** Lazily started checker. */
37
+ #facts;
38
+ /**
39
+ * @param environment - TypeScript settings that every sharing environment uses.
40
+ */
41
+ constructor(environment) {
42
+ this.environment = environment;
43
+ }
44
+ /** Returns the shared checker, starting it on first use. */
45
+ facts() {
46
+ this.#facts ??= new TypeScriptFactsService(this.environment);
47
+ return this.#facts;
48
+ }
49
+ /**
50
+ * Discards shared sources read from a file and every collected fact.
51
+ *
52
+ * @param file - Absolute path of a file that changed, was added, or was removed.
53
+ * @param entry - Whether the file was added or removed rather than changed.
54
+ */
55
+ sourceChanged(file, entry) {
56
+ this.project.invalidateFile(file, entry);
57
+ }
58
+ /** Closes the checker and discards shared sources. A later compilation starts a new checker. */
59
+ close() {
60
+ this.project.invalidate();
61
+ this.#facts?.close();
62
+ this.#facts = void 0;
63
+ }
64
+ };
65
+ /**
66
+ * Owns a compiler session and a reusable checker for one adapter environment. TypeScript settings
67
+ * are selected at construction. Close the checker when the adapter releases or reloads the project.
68
+ */
69
+ var IntegrationSession = class {
70
+ /** Native compiler state retained across module updates. Closing this wrapper only releases its checker. */
71
+ native;
72
+ /** Absolute project directory captured when TypeScript settings were selected. */
73
+ root;
74
+ /** Fixed TypeScript settings selected before any lazy checker startup. */
75
+ #typeFactsEnvironment;
76
+ /** Compiler-to-resolver correspondences recorded only after compilation returns successfully. */
77
+ #resolverIdsByModuleId = /* @__PURE__ */ new Map();
78
+ /** Reverse correspondences used to reject a host identity that changes compiler identity. */
79
+ #moduleIdsByResolverId = /* @__PURE__ */ new Map();
80
+ /** Lazily started Node checker, released and recreated independently of native compiler state. */
81
+ #facts;
82
+ /**
83
+ * Sources, scans, checker inputs, and facts shared by compilations while source files stay
84
+ * unchanged. Absent when files can change without {@link sourceChanged} being called.
85
+ */
86
+ #project;
87
+ /**
88
+ * State shared with other environments, used until an import resolves differently here. The
89
+ * shared checker then serves only the other environments.
90
+ */
91
+ #shared;
92
+ /** Resolver domain of this environment in the shared project. */
93
+ #domain;
94
+ /** Entries that a compilation prepares together with its own entry when the project is empty. */
95
+ #entries;
96
+ /** Loading of the entries, which every compilation awaits before it queries the checker. */
97
+ #preparation;
98
+ /** Whether {@link #preparation} has not settled. */
99
+ #preparing = false;
100
+ /**
101
+ * Creates compiler state without starting the TypeScript checker.
102
+ *
103
+ * @param root - Absolute adapter project root used for module identities and TypeScript settings.
104
+ * @param loader - Completed design-system loader retained by the native session.
105
+ * @param config - Compiler settings, including the root-relative or absolute tsconfig selection.
106
+ * @param watch - Whether failed native updates retain the last successful output.
107
+ * @param mode - Native compilation mode selected by the adapter.
108
+ * @param plugins - Plugin runtime of the loader's CSS graph, which resolves dynamic utilities.
109
+ * @param fixedEntries - Present when no source file changes before the session closes. The
110
+ * session then scans each file once and gives the checker one project for every compilation.
111
+ * A compilation that finds the project empty prepares the files that these absolute paths reach,
112
+ * together with its own entry, so later compilations seldom add files to the checker project.
113
+ * @param watchedEntries - Present when the caller reports every source file change through
114
+ * {@link sourceChanged}. Compilations then share sources, scans, checker inputs, and facts
115
+ * until a change. Like `fixedEntries`, a compilation that finds the project empty prepares the
116
+ * files that these absolute paths reach. Ignored when `fixedEntries` is present.
117
+ * @param shared - State to share with the other environments of the project, used only with
118
+ * `fixedEntries` or `watchedEntries`. Its TypeScript settings must equal the settings that `root`
119
+ * and `config` select. The caller owns and closes it.
120
+ * @param domain - Name of this environment's resolver, which must differ between environments
121
+ * that use `shared`.
122
+ * @throws If the selected TypeScript configuration does not exist or native session creation fails.
123
+ */
124
+ constructor(root, loader, config, watch, mode, plugins, fixedEntries, watchedEntries, shared, domain) {
125
+ this.root = root;
126
+ const fixed = Boolean(fixedEntries || watchedEntries);
127
+ this.#shared = fixed ? shared : void 0;
128
+ this.#domain = domain;
129
+ this.#project = this.#shared?.project ?? (fixed ? new CompilationProject(true) : void 0);
130
+ this.#entries = fixedEntries ?? watchedEntries ?? [];
131
+ this.#typeFactsEnvironment = resolveTypeFactsEnvironment(root, config.tsconfig);
132
+ this.native = new NativeProjectSession(loader, watch, mode, config.naming, false);
133
+ attachPlugins(this.native, plugins);
134
+ }
135
+ /**
136
+ * Compiles a module and records its resolver identities after compilation succeeds.
137
+ *
138
+ * @param code - Entry text before Stillwind transformation.
139
+ * @param id - Full adapter resolver identity, including any query suffix.
140
+ * @param host - Module descriptors, resolution, reads, and dependency tracking operations.
141
+ * @param transport - Diagnostics, checker inputs, and generated imports for this compilation.
142
+ * @returns The entry output, or undefined when compilation produces no entry code.
143
+ * @throws If module identities conflict or host, checker, or compiler operations fail.
144
+ */
145
+ async compile(code, id, host, transport = {}) {
146
+ try {
147
+ return await this.#compile(code, id, {
148
+ ...host,
149
+ resolverDomain: this.#domain
150
+ }, transport);
151
+ } catch (error) {
152
+ if (!(error instanceof ResolutionMismatchError) || !this.#shared) throw error;
153
+ this.#shared = void 0;
154
+ this.#project = new CompilationProject(true);
155
+ this.#preparation = void 0;
156
+ this.#preparing = false;
157
+ return this.#compile(code, id, host, transport);
158
+ }
159
+ }
160
+ /**
161
+ * Compiles a module with the current project and checker and records its resolver identities.
162
+ *
163
+ * @param code - Entry text before Stillwind transformation.
164
+ * @param id - Full adapter resolver identity, including any query suffix.
165
+ * @param host - Host whose resolver domain matches the current project.
166
+ * @param transport - Diagnostics, checker inputs, and generated imports for this compilation.
167
+ * @returns The entry output, or undefined when compilation produces no entry code.
168
+ * @throws If module identities conflict, the shared project receives a different import answer,
169
+ * or host, checker, or compiler operations fail.
170
+ */
171
+ async #compile(code, id, host, transport) {
172
+ const entries = this.#entries;
173
+ const project = this.#project;
174
+ const waiting = this.#preparation;
175
+ if (project && entries.length > 0 && !this.#preparing && project.sourceKeys().length === 0) {
176
+ this.#preparing = true;
177
+ this.#preparation = (async () => {
178
+ const resolved = await Promise.all(entries.map((entry) => host.resolve(entry, id, { skipSelf: true }).catch(() => null)));
179
+ await project.prepare(resolved.flatMap((entry) => entry && !entry.external ? [entry.id] : []), host, this.native);
180
+ })().finally(() => {
181
+ this.#preparing = false;
182
+ });
183
+ await this.#preparation;
184
+ } else await waiting?.catch(() => {});
185
+ await project?.prepare([id], host, this.native);
186
+ const pending = /* @__PURE__ */ new Map();
187
+ const pendingByResolverId = /* @__PURE__ */ new Map();
188
+ const output = await compileModule(this.native, () => this.#checker(), code, id, {
189
+ ...host,
190
+ onModule: (moduleId, resolverId) => {
191
+ const previous = this.#resolverIdsByModuleId.get(moduleId);
192
+ if (previous !== void 0 && previous !== resolverId) throw new Error(`Module identity ${moduleId} changed resolver identity from ${previous} to ${resolverId}`);
193
+ const priorModuleId = pendingByResolverId.get(resolverId) ?? this.#moduleIdsByResolverId.get(resolverId);
194
+ if (priorModuleId !== void 0 && priorModuleId !== moduleId) throw new Error(`Resolver identity ${resolverId} changed module identity`);
195
+ pending.set(moduleId, resolverId);
196
+ pendingByResolverId.set(resolverId, moduleId);
197
+ }
198
+ }, transport, this.#project);
199
+ for (const [moduleId, resolverId] of pending) {
200
+ this.#resolverIdsByModuleId.set(moduleId, resolverId);
201
+ this.#moduleIdsByResolverId.set(resolverId, moduleId);
202
+ host.onModule?.(moduleId, resolverId);
203
+ }
204
+ return output;
205
+ }
206
+ /**
207
+ * Starts the checker process that later compilations query, unless it is running. Compilations
208
+ * start it on demand, so a caller uses this only to start it before the first compilation.
209
+ *
210
+ * @throws If the checker process cannot start.
211
+ */
212
+ startChecker() {
213
+ this.#checker();
214
+ }
215
+ /**
216
+ * Returns the host identity recorded after a compilation returned successfully.
217
+ *
218
+ * @param moduleId - Compiler identity previously observed during this session's compilation.
219
+ * @returns Full resolver identity, including any query suffix.
220
+ * @throws If this session has not recorded the module identity.
221
+ */
222
+ resolverId(moduleId) {
223
+ const id = this.#resolverIdsByModuleId.get(moduleId);
224
+ if (id === void 0) throw new Error(`Unknown Stillwind module identity: ${moduleId}`);
225
+ return id;
226
+ }
227
+ /** Returns the checker of the shared project or of this session, starting it on first use. */
228
+ #checker() {
229
+ if (this.#shared) return this.#shared.facts();
230
+ this.#facts ??= new TypeScriptFactsService(this.#typeFactsEnvironment);
231
+ return this.#facts;
232
+ }
233
+ /**
234
+ * Discards shared sources read from a file and every collected fact.
235
+ *
236
+ * @param file - Absolute path of a file that changed, was added, or was removed.
237
+ * @param entry - Whether the file was added or removed rather than changed.
238
+ */
239
+ sourceChanged(file, entry) {
240
+ if (this.#shared) {
241
+ this.#shared.sourceChanged(file, entry);
242
+ return;
243
+ }
244
+ this.#project?.invalidateFile(file, entry);
245
+ }
246
+ /**
247
+ * Tests whether the prepared sources hold the text of a file.
248
+ *
249
+ * @param file - Absolute file path.
250
+ * @returns True when a source read from the file without a query is prepared.
251
+ */
252
+ holdsSource(file) {
253
+ return Boolean((this.#shared?.project ?? this.#project)?.source(file));
254
+ }
255
+ /**
256
+ * Discards the shared sources read from a file when they hold text other than the file's current
257
+ * text, as {@link sourceChanged} does for a changed file. A caller that cannot learn about changes
258
+ * before a compilation reads a file reports the text that it read.
259
+ *
260
+ * @param file - Absolute file path.
261
+ * @param text - Text that the caller read from the file.
262
+ */
263
+ sourceRead(file, text) {
264
+ const captured = (this.#shared?.project ?? this.#project)?.source(file);
265
+ if (captured && captured.document.code !== text) this.sourceChanged(file, false);
266
+ }
267
+ /**
268
+ * Compares every shared source read from a file with the file's current text, and discards the
269
+ * sources whose file changed or no longer exists, as {@link sourceChanged} does. A caller that
270
+ * missed change reports uses it before the next compilation. Files added since the sources were
271
+ * read are not found, and a file that only query-qualified sources read is not compared.
272
+ *
273
+ * @param read - Reads a file, or returns undefined when it does not exist.
274
+ * @returns Completion of the comparison.
275
+ */
276
+ async verifySources(read) {
277
+ const project = this.#shared?.project ?? this.#project;
278
+ if (!project) return;
279
+ await Promise.all(project.sourceKeys().map(async (key) => {
280
+ const source = project.source(key);
281
+ if (!source || cleanModuleId(source.resolverId) !== source.resolverId) return;
282
+ const text = await read(source.resolverId).catch(() => void 0);
283
+ if (text === void 0) this.sourceChanged(source.resolverId, true);
284
+ else if (text !== source.document.code) this.sourceChanged(source.resolverId, false);
285
+ }));
286
+ }
287
+ /**
288
+ * Tests whether a changed file exposes the same exports to other modules as before the change.
289
+ * When it does, compilations of the modules that import it give the same output as before,
290
+ * except for their checker diagnostics.
291
+ *
292
+ * @param file - Absolute path that {@link sourceChanged} received with `entry` false. A
293
+ * compilation must have prepared the file again since then.
294
+ * @returns False when the file was not compiled before and after the change, no other module
295
+ * imports it, or its exports cannot be compared.
296
+ * @throws If checker input installation fails.
297
+ */
298
+ keepsInterface(file) {
299
+ const facts = this.#shared ? this.#shared.facts() : this.#facts;
300
+ return Boolean(facts && this.#project?.keepsInterface(file, facts));
301
+ }
302
+ /**
303
+ * Closes the current checker while retaining native compiler state and selected TypeScript settings.
304
+ * Later compilation can start a new checker. Repeated calls have no effect until that happens.
305
+ *
306
+ * @throws If checker cleanup fails.
307
+ */
308
+ close() {
309
+ if (!this.#shared) this.#project?.invalidate();
310
+ this.#preparation = void 0;
311
+ this.#preparing = false;
312
+ this.#facts?.close();
313
+ this.#facts = void 0;
314
+ }
315
+ };
316
+ // src/source-entries.ts
317
+ /**
318
+ * Selects the source files that a build loads into the checker before its first compilation.
319
+ *
320
+ * The main entry points are {@link isSourceEntry} and {@link buildSourceEntries}.
321
+ */
322
+ /**
323
+ * Tests whether a file can be a compilation entry.
324
+ *
325
+ * @param id - Path without a query.
326
+ * @returns True for script and component files. Declaration files are not entries.
327
+ */
328
+ function isSourceEntry(id) {
329
+ return /\.(?:[cm]?[jt]sx?|astro|svelte|vue)$/.test(id) && !/\.d\.[cm]?ts$/.test(id);
330
+ }
331
+ /**
332
+ * Lists the build entries together with the source files of the selected project.
333
+ *
334
+ * A build can reach source files only through dynamic imports, which preparation does not follow.
335
+ * Each source that a later compilation adds then rebuilds the checker project, so a build loads
336
+ * these files with its first compilation.
337
+ *
338
+ * @param entries - Absolute entry paths of the build.
339
+ * @param scope - Target globs of the selected project, or undefined when no configuration file
340
+ * selects a project.
341
+ * @returns The entries followed by the script and component files that the scope selects, without
342
+ * duplicates.
343
+ * @throws If filesystem enumeration fails.
344
+ */
345
+ async function buildSourceEntries(entries, scope) {
346
+ return [.../* @__PURE__ */ new Set([...entries, ...(scope ? await listProjectFiles(scope) : []).filter(isSourceEntry)])];
347
+ }
348
+ export { buildCompilerOptions as a, SharedTypeFacts as i, isSourceEntry as n, warnSkippedCss as o, IntegrationSession as r, buildSourceEntries as t };
349
+
350
+ //# sourceMappingURL=source-entries-J5azZ_-z.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-entries-J5azZ_-z.js","names":[],"sources":["../src/session.ts","../src/source-entries.ts"],"sourcesContent":["import type { BuildConfig } from \"@stillwind/config\";\nimport {\n attachPlugins,\n cleanModuleId,\n CompilationProject,\n compileModule,\n compilerOptions,\n ResolutionMismatchError,\n resolveTypeFactsEnvironment,\n TypeScriptFactsService,\n type CompilerHost,\n type ModuleCompileOptions,\n type PluginRuntime,\n type TypeFactsEnvironment,\n} from \"@stillwind/host\";\nimport {\n NativeProjectSession,\n type NativeCompilerOptions,\n type NativeDesignSystemLoader,\n type NativeSkippedCss,\n} from \"@stillwind/native\";\n\n/**\n * Selects native settings for build and development sessions with lint disabled.\n *\n * @param config - Shared project settings. Analysis hosts retain its lint configuration.\n * @returns Compiler settings for generating JavaScript and CSS.\n */\nexport function buildCompilerOptions(config: BuildConfig): NativeCompilerOptions {\n return compilerOptions({\n ...config,\n lint: false,\n });\n}\n\n/**\n * Reports each statement that loading skipped through a bundler warning channel. Build and\n * development sessions run without stylesheet lint, so these warnings report the skipped statements.\n *\n * @param skipped - Skipped statements of a loaded graph.\n * @param warn - Receives the lint rule, reason, and one-based authored location of each statement.\n */\nexport function warnSkippedCss(\n skipped: readonly NativeSkippedCss[],\n warn: (message: string) => void,\n): void {\n for (const statement of skipped) {\n warn(\n `stillwind: ${statement.rule}: ${statement.message} (${statement.sourceName}:${statement.line + 1}:${statement.column + 1})`,\n );\n }\n}\n\n/**\n * Prepared sources, scans, facts, and one checker that several adapter environments of one project\n * share. Each environment resolves imports in its own resolver domain, and the shared project\n * checks that the domains agree. Close it when the adapter releases the project.\n */\nexport class SharedTypeFacts {\n /** Sources, checker inputs, and facts for every environment that agrees on import resolution. */\n readonly project = new CompilationProject(true);\n /** Lazily started checker. */\n #facts?: TypeScriptFactsService;\n\n /**\n * @param environment - TypeScript settings that every sharing environment uses.\n */\n constructor(readonly environment: TypeFactsEnvironment) {}\n\n /** Returns the shared checker, starting it on first use. */\n facts(): TypeScriptFactsService {\n this.#facts ??= new TypeScriptFactsService(this.environment);\n return this.#facts;\n }\n\n /**\n * Discards shared sources read from a file and every collected fact.\n *\n * @param file - Absolute path of a file that changed, was added, or was removed.\n * @param entry - Whether the file was added or removed rather than changed.\n */\n sourceChanged(file: string, entry: boolean): void {\n this.project.invalidateFile(file, entry);\n }\n\n /** Closes the checker and discards shared sources. A later compilation starts a new checker. */\n close(): void {\n this.project.invalidate();\n this.#facts?.close();\n this.#facts = undefined;\n }\n}\n\n/**\n * Owns a compiler session and a reusable checker for one adapter environment. TypeScript settings\n * are selected at construction. Close the checker when the adapter releases or reloads the project.\n */\nexport class IntegrationSession {\n /** Native compiler state retained across module updates. Closing this wrapper only releases its checker. */\n readonly native: NativeProjectSession;\n /** Absolute project directory captured when TypeScript settings were selected. */\n readonly root: string;\n\n /** Fixed TypeScript settings selected before any lazy checker startup. */\n readonly #typeFactsEnvironment: TypeFactsEnvironment;\n /** Compiler-to-resolver correspondences recorded only after compilation returns successfully. */\n readonly #resolverIdsByModuleId = new Map<string, string>();\n /** Reverse correspondences used to reject a host identity that changes compiler identity. */\n readonly #moduleIdsByResolverId = new Map<string, string>();\n /** Lazily started Node checker, released and recreated independently of native compiler state. */\n #facts?: TypeScriptFactsService;\n /**\n * Sources, scans, checker inputs, and facts shared by compilations while source files stay\n * unchanged. Absent when files can change without {@link sourceChanged} being called.\n */\n #project?: CompilationProject;\n /**\n * State shared with other environments, used until an import resolves differently here. The\n * shared checker then serves only the other environments.\n */\n #shared?: SharedTypeFacts;\n /** Resolver domain of this environment in the shared project. */\n readonly #domain?: string;\n /** Entries that a compilation prepares together with its own entry when the project is empty. */\n readonly #entries: readonly string[];\n /** Loading of the entries, which every compilation awaits before it queries the checker. */\n #preparation?: Promise<void>;\n /** Whether {@link #preparation} has not settled. */\n #preparing = false;\n\n /**\n * Creates compiler state without starting the TypeScript checker.\n *\n * @param root - Absolute adapter project root used for module identities and TypeScript settings.\n * @param loader - Completed design-system loader retained by the native session.\n * @param config - Compiler settings, including the root-relative or absolute tsconfig selection.\n * @param watch - Whether failed native updates retain the last successful output.\n * @param mode - Native compilation mode selected by the adapter.\n * @param plugins - Plugin runtime of the loader's CSS graph, which resolves dynamic utilities.\n * @param fixedEntries - Present when no source file changes before the session closes. The\n * session then scans each file once and gives the checker one project for every compilation.\n * A compilation that finds the project empty prepares the files that these absolute paths reach,\n * together with its own entry, so later compilations seldom add files to the checker project.\n * @param watchedEntries - Present when the caller reports every source file change through\n * {@link sourceChanged}. Compilations then share sources, scans, checker inputs, and facts\n * until a change. Like `fixedEntries`, a compilation that finds the project empty prepares the\n * files that these absolute paths reach. Ignored when `fixedEntries` is present.\n * @param shared - State to share with the other environments of the project, used only with\n * `fixedEntries` or `watchedEntries`. Its TypeScript settings must equal the settings that `root`\n * and `config` select. The caller owns and closes it.\n * @param domain - Name of this environment's resolver, which must differ between environments\n * that use `shared`.\n * @throws If the selected TypeScript configuration does not exist or native session creation fails.\n */\n constructor(\n root: string,\n loader: NativeDesignSystemLoader,\n config: BuildConfig,\n watch: boolean,\n mode: string,\n plugins?: PluginRuntime,\n fixedEntries?: readonly string[],\n watchedEntries?: readonly string[],\n shared?: SharedTypeFacts,\n domain?: string,\n ) {\n this.root = root;\n const fixed = Boolean(fixedEntries || watchedEntries);\n this.#shared = fixed ? shared : undefined;\n this.#domain = domain;\n this.#project = this.#shared?.project ?? (fixed ? new CompilationProject(true) : undefined);\n this.#entries = fixedEntries ?? watchedEntries ?? [];\n this.#typeFactsEnvironment = resolveTypeFactsEnvironment(root, config.tsconfig);\n this.native = new NativeProjectSession(loader, watch, mode, config.naming, false);\n attachPlugins(this.native, plugins);\n }\n\n /**\n * Compiles a module and records its resolver identities after compilation succeeds.\n *\n * @param code - Entry text before Stillwind transformation.\n * @param id - Full adapter resolver identity, including any query suffix.\n * @param host - Module descriptors, resolution, reads, and dependency tracking operations.\n * @param transport - Diagnostics, checker inputs, and generated imports for this compilation.\n * @returns The entry output, or undefined when compilation produces no entry code.\n * @throws If module identities conflict or host, checker, or compiler operations fail.\n */\n async compile(\n code: string,\n id: string,\n host: CompilerHost,\n transport: ModuleCompileOptions = {},\n ) {\n try {\n return await this.#compile(code, id, { ...host, resolverDomain: this.#domain }, transport);\n } catch (error) {\n if (!(error instanceof ResolutionMismatchError) || !this.#shared) {\n throw error;\n }\n // Facts collected in the shared project followed another environment's imports. This\n // environment continues with its own project and checker.\n this.#shared = undefined;\n this.#project = new CompilationProject(true);\n this.#preparation = undefined;\n this.#preparing = false;\n return this.#compile(code, id, host, transport);\n }\n }\n\n /**\n * Compiles a module with the current project and checker and records its resolver identities.\n *\n * @param code - Entry text before Stillwind transformation.\n * @param id - Full adapter resolver identity, including any query suffix.\n * @param host - Host whose resolver domain matches the current project.\n * @param transport - Diagnostics, checker inputs, and generated imports for this compilation.\n * @returns The entry output, or undefined when compilation produces no entry code.\n * @throws If module identities conflict, the shared project receives a different import answer,\n * or host, checker, or compiler operations fail.\n */\n async #compile(code: string, id: string, host: CompilerHost, transport: ModuleCompileOptions) {\n // Loading every file that the entries reach lets later compilations share one checker\n // project. Adding files after a checker query would replace the checker snapshot, so\n // compilations that start while the entries load wait for them before they query the checker.\n // The project is empty before the first compilation and after a closed checker discarded its\n // sources, so the entries load again then.\n const entries = this.#entries;\n const project = this.#project;\n const waiting = this.#preparation;\n if (project && entries.length > 0 && !this.#preparing && project.sourceKeys().length === 0) {\n this.#preparing = true;\n this.#preparation = (async () => {\n // The host resolver gives each path the identity spelling that its compilations use. The\n // entries only speed up later compilations, so an entry that does not resolve is skipped.\n const resolved = await Promise.all(\n entries.map((entry) => host.resolve(entry, id, { skipSelf: true }).catch(() => null)),\n );\n await project.prepare(\n resolved.flatMap((entry) => (entry && !entry.external ? [entry.id] : [])),\n host,\n this.native,\n );\n })().finally(() => {\n this.#preparing = false;\n });\n // The compilation that loads the entries reports their failure.\n await this.#preparation;\n } else {\n await waiting?.catch(() => {});\n }\n await project?.prepare([id], host, this.native);\n const pending = new Map<string, string>();\n const pendingByResolverId = new Map<string, string>();\n const output = await compileModule(\n this.native,\n () => this.#checker(),\n code,\n id,\n {\n ...host,\n onModule: (moduleId, resolverId) => {\n const previous = this.#resolverIdsByModuleId.get(moduleId);\n if (previous !== undefined && previous !== resolverId) {\n throw new Error(\n `Module identity ${moduleId} changed resolver identity from ${previous} to ${resolverId}`,\n );\n }\n const priorModuleId =\n pendingByResolverId.get(resolverId) ?? this.#moduleIdsByResolverId.get(resolverId);\n if (priorModuleId !== undefined && priorModuleId !== moduleId) {\n throw new Error(`Resolver identity ${resolverId} changed module identity`);\n }\n pending.set(moduleId, resolverId);\n pendingByResolverId.set(resolverId, moduleId);\n },\n },\n transport,\n this.#project,\n );\n for (const [moduleId, resolverId] of pending) {\n this.#resolverIdsByModuleId.set(moduleId, resolverId);\n this.#moduleIdsByResolverId.set(resolverId, moduleId);\n host.onModule?.(moduleId, resolverId);\n }\n return output;\n }\n\n /**\n * Starts the checker process that later compilations query, unless it is running. Compilations\n * start it on demand, so a caller uses this only to start it before the first compilation.\n *\n * @throws If the checker process cannot start.\n */\n startChecker(): void {\n this.#checker();\n }\n\n /**\n * Returns the host identity recorded after a compilation returned successfully.\n *\n * @param moduleId - Compiler identity previously observed during this session's compilation.\n * @returns Full resolver identity, including any query suffix.\n * @throws If this session has not recorded the module identity.\n */\n resolverId(moduleId: string): string {\n const id = this.#resolverIdsByModuleId.get(moduleId);\n if (id === undefined) {\n throw new Error(`Unknown Stillwind module identity: ${moduleId}`);\n }\n return id;\n }\n\n /** Returns the checker of the shared project or of this session, starting it on first use. */\n #checker(): TypeScriptFactsService {\n if (this.#shared) {\n return this.#shared.facts();\n }\n this.#facts ??= new TypeScriptFactsService(this.#typeFactsEnvironment);\n return this.#facts;\n }\n\n /**\n * Discards shared sources read from a file and every collected fact.\n *\n * @param file - Absolute path of a file that changed, was added, or was removed.\n * @param entry - Whether the file was added or removed rather than changed.\n */\n sourceChanged(file: string, entry: boolean): void {\n if (this.#shared) {\n this.#shared.sourceChanged(file, entry);\n return;\n }\n this.#project?.invalidateFile(file, entry);\n }\n\n /**\n * Tests whether the prepared sources hold the text of a file.\n *\n * @param file - Absolute file path.\n * @returns True when a source read from the file without a query is prepared.\n */\n holdsSource(file: string): boolean {\n return Boolean((this.#shared?.project ?? this.#project)?.source(file));\n }\n\n /**\n * Discards the shared sources read from a file when they hold text other than the file's current\n * text, as {@link sourceChanged} does for a changed file. A caller that cannot learn about changes\n * before a compilation reads a file reports the text that it read.\n *\n * @param file - Absolute file path.\n * @param text - Text that the caller read from the file.\n */\n sourceRead(file: string, text: string): void {\n const captured = (this.#shared?.project ?? this.#project)?.source(file);\n if (captured && captured.document.code !== text) {\n this.sourceChanged(file, false);\n }\n }\n\n /**\n * Compares every shared source read from a file with the file's current text, and discards the\n * sources whose file changed or no longer exists, as {@link sourceChanged} does. A caller that\n * missed change reports uses it before the next compilation. Files added since the sources were\n * read are not found, and a file that only query-qualified sources read is not compared.\n *\n * @param read - Reads a file, or returns undefined when it does not exist.\n * @returns Completion of the comparison.\n */\n async verifySources(read: (file: string) => Promise<string | undefined>): Promise<void> {\n const project = this.#shared?.project ?? this.#project;\n if (!project) {\n return;\n }\n await Promise.all(\n project.sourceKeys().map(async (key) => {\n const source = project.source(key);\n // A query-qualified source holds a part of its file. Discarding the file's own source\n // also discards it.\n if (!source || cleanModuleId(source.resolverId) !== source.resolverId) {\n return;\n }\n const text = await read(source.resolverId).catch(() => undefined);\n if (text === undefined) {\n this.sourceChanged(source.resolverId, true);\n } else if (text !== source.document.code) {\n this.sourceChanged(source.resolverId, false);\n }\n }),\n );\n }\n\n /**\n * Tests whether a changed file exposes the same exports to other modules as before the change.\n * When it does, compilations of the modules that import it give the same output as before,\n * except for their checker diagnostics.\n *\n * @param file - Absolute path that {@link sourceChanged} received with `entry` false. A\n * compilation must have prepared the file again since then.\n * @returns False when the file was not compiled before and after the change, no other module\n * imports it, or its exports cannot be compared.\n * @throws If checker input installation fails.\n */\n keepsInterface(file: string): boolean {\n const facts = this.#shared ? this.#shared.facts() : this.#facts;\n return Boolean(facts && this.#project?.keepsInterface(file, facts));\n }\n\n /**\n * Closes the current checker while retaining native compiler state and selected TypeScript settings.\n * Later compilation can start a new checker. Repeated calls have no effect until that happens.\n *\n * @throws If checker cleanup fails.\n */\n close(): void {\n if (!this.#shared) {\n this.#project?.invalidate();\n }\n this.#preparation = undefined;\n this.#preparing = false;\n this.#facts?.close();\n this.#facts = undefined;\n }\n}\n","/**\n * Selects the source files that a build loads into the checker before its first compilation.\n *\n * The main entry points are {@link isSourceEntry} and {@link buildSourceEntries}.\n */\nimport { listProjectFiles } from \"@stillwind/config/node\";\nimport type { ProjectScope } from \"@stillwind/config/node\";\n\n/**\n * Tests whether a file can be a compilation entry.\n *\n * @param id - Path without a query.\n * @returns True for script and component files. Declaration files are not entries.\n */\nexport function isSourceEntry(id: string): boolean {\n return /\\.(?:[cm]?[jt]sx?|astro|svelte|vue)$/.test(id) && !/\\.d\\.[cm]?ts$/.test(id);\n}\n\n/**\n * Lists the build entries together with the source files of the selected project.\n *\n * A build can reach source files only through dynamic imports, which preparation does not follow.\n * Each source that a later compilation adds then rebuilds the checker project, so a build loads\n * these files with its first compilation.\n *\n * @param entries - Absolute entry paths of the build.\n * @param scope - Target globs of the selected project, or undefined when no configuration file\n * selects a project.\n * @returns The entries followed by the script and component files that the scope selects, without\n * duplicates.\n * @throws If filesystem enumeration fails.\n */\nexport async function buildSourceEntries(\n entries: readonly string[],\n scope: ProjectScope | undefined,\n): Promise<string[]> {\n return [\n ...new Set([...entries, ...(scope ? await listProjectFiles(scope) : []).filter(isSourceEntry)]),\n ];\n}\n"],"mappings":";;;;;;;;;;AA4BA,SAAgB,qBAAqB,QAA4C;CAC/E,OAAO,gBAAgB;EACrB,GAAG;EACH,MAAM;CACR,CAAC;AACH;;;;;;;;AASA,SAAgB,eACd,SACA,MACM;CACN,KAAK,MAAM,aAAa,SACtB,KACE,cAAc,UAAU,KAAK,IAAI,UAAU,QAAQ,IAAI,UAAU,WAAW,GAAG,UAAU,OAAO,EAAE,GAAG,UA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TurbopackProject, t as TurbopackLoaderOptions } from "../project-mB7CODIs.js";
2
2
  import { LoaderContext } from "webpack";
3
3
  /**
4
4
  * Starts document CSS reconstruction from entries captured in standalone Turbopack loader options.
5
+ *
5
6
  * @param this - Loader context that receives asynchronous CSS and source-map completion or an error.
6
7
  */
7
8
  export default function turbopackCssLoader(this: LoaderContext<TurbopackLoaderOptions>): void;
8
9
  /**
9
10
  * Reconstructs a document stylesheet and resolves its local resources through the bundler.
11
+ *
10
12
  * @param context - Loader context whose callback receives CSS and a decoded map, or the operation error.
11
13
  * @param entries - Callback that selects absolute or project-relative entries after configuration is evaluated.
12
- * Dependency watches are registered during traversal, and the compiler's checker is closed after planning.
14
+ * Repeats reconstruction if entry discovery changes during compilation or resource resolution.
15
+ * Dependency watches are registered during traversal, and each attempt releases its project.
13
16
  */
14
17
  export declare function emitStylesheet(context: LoaderContext<TurbopackLoaderOptions>, entries: (options: TurbopackProject["options"]) => Promise<string[]>): void;
15
18
  //# sourceMappingURL=css-loader.d.ts.map