@stillwind/integration 0.8.0 → 0.9.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 +180 -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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-D-45o54j.js","names":[],"sources":["../src/webpack/plugin.ts"],"sourcesContent":["import process from \"node:process\";\n\nimport type { InlineConfig } from \"@stillwind/config\";\nimport { resolveIntegrationConfig, type ResolvedIntegrationConfig } from \"@stillwind/config/node\";\n\nimport { installEmission, type EmissionCompilation, type EmissionModule } from \"./emission.ts\";\nimport type { ResolveCallback, ResolverHost, ResolveSettings } from \"./host.ts\";\nimport type { ProjectCompiler } from \"./project.ts\";\nimport { stillwindRules } from \"./rules.ts\";\n\n/**\n * Configures producer loaders and reconstructs document CSS for webpack and Rspack compilations.\n */\nexport class StillwindPlugin {\n /**\n * Retains configuration selection and overrides for the plugin's loader rules.\n * Files are evaluated in beforeRun and watchRun. The resulting settings are shared by that run's\n * compilations. Constructor execution does not evaluate configuration.\n *\n * @param config - Configuration discovery, project selection, and inline compiler overrides.\n * Omission discovers stillwind.config.* from the compiler context or process working directory.\n */\n constructor(protected readonly config: InlineConfig = {}) {}\n\n /**\n * Prepends Stillwind rules before framework plugins can clone the rule list.\n *\n * The host retains its existing CSS pipeline for document carriers. Register this plugin before\n * `VueLoaderPlugin` so cloned rules include Stillwind.\n *\n * @param rules - Mutable rule list from the compiler configuration.\n */\n protected configureRules(rules: unknown[]): void {\n rules.unshift(...stillwindRules(this.config));\n }\n\n /**\n * Installs loader rules, configuration evaluation hooks, and CSS reconstruction hooks.\n * Evaluation errors fail the build run. Existing and missing configuration dependencies are\n * registered on each compilation for watch tracking.\n *\n * @param compiler - webpack or Rspack compiler with a usable input filesystem and resolver. Call\n * through the bundler's plugin setup before compilation begins.\n */\n apply<Module extends EmissionModule>(compiler: EmissionCompiler<Module>): void {\n compiler.options.module ??= {};\n compiler.options.module.rules ??= [];\n this.configureRules(compiler.options.module.rules);\n let configuration: ResolvedIntegrationConfig | undefined;\n /**\n * Evaluates current configuration before a normal or watch build run.\n *\n * @returns Completion after the settings shared by subsequent compilations have been replaced.\n * @throws If configuration discovery, evaluation, or project selection fails.\n */\n const configure = async () => {\n configuration = await resolveIntegrationConfig(\n this.config,\n compiler.options.context ?? process.cwd(),\n );\n };\n compiler.hooks.beforeRun.tapPromise(\"StillwindConfiguration\", configure);\n compiler.hooks.watchRun.tapPromise(\"StillwindConfiguration\", configure);\n compiler.hooks.thisCompilation.tap(\"StillwindEmission\", (compilation) => {\n if (!configuration) {\n throw new Error(\"Stillwind configuration has not been initialized\");\n }\n compilation.__stillwindConfiguration = configuration;\n for (const file of configuration.dependencies) {\n compilation.fileDependencies.add(file);\n }\n for (const file of configuration.missing) {\n compilation.missingDependencies.add(file);\n }\n installEmission({\n _compilation: compilation,\n _compiler: compiler,\n fs: compiler.inputFileSystem!,\n mode: compiler.options.mode,\n /**\n * Adapts the compiler's normal resolver for document CSS reconstruction.\n *\n * @param settings - Requested dependency conditions, extensions, and metadata fields.\n * @returns A callback resolver using the compiler's configured input filesystem.\n */\n getResolve(settings) {\n const resolver = compiler.resolverFactory.get(\"normal\", settings);\n return (directory, specifier, callback) =>\n resolver.resolve({}, directory, specifier, {}, callback);\n },\n });\n });\n }\n}\n\n/**\n * Compiler operations shared by webpack and Rspack for installing rules and registering each\n * compilation.\n */\ninterface EmissionCompiler<Module extends EmissionModule> extends ProjectCompiler {\n /** Run and compilation hooks used to evaluate configuration before registering emission. */\n hooks: ProjectCompiler[\"hooks\"] & {\n /** Normal build hook that initializes settings before thisCompilation. */\n beforeRun: {\n /**\n * Registers asynchronous work before a normal build run.\n *\n * @param name - Plugin registration name.\n * @param callback - Configuration initializer whose rejection fails the run.\n */\n tapPromise(name: string, callback: () => Promise<void>): void;\n };\n /** Watch build hook that reevaluates settings before each compilation. */\n watchRun: {\n /**\n * Registers asynchronous work before a watch build run.\n *\n * @param name - Plugin registration name.\n * @param callback - Configuration initializer whose rejection fails the run.\n */\n tapPromise(name: string, callback: () => Promise<void>): void;\n };\n /** Hook that exposes each new compilation after run configuration has been initialized. */\n thisCompilation: {\n /**\n * Registers settings, dependency watches, and emission on a new compilation.\n *\n * @param name - Plugin registration name.\n * @param callback - Operation receiving the current compilation.\n */\n tap(name: string, callback: (compilation: EmissionCompilation<Module>) => void): void;\n };\n };\n /** Bundler input filesystem, which must be initialized before compilation registration. */\n inputFileSystem: ResolverHost[\"fs\"] | null;\n /** Mutable compiler options to which Stillwind loader rules are added. */\n options: {\n /** Application directory for configuration discovery. Omission uses process.cwd(). */\n context?: string;\n /** Normalized entry settings, from which the shared project selects local entry files. */\n entry?: unknown;\n /** Bundler mode forwarded to reconstruction. Only development selects development compilation. */\n mode?: string;\n /** Module rule configuration, initialized by apply when absent. */\n module?: {\n /** Mutable rules retained by the compiler and extended before framework plugins clone them. */\n rules?: unknown[];\n };\n };\n /** Resolver factory bound to this compiler's filesystem and configuration. */\n resolverFactory: {\n /**\n * Obtains a bundler resolver with a selected policy.\n *\n * @param type - Resolver category. Stillwind requests normal.\n * @param settings - Import conditions, extensions, and package fields.\n * @returns Resolver that reports completion through its callback.\n */\n get(\n type: string,\n settings: ResolveSettings,\n ): {\n /**\n * Resolves a request without changing compiler state.\n *\n * @param context - Bundler request metadata. Stillwind passes an empty object.\n * @param directory - Absolute importer directory.\n * @param specifier - Authored import or resource request.\n * @param resolveContext - Bundler resolution metadata. Stillwind passes an empty object.\n * @param callback - Receives a failure or resolved identity.\n */\n resolve(\n context: object,\n directory: string,\n specifier: string,\n resolveContext: object,\n callback: ResolveCallback,\n ): void;\n };\n };\n}\n"],"mappings":";;;;;;;AAaA,IAAa,kBAAb,MAA6B;CASI;;;;;;;;;CAA/B,YAAY,SAA0C,CAAC,GAAG;EAA3B,KAAA,SAAA;CAA4B;;;;;;;;;CAU3D,eAAyB,OAAwB;EAC/C,MAAM,QAAQ,GAAG,eAAe,KAAK,MAAM,CAAC;CAC9C;;;;;;;;;CAUA,MAAqC,UAA0C;EAC7E,SAAS,QAAQ,WAAW,CAAC;EAC7B,SAAS,QAAQ,OAAO,UAAU,CAAC;EACnC,KAAK,eAAe,SAAS,QAAQ,OAAO,KAAK;EACjD,IAAI;;;;;;;EAOJ,MAAM,YAAY,YAAY;GAC5B,gBAAgB,MAAM,yBACpB,KAAK,QACL,SAAS,QAAQ,WAAW,QAAQ,IAAI,CAC1C;EACF;EACA,SAAS,MAAM,UAAU,WAAW,0BAA0B,SAAS;EACvE,SAAS,MAAM,SAAS,WAAW,0BAA0B,SAAS;EACtE,SAAS,MAAM,gBAAgB,IAAI,sBAAsB,gBAAgB;GACvE,IAAI,CAAC,eACH,MAAM,IAAI,MAAM,kDAAkD;GAEpE,YAAY,2BAA2B;GACvC,KAAK,MAAM,QAAQ,cAAc,cAC/B,YAAY,iBAAiB,IAAI,IAAI;GAEvC,KAAK,MAAM,QAAQ,cAAc,SAC/B,YAAY,oBAAoB,IAAI,IAAI;GAE1C,gBAAgB;IACd,cAAc;IACd,WAAW;IACX,IAAI,SAAS;IACb,MAAM,SAAS,QAAQ;;;;;;;IAOvB,WAAW,UAAU;KACnB,MAAM,WAAW,SAAS,gBAAgB,IAAI,UAAU,QAAQ;KAChE,QAAQ,WAAW,WAAW,aAC5B,SAAS,QAAQ,CAAC,GAAG,WAAW,WAAW,CAAC,GAAG,QAAQ;IAC3D;GACF,CAAC;EACH,CAAC;CACH;AACF"}