domflax 0.1.2 → 0.2.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 (49) hide show
  1. package/README.md +66 -31
  2. package/dist/chunk-EYQXQQQH.js +336 -0
  3. package/dist/chunk-EYQXQQQH.js.map +1 -0
  4. package/dist/{chunk-DNHOGPYV.js → chunk-FPT4EJ6Q.js} +1100 -1551
  5. package/dist/chunk-FPT4EJ6Q.js.map +1 -0
  6. package/dist/chunk-JBM3MJRM.js +382 -0
  7. package/dist/chunk-JBM3MJRM.js.map +1 -0
  8. package/dist/{chunk-DWLB7FRR.js → chunk-TTJEXWAC.js} +322 -9
  9. package/dist/chunk-TTJEXWAC.js.map +1 -0
  10. package/dist/{chunk-6WVVF6AD.js → chunk-U5GOONKV.js} +5 -2
  11. package/dist/{chunk-6WVVF6AD.js.map → chunk-U5GOONKV.js.map} +1 -1
  12. package/dist/cli.cjs +3010 -2789
  13. package/dist/cli.cjs.map +1 -1
  14. package/dist/cli.js +268 -232
  15. package/dist/cli.js.map +1 -1
  16. package/dist/index.cjs +1684 -1649
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +255 -498
  19. package/dist/index.d.ts +255 -498
  20. package/dist/index.js +17 -37
  21. package/dist/{pattern-F5xBtIE-.d.cts → pattern-DotR_dHs.d.cts} +1 -1
  22. package/dist/pattern-kit.cjs +60 -1
  23. package/dist/pattern-kit.cjs.map +1 -1
  24. package/dist/pattern-kit.d.cts +2 -2
  25. package/dist/pattern-kit.d.ts +2 -2
  26. package/dist/pattern-kit.js +2 -2
  27. package/dist/{pattern-CV607P87.d.ts → pattern-urm5uuwj.d.ts} +1 -1
  28. package/dist/{resolve-ops-DIwEelH-.d.ts → resolve-ops-D8aQina5.d.cts} +20 -0
  29. package/dist/{resolve-ops-DIwEelH-.d.cts → resolve-ops-D8aQina5.d.ts} +20 -0
  30. package/dist/verify.d.cts +1 -1
  31. package/dist/verify.d.ts +1 -1
  32. package/dist/verify.js +1 -1
  33. package/dist/webpack-loader.cjs +1615 -1633
  34. package/dist/webpack-loader.cjs.map +1 -1
  35. package/dist/webpack-loader.d.cts +8 -2
  36. package/dist/webpack-loader.d.ts +8 -2
  37. package/dist/webpack-loader.js +8 -5
  38. package/dist/webpack-loader.js.map +1 -1
  39. package/dist/worker.cjs +5337 -0
  40. package/dist/worker.cjs.map +1 -0
  41. package/dist/worker.d.cts +2 -0
  42. package/dist/worker.d.ts +2 -0
  43. package/dist/worker.js +72 -0
  44. package/dist/worker.js.map +1 -0
  45. package/package.json +4 -2
  46. package/dist/chunk-DNHOGPYV.js.map +0 -1
  47. package/dist/chunk-DOQEBGWB.js +0 -188
  48. package/dist/chunk-DOQEBGWB.js.map +0 -1
  49. package/dist/chunk-DWLB7FRR.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { DomflaxOptions } from './index.cjs';
2
- import './resolve-ops-DIwEelH-.cjs';
3
- import './pattern-F5xBtIE-.cjs';
2
+ import './resolve-ops-D8aQina5.cjs';
3
+ import './pattern-DotR_dHs.cjs';
4
4
 
5
5
  /**
6
6
  * The slice of webpack's `LoaderContext` the domflax loader touches. Declared locally so this module
@@ -11,6 +11,12 @@ interface DomflaxLoaderContext {
11
11
  readonly resourcePath: string;
12
12
  /** Loader options passed via the `module.rule` `use[].options` entry. */
13
13
  getOptions?(): DomflaxOptions | undefined;
14
+ /**
15
+ * webpack's current `Compilation` (private-but-stable loader-context field). domflax stashes the
16
+ * per-build stat accumulator here so the plugin's `done` hook — living in a separate bundle — can
17
+ * read it back. Optional/duck-typed so the loader never hard-depends on webpack.
18
+ */
19
+ readonly _compilation?: unknown;
14
20
  }
15
21
  /**
16
22
  * webpack loader entry point. Returns the (possibly rewritten) source; non-jsx/tsx or unchanged
@@ -1,6 +1,6 @@
1
1
  import { DomflaxOptions } from './index.js';
2
- import './resolve-ops-DIwEelH-.js';
3
- import './pattern-CV607P87.js';
2
+ import './resolve-ops-D8aQina5.js';
3
+ import './pattern-urm5uuwj.js';
4
4
 
5
5
  /**
6
6
  * The slice of webpack's `LoaderContext` the domflax loader touches. Declared locally so this module
@@ -11,6 +11,12 @@ interface DomflaxLoaderContext {
11
11
  readonly resourcePath: string;
12
12
  /** Loader options passed via the `module.rule` `use[].options` entry. */
13
13
  getOptions?(): DomflaxOptions | undefined;
14
+ /**
15
+ * webpack's current `Compilation` (private-but-stable loader-context field). domflax stashes the
16
+ * per-build stat accumulator here so the plugin's `done` hook — living in a separate bundle — can
17
+ * read it back. Optional/duck-typed so the loader never hard-depends on webpack.
18
+ */
19
+ readonly _compilation?: unknown;
14
20
  }
15
21
  /**
16
22
  * webpack loader entry point. Returns the (possibly rewritten) source; non-jsx/tsx or unchanged
@@ -1,11 +1,12 @@
1
1
  import {
2
+ accumulateOnCompilation,
2
3
  createDomflax
3
- } from "./chunk-DOQEBGWB.js";
4
- import "./chunk-DNHOGPYV.js";
5
- import "./chunk-DWLB7FRR.js";
4
+ } from "./chunk-JBM3MJRM.js";
5
+ import "./chunk-FPT4EJ6Q.js";
6
+ import "./chunk-TTJEXWAC.js";
6
7
  import {
7
8
  init_esm_shims
8
- } from "./chunk-6WVVF6AD.js";
9
+ } from "./chunk-U5GOONKV.js";
9
10
 
10
11
  // src/webpack-loader.ts
11
12
  init_esm_shims();
@@ -22,7 +23,9 @@ function engineFor(options) {
22
23
  function domflaxLoader(source) {
23
24
  const options = this.getOptions?.() ?? {};
24
25
  const engine = engineFor(options);
25
- return engine.transform(source, this.resourcePath).code;
26
+ const out = engine.transform(source, this.resourcePath);
27
+ accumulateOnCompilation(this._compilation, out.stats, out.code !== source);
28
+ return out.code;
26
29
  }
27
30
  export {
28
31
  domflaxLoader as default
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/webpack-loader.ts"],"sourcesContent":["/**\n * domflax webpack loader.\n *\n * A genuine webpack loader module: webpack requires this file by absolute path (wired by the\n * `domflax.webpack()` plugin, see {@link ./index.webpack}) and invokes the default export once per\n * matched `.jsx`/`.tsx` module. It runs the SAME single-file engine as {@link createDomflax} — so the\n * heavy Tailwind/postcss engines stay LAZY (constructed on first transform, only for the selected\n * provider), exactly as in the Vite adapter and the programmatic API.\n *\n * The loader is intentionally synchronous (the transform is a pure CPU function with no source map\n * yet) and structurally typed against webpack: it depends only on a minimal local `LoaderContext`\n * shape, never on the `webpack` package itself.\n */\nimport { createDomflax } from './index';\nimport type { Domflax, DomflaxOptions } from './index';\n\n/**\n * The slice of webpack's `LoaderContext` the domflax loader touches. Declared locally so this module\n * does not hard-depend on `webpack` types.\n */\nexport interface DomflaxLoaderContext {\n /** Absolute path of the module being transformed (no query suffix). */\n readonly resourcePath: string;\n /** Loader options passed via the `module.rule` `use[].options` entry. */\n getOptions?(): DomflaxOptions | undefined;\n}\n\n/**\n * Engine cache keyed by the serialized options, so a build reuses one configured engine (and its\n * one lazily-loaded resolver) across every transformed file instead of rebuilding per module.\n */\nconst engines = new Map<string, Domflax>();\n\nfunction engineFor(options: DomflaxOptions): Domflax {\n const key = JSON.stringify(options ?? {});\n let engine = engines.get(key);\n if (!engine) {\n engine = createDomflax(options);\n engines.set(key, engine);\n }\n return engine;\n}\n\n/**\n * webpack loader entry point. Returns the (possibly rewritten) source; non-jsx/tsx or unchanged\n * modules round-trip through {@link Domflax.transform} unchanged.\n */\nexport default function domflaxLoader(this: DomflaxLoaderContext, source: string): string {\n const options = this.getOptions?.() ?? {};\n const engine = engineFor(options);\n return engine.transform(source, this.resourcePath).code;\n}\n"],"mappings":";;;;;;;;;;AAAA;AA+BA,IAAM,UAAU,oBAAI,IAAqB;AAEzC,SAAS,UAAU,SAAkC;AACnD,QAAM,MAAM,KAAK,UAAU,WAAW,CAAC,CAAC;AACxC,MAAI,SAAS,QAAQ,IAAI,GAAG;AAC5B,MAAI,CAAC,QAAQ;AACX,aAAS,cAAc,OAAO;AAC9B,YAAQ,IAAI,KAAK,MAAM;AAAA,EACzB;AACA,SAAO;AACT;AAMe,SAAR,cAA2D,QAAwB;AACxF,QAAM,UAAU,KAAK,aAAa,KAAK,CAAC;AACxC,QAAM,SAAS,UAAU,OAAO;AAChC,SAAO,OAAO,UAAU,QAAQ,KAAK,YAAY,EAAE;AACrD;","names":[]}
1
+ {"version":3,"sources":["../src/webpack-loader.ts"],"sourcesContent":["/**\n * domflax webpack loader.\n *\n * A genuine webpack loader module: webpack requires this file by absolute path (wired by the\n * `domflax.webpack()` plugin, see {@link ./index.webpack}) and invokes the default export once per\n * matched `.jsx`/`.tsx` module. It runs the SAME single-file engine as {@link createDomflax} — so the\n * heavy Tailwind/postcss engines stay LAZY (constructed on first transform, only for the selected\n * provider), exactly as in the Vite adapter and the programmatic API.\n *\n * The loader is intentionally synchronous (the transform is a pure CPU function with no source map\n * yet) and structurally typed against webpack: it depends only on a minimal local `LoaderContext`\n * shape, never on the `webpack` package itself.\n */\nimport { createDomflax } from './index';\nimport type { Domflax, DomflaxOptions } from './index';\nimport { accumulateOnCompilation } from './summary';\n\n/**\n * The slice of webpack's `LoaderContext` the domflax loader touches. Declared locally so this module\n * does not hard-depend on `webpack` types.\n */\nexport interface DomflaxLoaderContext {\n /** Absolute path of the module being transformed (no query suffix). */\n readonly resourcePath: string;\n /** Loader options passed via the `module.rule` `use[].options` entry. */\n getOptions?(): DomflaxOptions | undefined;\n /**\n * webpack's current `Compilation` (private-but-stable loader-context field). domflax stashes the\n * per-build stat accumulator here so the plugin's `done` hook — living in a separate bundle — can\n * read it back. Optional/duck-typed so the loader never hard-depends on webpack.\n */\n readonly _compilation?: unknown;\n}\n\n/**\n * Engine cache keyed by the serialized options, so a build reuses one configured engine (and its\n * one lazily-loaded resolver) across every transformed file instead of rebuilding per module.\n */\nconst engines = new Map<string, Domflax>();\n\nfunction engineFor(options: DomflaxOptions): Domflax {\n const key = JSON.stringify(options ?? {});\n let engine = engines.get(key);\n if (!engine) {\n engine = createDomflax(options);\n engines.set(key, engine);\n }\n return engine;\n}\n\n/**\n * webpack loader entry point. Returns the (possibly rewritten) source; non-jsx/tsx or unchanged\n * modules round-trip through {@link Domflax.transform} unchanged.\n */\nexport default function domflaxLoader(this: DomflaxLoaderContext, source: string): string {\n const options = this.getOptions?.() ?? {};\n const engine = engineFor(options);\n const out = engine.transform(source, this.resourcePath);\n // Bridge to the plugin: stash this file's delta on the webpack compilation for the `done` hook.\n accumulateOnCompilation(this._compilation, out.stats, out.code !== source);\n return out.code;\n}\n"],"mappings":";;;;;;;;;;;AAAA;AAsCA,IAAM,UAAU,oBAAI,IAAqB;AAEzC,SAAS,UAAU,SAAkC;AACnD,QAAM,MAAM,KAAK,UAAU,WAAW,CAAC,CAAC;AACxC,MAAI,SAAS,QAAQ,IAAI,GAAG;AAC5B,MAAI,CAAC,QAAQ;AACX,aAAS,cAAc,OAAO;AAC9B,YAAQ,IAAI,KAAK,MAAM;AAAA,EACzB;AACA,SAAO;AACT;AAMe,SAAR,cAA2D,QAAwB;AACxF,QAAM,UAAU,KAAK,aAAa,KAAK,CAAC;AACxC,QAAM,SAAS,UAAU,OAAO;AAChC,QAAM,MAAM,OAAO,UAAU,QAAQ,KAAK,YAAY;AAEtD,0BAAwB,KAAK,cAAc,IAAI,OAAO,IAAI,SAAS,MAAM;AACzE,SAAO,IAAI;AACb;","names":[]}