domflax 0.1.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.
- package/LICENSE +214 -0
- package/dist/chunk-4HHISSMR.js +2227 -0
- package/dist/chunk-4HHISSMR.js.map +1 -0
- package/dist/chunk-6WVVF6AD.js +55 -0
- package/dist/chunk-6WVVF6AD.js.map +1 -0
- package/dist/chunk-77SLHRN6.js +2047 -0
- package/dist/chunk-77SLHRN6.js.map +1 -0
- package/dist/chunk-ZJ2S36GY.js +175 -0
- package/dist/chunk-ZJ2S36GY.js.map +1 -0
- package/dist/cli.cjs +5207 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +1310 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.cjs +4383 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +539 -0
- package/dist/index.d.ts +539 -0
- package/dist/index.js +110 -0
- package/dist/index.js.map +1 -0
- package/dist/pattern-CX6iBzTD.d.ts +237 -0
- package/dist/pattern-P4FIKAUB.d.cts +237 -0
- package/dist/pattern-kit.cjs +630 -0
- package/dist/pattern-kit.cjs.map +1 -0
- package/dist/pattern-kit.d.cts +80 -0
- package/dist/pattern-kit.d.ts +80 -0
- package/dist/pattern-kit.js +55 -0
- package/dist/pattern-kit.js.map +1 -0
- package/dist/types-BQ7l6dVe.d.cts +749 -0
- package/dist/types-BQ7l6dVe.d.ts +749 -0
- package/dist/verify.cjs +2747 -0
- package/dist/verify.cjs.map +1 -0
- package/dist/verify.d.cts +245 -0
- package/dist/verify.d.ts +245 -0
- package/dist/verify.js +2700 -0
- package/dist/verify.js.map +1 -0
- package/dist/webpack-loader.cjs +4149 -0
- package/dist/webpack-loader.cjs.map +1 -0
- package/dist/webpack-loader.d.cts +21 -0
- package/dist/webpack-loader.d.ts +21 -0
- package/dist/webpack-loader.js +30 -0
- package/dist/webpack-loader.js.map +1 -0
- package/package.json +99 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DomflaxOptions } from './index.cjs';
|
|
2
|
+
import './types-BQ7l6dVe.cjs';
|
|
3
|
+
import './pattern-P4FIKAUB.cjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The slice of webpack's `LoaderContext` the domflax loader touches. Declared locally so this module
|
|
7
|
+
* does not hard-depend on `webpack` types.
|
|
8
|
+
*/
|
|
9
|
+
interface DomflaxLoaderContext {
|
|
10
|
+
/** Absolute path of the module being transformed (no query suffix). */
|
|
11
|
+
readonly resourcePath: string;
|
|
12
|
+
/** Loader options passed via the `module.rule` `use[].options` entry. */
|
|
13
|
+
getOptions?(): DomflaxOptions | undefined;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* webpack loader entry point. Returns the (possibly rewritten) source; non-jsx/tsx or unchanged
|
|
17
|
+
* modules round-trip through {@link Domflax.transform} unchanged.
|
|
18
|
+
*/
|
|
19
|
+
declare function domflaxLoader(this: DomflaxLoaderContext, source: string): string;
|
|
20
|
+
|
|
21
|
+
export { type DomflaxLoaderContext, domflaxLoader as default };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DomflaxOptions } from './index.js';
|
|
2
|
+
import './types-BQ7l6dVe.js';
|
|
3
|
+
import './pattern-CX6iBzTD.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The slice of webpack's `LoaderContext` the domflax loader touches. Declared locally so this module
|
|
7
|
+
* does not hard-depend on `webpack` types.
|
|
8
|
+
*/
|
|
9
|
+
interface DomflaxLoaderContext {
|
|
10
|
+
/** Absolute path of the module being transformed (no query suffix). */
|
|
11
|
+
readonly resourcePath: string;
|
|
12
|
+
/** Loader options passed via the `module.rule` `use[].options` entry. */
|
|
13
|
+
getOptions?(): DomflaxOptions | undefined;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* webpack loader entry point. Returns the (possibly rewritten) source; non-jsx/tsx or unchanged
|
|
17
|
+
* modules round-trip through {@link Domflax.transform} unchanged.
|
|
18
|
+
*/
|
|
19
|
+
declare function domflaxLoader(this: DomflaxLoaderContext, source: string): string;
|
|
20
|
+
|
|
21
|
+
export { type DomflaxLoaderContext, domflaxLoader as default };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createDomflax
|
|
3
|
+
} from "./chunk-ZJ2S36GY.js";
|
|
4
|
+
import "./chunk-4HHISSMR.js";
|
|
5
|
+
import "./chunk-77SLHRN6.js";
|
|
6
|
+
import {
|
|
7
|
+
init_esm_shims
|
|
8
|
+
} from "./chunk-6WVVF6AD.js";
|
|
9
|
+
|
|
10
|
+
// src/webpack-loader.ts
|
|
11
|
+
init_esm_shims();
|
|
12
|
+
var engines = /* @__PURE__ */ new Map();
|
|
13
|
+
function engineFor(options) {
|
|
14
|
+
const key = JSON.stringify(options ?? {});
|
|
15
|
+
let engine = engines.get(key);
|
|
16
|
+
if (!engine) {
|
|
17
|
+
engine = createDomflax(options);
|
|
18
|
+
engines.set(key, engine);
|
|
19
|
+
}
|
|
20
|
+
return engine;
|
|
21
|
+
}
|
|
22
|
+
function domflaxLoader(source) {
|
|
23
|
+
const options = this.getOptions?.() ?? {};
|
|
24
|
+
const engine = engineFor(options);
|
|
25
|
+
return engine.transform(source, this.resourcePath).code;
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
domflaxLoader as default
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=webpack-loader.js.map
|
|
@@ -0,0 +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":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "domflax",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Compile-time DOM flattener and semantic CSS compressor — fewer DOM nodes, smaller class sets, identical rendered UI.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"dom",
|
|
7
|
+
"css",
|
|
8
|
+
"tailwind",
|
|
9
|
+
"optimizer",
|
|
10
|
+
"jsx",
|
|
11
|
+
"html",
|
|
12
|
+
"vite-plugin",
|
|
13
|
+
"webpack-plugin",
|
|
14
|
+
"unplugin"
|
|
15
|
+
],
|
|
16
|
+
"homepage": "https://github.com/Krishnesh-Mishra/domflax#readme",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/Krishnesh-Mishra/domflax.git"
|
|
20
|
+
},
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/Krishnesh-Mishra/domflax/issues"
|
|
23
|
+
},
|
|
24
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
25
|
+
"author": "Krishnesh Mishra",
|
|
26
|
+
"type": "module",
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"import": "./dist/index.js",
|
|
31
|
+
"require": "./dist/index.cjs"
|
|
32
|
+
},
|
|
33
|
+
"./pattern-kit": {
|
|
34
|
+
"types": "./dist/pattern-kit.d.ts",
|
|
35
|
+
"import": "./dist/pattern-kit.js",
|
|
36
|
+
"require": "./dist/pattern-kit.cjs"
|
|
37
|
+
},
|
|
38
|
+
"./verify": {
|
|
39
|
+
"types": "./dist/verify.d.ts",
|
|
40
|
+
"import": "./dist/verify.js",
|
|
41
|
+
"require": "./dist/verify.cjs"
|
|
42
|
+
},
|
|
43
|
+
"./package.json": "./package.json"
|
|
44
|
+
},
|
|
45
|
+
"main": "./dist/index.cjs",
|
|
46
|
+
"module": "./dist/index.js",
|
|
47
|
+
"types": "./dist/index.d.ts",
|
|
48
|
+
"bin": {
|
|
49
|
+
"domflax": "./dist/cli.cjs"
|
|
50
|
+
},
|
|
51
|
+
"files": [
|
|
52
|
+
"dist",
|
|
53
|
+
"LICENSE"
|
|
54
|
+
],
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "tsup",
|
|
57
|
+
"typecheck": "tsc --noEmit",
|
|
58
|
+
"prepublishOnly": "npm run build"
|
|
59
|
+
},
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"playwright": "*",
|
|
62
|
+
"tailwindcss": "^3.4.0",
|
|
63
|
+
"postcss": "^8.4.0",
|
|
64
|
+
"postcss-selector-parser": "^6.0.0 || ^7.0.0"
|
|
65
|
+
},
|
|
66
|
+
"peerDependenciesMeta": {
|
|
67
|
+
"playwright": {
|
|
68
|
+
"optional": true
|
|
69
|
+
},
|
|
70
|
+
"tailwindcss": {
|
|
71
|
+
"optional": true
|
|
72
|
+
},
|
|
73
|
+
"postcss": {
|
|
74
|
+
"optional": true
|
|
75
|
+
},
|
|
76
|
+
"postcss-selector-parser": {
|
|
77
|
+
"optional": true
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"dependencies": {
|
|
81
|
+
"@babel/parser": "^7.26.0",
|
|
82
|
+
"@babel/traverse": "^7.26.0",
|
|
83
|
+
"@babel/types": "^7.26.0",
|
|
84
|
+
"magic-string": "^0.30.21"
|
|
85
|
+
},
|
|
86
|
+
"devDependencies": {
|
|
87
|
+
"@domflax/core": "*",
|
|
88
|
+
"@domflax/patterns": "*",
|
|
89
|
+
"@domflax/pattern-kit": "*",
|
|
90
|
+
"@domflax/frontend-jsx": "*",
|
|
91
|
+
"@domflax/resolver-tailwind": "*",
|
|
92
|
+
"@domflax/resolver-css": "*",
|
|
93
|
+
"@domflax/verify": "*",
|
|
94
|
+
"@domflax/cli": "*",
|
|
95
|
+
"tailwindcss": "^3.4.17",
|
|
96
|
+
"postcss": "^8.5.16",
|
|
97
|
+
"postcss-selector-parser": "^7.1.0"
|
|
98
|
+
}
|
|
99
|
+
}
|