@veryfront/ext-css-tailwind 0.1.1185 → 0.1.1188
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/README.md +42 -12
- package/esm/_dnt.polyfills.d.ts +101 -0
- package/esm/_dnt.polyfills.d.ts.map +1 -0
- package/esm/_dnt.polyfills.js +127 -0
- package/esm/deno.d.ts +38 -0
- package/esm/deno.d.ts.map +1 -0
- package/esm/deno.js +34 -0
- package/esm/src/index.d.ts +14 -0
- package/esm/src/index.d.ts.map +1 -0
- package/esm/src/index.js +150 -0
- package/esm/src/manifest-dependency.d.ts +3 -0
- package/esm/src/manifest-dependency.d.ts.map +1 -0
- package/esm/src/manifest-dependency.js +13 -0
- package/esm/src/plugin-loader.d.ts +7 -0
- package/esm/src/plugin-loader.d.ts.map +1 -0
- package/esm/src/plugin-loader.js +68 -0
- package/esm/src/plugin-policy.d.ts +24 -0
- package/esm/src/plugin-policy.d.ts.map +1 -0
- package/esm/src/plugin-policy.js +86 -0
- package/package.json +18 -15
- package/esm/_dnt.shims.d.ts +0 -11
- package/esm/_dnt.shims.d.ts.map +0 -1
- package/esm/_dnt.shims.js +0 -68
- package/esm/index.d.ts +0 -9
- package/esm/index.d.ts.map +0 -1
- package/esm/index.js +0 -71
package/README.md
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
# @veryfront/ext-css-tailwind
|
|
2
2
|
|
|
3
|
-
> **Category:** Build | **Contract:** `CSSProcessor` | **
|
|
3
|
+
> **Category:** Build | **Contract:** `CSSProcessor` | **Explicit**
|
|
4
4
|
|
|
5
|
-
Provides Tailwind CSS v4 compilation for Veryfront.
|
|
5
|
+
Provides Tailwind CSS v4 compilation for Veryfront. The extension owns the
|
|
6
|
+
pinned compiler, local base stylesheet, plugin policy, plugin module loading,
|
|
7
|
+
and every third-party import; framework core sees only `CSSProcessor`.
|
|
6
8
|
|
|
7
9
|
## Registration
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
Install and compose the extension explicitly:
|
|
10
12
|
|
|
11
13
|
```ts
|
|
12
14
|
import extTailwind from "@veryfront/ext-css-tailwind";
|
|
@@ -16,26 +18,54 @@ export default defineConfig({
|
|
|
16
18
|
});
|
|
17
19
|
```
|
|
18
20
|
|
|
21
|
+
Core never discovers or auto-registers this provider. Production pipelines
|
|
22
|
+
that request CSS minification must also explicitly compose a
|
|
23
|
+
`CSSOptimizationEngine` provider such as `@veryfront/ext-css-lightning`.
|
|
24
|
+
If either requested provider is absent, compilation fails instead of returning
|
|
25
|
+
empty or regex-rewritten CSS.
|
|
26
|
+
|
|
19
27
|
## Provided contract
|
|
20
28
|
|
|
21
29
|
`CSSProcessor` — exposes:
|
|
22
30
|
|
|
23
|
-
- `
|
|
31
|
+
- `defaultStylesheet` — the extension-owned Tailwind import, typography plugin,
|
|
32
|
+
and dark-mode variant used only when the application supplies no stylesheet;
|
|
33
|
+
- `compile(stylesheet)` — delegates to Tailwind's native `compile()` and returns
|
|
34
|
+
a compiler whose `build(candidates)` emits CSS for the class-name candidates
|
|
35
|
+
discovered at render time.
|
|
36
|
+
|
|
37
|
+
## Plugin isolation
|
|
24
38
|
|
|
25
|
-
|
|
39
|
+
The extension accepts only its audited plugin allowlist and resolves every
|
|
40
|
+
plugin to one exact, extension-owned npm dependency. All five plugin modules are
|
|
41
|
+
statically imported and registered locally; compilation performs no plugin
|
|
42
|
+
download, temporary-module write, source rewriting, or global shim injection.
|
|
43
|
+
Unpinned version overrides and unknown packages are rejected before Tailwind
|
|
44
|
+
receives a plugin value.
|
|
26
45
|
|
|
27
|
-
|
|
46
|
+
The audited local inventory is:
|
|
28
47
|
|
|
29
|
-
|
|
48
|
+
- `@tailwindcss/forms@0.5.11`
|
|
49
|
+
- `@tailwindcss/typography@0.5.19`
|
|
50
|
+
- `daisyui@5.5.14`
|
|
51
|
+
- `tailwind-scrollbar-hide@2.0.0`
|
|
52
|
+
- `tailwindcss-animate@1.0.7`
|
|
30
53
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
54
|
+
Stylesheets may use either the bare package name or that exact versioned
|
|
55
|
+
specifier. No other version is accepted.
|
|
56
|
+
|
|
57
|
+
The complete local plugin inventory and exact versions are bound into the
|
|
58
|
+
processor cache identity. Changing any plugin implementation policy therefore
|
|
59
|
+
invalidates compiled CSS caches deterministically.
|
|
34
60
|
|
|
35
61
|
## Capabilities
|
|
36
62
|
|
|
37
|
-
- **
|
|
63
|
+
- **filesystem read:** reading the pinned package's `index.css`.
|
|
64
|
+
|
|
65
|
+
The extension requests no network or filesystem-write capability.
|
|
38
66
|
|
|
39
67
|
## Configuration
|
|
40
68
|
|
|
41
|
-
No factory options.
|
|
69
|
+
No factory options. Inherited configuration, accessors, and unknown keys are
|
|
70
|
+
rejected. The base stylesheet is local and mandatory; there is no CDN or empty
|
|
71
|
+
stylesheet fallback.
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Based on [import-meta-ponyfill](https://github.com/gaubee/import-meta-ponyfill),
|
|
3
|
+
* but instead of using npm to install additional dependencies,
|
|
4
|
+
* this approach manually consolidates cjs/mjs/d.ts into a single file.
|
|
5
|
+
*
|
|
6
|
+
* Note that this code might be imported multiple times
|
|
7
|
+
* (for example, both dnt.test.polyfills.ts and dnt.polyfills.ts contain this code;
|
|
8
|
+
* or Node.js might dynamically clear the cache and then force a require).
|
|
9
|
+
* Therefore, it's important to avoid redundant writes to global objects.
|
|
10
|
+
* Additionally, consider that commonjs is used alongside esm,
|
|
11
|
+
* so the two ponyfill functions are stored independently in two separate global objects.
|
|
12
|
+
*/
|
|
13
|
+
import { createRequire } from "node:module";
|
|
14
|
+
import { type URL } from "node:url";
|
|
15
|
+
declare global {
|
|
16
|
+
interface ImportMeta {
|
|
17
|
+
/** A string representation of the fully qualified module URL. When the
|
|
18
|
+
* module is loaded locally, the value will be a file URL (e.g.
|
|
19
|
+
* `file:///path/module.ts`).
|
|
20
|
+
*
|
|
21
|
+
* You can also parse the string as a URL to determine more information about
|
|
22
|
+
* how the current module was loaded. For example to determine if a module was
|
|
23
|
+
* local or not:
|
|
24
|
+
*
|
|
25
|
+
* ```ts
|
|
26
|
+
* const url = new URL(import.meta.url);
|
|
27
|
+
* if (url.protocol === "file:") {
|
|
28
|
+
* console.log("this module was loaded locally");
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
url: string;
|
|
33
|
+
/**
|
|
34
|
+
* A function that returns resolved specifier as if it would be imported
|
|
35
|
+
* using `import(specifier)`.
|
|
36
|
+
*
|
|
37
|
+
* ```ts
|
|
38
|
+
* console.log(import.meta.resolve("./foo.js"));
|
|
39
|
+
* // file:///dev/foo.js
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @param specifier The module specifier to resolve relative to `parent`.
|
|
43
|
+
* @param parent The absolute parent module URL to resolve from.
|
|
44
|
+
* @returns The absolute (`file:`) URL string for the resolved module.
|
|
45
|
+
*/
|
|
46
|
+
resolve(specifier: string, parent?: string | URL | undefined): string;
|
|
47
|
+
/** A flag that indicates if the current module is the main module that was
|
|
48
|
+
* called when starting the program under Deno.
|
|
49
|
+
*
|
|
50
|
+
* ```ts
|
|
51
|
+
* if (import.meta.main) {
|
|
52
|
+
* // this was loaded as the main module, maybe do some bootstrapping
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
main: boolean;
|
|
57
|
+
/** The absolute path of the current module.
|
|
58
|
+
*
|
|
59
|
+
* This property is only provided for local modules (ie. using `file://` URLs).
|
|
60
|
+
*
|
|
61
|
+
* Example:
|
|
62
|
+
* ```
|
|
63
|
+
* // Unix
|
|
64
|
+
* console.log(import.meta.filename); // /home/alice/my_module.ts
|
|
65
|
+
*
|
|
66
|
+
* // Windows
|
|
67
|
+
* console.log(import.meta.filename); // C:\alice\my_module.ts
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
filename: string;
|
|
71
|
+
/** The absolute path of the directory containing the current module.
|
|
72
|
+
*
|
|
73
|
+
* This property is only provided for local modules (ie. using `file://` URLs).
|
|
74
|
+
*
|
|
75
|
+
* * Example:
|
|
76
|
+
* ```
|
|
77
|
+
* // Unix
|
|
78
|
+
* console.log(import.meta.dirname); // /home/alice
|
|
79
|
+
*
|
|
80
|
+
* // Windows
|
|
81
|
+
* console.log(import.meta.dirname); // C:\alice
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
dirname: string;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
type NodeRequest = ReturnType<typeof createRequire>;
|
|
88
|
+
type NodeModule = NonNullable<NodeRequest["main"]>;
|
|
89
|
+
interface ImportMetaPonyfillCommonjs {
|
|
90
|
+
(require: NodeRequest, module: NodeModule): ImportMeta;
|
|
91
|
+
}
|
|
92
|
+
interface ImportMetaPonyfillEsmodule {
|
|
93
|
+
(importMeta: ImportMeta): ImportMeta;
|
|
94
|
+
}
|
|
95
|
+
interface ImportMetaPonyfill extends ImportMetaPonyfillCommonjs, ImportMetaPonyfillEsmodule {
|
|
96
|
+
}
|
|
97
|
+
export declare let import_meta_ponyfill_commonjs: ImportMetaPonyfillCommonjs;
|
|
98
|
+
export declare let import_meta_ponyfill_esmodule: ImportMetaPonyfillEsmodule;
|
|
99
|
+
export declare let import_meta_ponyfill: ImportMetaPonyfill;
|
|
100
|
+
export {};
|
|
101
|
+
//# sourceMappingURL=_dnt.polyfills.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_dnt.polyfills.d.ts","sourceRoot":"","sources":["../src/_dnt.polyfills.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAgC,KAAK,GAAG,EAAE,MAAM,UAAU,CAAC;AAGlE,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,UAAU;QAClB;;;;;;;;;;;;;;WAcG;QACH,GAAG,EAAE,MAAM,CAAC;QACZ;;;;;;;;;;;;WAYG;QACH,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,GAAG,MAAM,CAAC;QACtE;;;;;;;;WAQG;QACH,IAAI,EAAE,OAAO,CAAC;QAEd;;;;;;;;;;;;WAYG;QACH,QAAQ,EAAE,MAAM,CAAC;QAEjB;;;;;;;;;;;;WAYG;QACH,OAAO,EAAE,MAAM,CAAC;KACjB;CACF;AAED,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACpD,KAAK,UAAU,GAAG,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;AACnD,UAAU,0BAA0B;IAClC,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,GAAG,UAAU,CAAC;CACxD;AACD,UAAU,0BAA0B;IAClC,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAAC;CACtC;AACD,UAAU,kBACR,SAAQ,0BAA0B,EAAE,0BAA0B;CAC/D;AAiBD,eAAO,IAAI,6BAA6B,EA2BnC,0BAA0B,CAAC;AAMhC,eAAO,IAAI,6BAA6B,EA4DnC,0BAA0B,CAAC;AAMhC,eAAO,IAAI,oBAAoB,EAoB1B,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Based on [import-meta-ponyfill](https://github.com/gaubee/import-meta-ponyfill),
|
|
3
|
+
* but instead of using npm to install additional dependencies,
|
|
4
|
+
* this approach manually consolidates cjs/mjs/d.ts into a single file.
|
|
5
|
+
*
|
|
6
|
+
* Note that this code might be imported multiple times
|
|
7
|
+
* (for example, both dnt.test.polyfills.ts and dnt.polyfills.ts contain this code;
|
|
8
|
+
* or Node.js might dynamically clear the cache and then force a require).
|
|
9
|
+
* Therefore, it's important to avoid redundant writes to global objects.
|
|
10
|
+
* Additionally, consider that commonjs is used alongside esm,
|
|
11
|
+
* so the two ponyfill functions are stored independently in two separate global objects.
|
|
12
|
+
*/
|
|
13
|
+
//@ts-ignore
|
|
14
|
+
import { createRequire } from "node:module";
|
|
15
|
+
//@ts-ignore
|
|
16
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
17
|
+
//@ts-ignore
|
|
18
|
+
import { dirname } from "node:path";
|
|
19
|
+
const defineGlobalPonyfill = (symbolFor, fn) => {
|
|
20
|
+
if (!Reflect.has(globalThis, Symbol.for(symbolFor))) {
|
|
21
|
+
Object.defineProperty(globalThis, Symbol.for(symbolFor), {
|
|
22
|
+
configurable: true,
|
|
23
|
+
get() {
|
|
24
|
+
return fn;
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
export let import_meta_ponyfill_commonjs = (Reflect.get(globalThis, Symbol.for("import-meta-ponyfill-commonjs")) ??
|
|
30
|
+
(() => {
|
|
31
|
+
const moduleImportMetaWM = new WeakMap();
|
|
32
|
+
return (require, module) => {
|
|
33
|
+
let importMetaCache = moduleImportMetaWM.get(module);
|
|
34
|
+
if (importMetaCache == null) {
|
|
35
|
+
const importMeta = Object.assign(Object.create(null), {
|
|
36
|
+
url: pathToFileURL(module.filename).href,
|
|
37
|
+
main: require.main == module,
|
|
38
|
+
resolve: (specifier, parentURL = importMeta.url) => {
|
|
39
|
+
return pathToFileURL((importMeta.url === parentURL
|
|
40
|
+
? require
|
|
41
|
+
: createRequire(parentURL))
|
|
42
|
+
.resolve(specifier)).href;
|
|
43
|
+
},
|
|
44
|
+
filename: module.filename,
|
|
45
|
+
dirname: module.path,
|
|
46
|
+
});
|
|
47
|
+
moduleImportMetaWM.set(module, importMeta);
|
|
48
|
+
importMetaCache = importMeta;
|
|
49
|
+
}
|
|
50
|
+
return importMetaCache;
|
|
51
|
+
};
|
|
52
|
+
})());
|
|
53
|
+
defineGlobalPonyfill("import-meta-ponyfill-commonjs", import_meta_ponyfill_commonjs);
|
|
54
|
+
export let import_meta_ponyfill_esmodule = (Reflect.get(globalThis, Symbol.for("import-meta-ponyfill-esmodule")) ??
|
|
55
|
+
((importMeta) => {
|
|
56
|
+
const resolveFunStr = String(importMeta.resolve);
|
|
57
|
+
const shimWs = new WeakSet();
|
|
58
|
+
//@ts-ignore
|
|
59
|
+
const mainUrl = ("file:///" + (process.argv[1] ?? "").replace(/\\/g, "/"))
|
|
60
|
+
.replace(/\/{3,}/, "///");
|
|
61
|
+
const commonShim = (importMeta) => {
|
|
62
|
+
if (typeof importMeta.main !== "boolean") {
|
|
63
|
+
importMeta.main = importMeta.url === mainUrl;
|
|
64
|
+
}
|
|
65
|
+
if (typeof importMeta.filename !== "string") {
|
|
66
|
+
importMeta.filename = fileURLToPath(importMeta.url);
|
|
67
|
+
importMeta.dirname = dirname(importMeta.filename);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
if (
|
|
71
|
+
// v16.2.0+, v14.18.0+: Add support for WHATWG URL object to parentURL parameter.
|
|
72
|
+
resolveFunStr === "undefined" ||
|
|
73
|
+
// v20.0.0+, v18.19.0+"" This API now returns a string synchronously instead of a Promise.
|
|
74
|
+
resolveFunStr.startsWith("async")
|
|
75
|
+
// enable by --experimental-import-meta-resolve flag
|
|
76
|
+
) {
|
|
77
|
+
import_meta_ponyfill_esmodule = (importMeta) => {
|
|
78
|
+
if (!shimWs.has(importMeta)) {
|
|
79
|
+
shimWs.add(importMeta);
|
|
80
|
+
const importMetaUrlRequire = {
|
|
81
|
+
url: importMeta.url,
|
|
82
|
+
require: createRequire(importMeta.url),
|
|
83
|
+
};
|
|
84
|
+
importMeta.resolve = function resolve(specifier, parentURL = importMeta.url) {
|
|
85
|
+
return pathToFileURL((importMetaUrlRequire.url === parentURL
|
|
86
|
+
? importMetaUrlRequire.require
|
|
87
|
+
: createRequire(parentURL)).resolve(specifier)).href;
|
|
88
|
+
};
|
|
89
|
+
commonShim(importMeta);
|
|
90
|
+
}
|
|
91
|
+
return importMeta;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
/// native support
|
|
96
|
+
import_meta_ponyfill_esmodule = (importMeta) => {
|
|
97
|
+
if (!shimWs.has(importMeta)) {
|
|
98
|
+
shimWs.add(importMeta);
|
|
99
|
+
commonShim(importMeta);
|
|
100
|
+
}
|
|
101
|
+
return importMeta;
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
return import_meta_ponyfill_esmodule(importMeta);
|
|
105
|
+
}));
|
|
106
|
+
defineGlobalPonyfill("import-meta-ponyfill-esmodule", import_meta_ponyfill_esmodule);
|
|
107
|
+
export let import_meta_ponyfill = ((...args) => {
|
|
108
|
+
const _MODULE = (() => {
|
|
109
|
+
if (typeof require === "function" && typeof module === "object") {
|
|
110
|
+
return "commonjs";
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
// eval("typeof import.meta");
|
|
114
|
+
return "esmodule";
|
|
115
|
+
}
|
|
116
|
+
})();
|
|
117
|
+
if (_MODULE === "commonjs") {
|
|
118
|
+
//@ts-ignore
|
|
119
|
+
import_meta_ponyfill = (r, m) => import_meta_ponyfill_commonjs(r, m);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
//@ts-ignore
|
|
123
|
+
import_meta_ponyfill = (im) => import_meta_ponyfill_esmodule(im);
|
|
124
|
+
}
|
|
125
|
+
//@ts-ignore
|
|
126
|
+
return import_meta_ponyfill(...args);
|
|
127
|
+
});
|
package/esm/deno.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let name: string;
|
|
3
|
+
let version: string;
|
|
4
|
+
let exports: string;
|
|
5
|
+
namespace veryfront {
|
|
6
|
+
let extension: boolean;
|
|
7
|
+
let activation: string;
|
|
8
|
+
namespace contracts {
|
|
9
|
+
let provides: string[];
|
|
10
|
+
}
|
|
11
|
+
namespace npm {
|
|
12
|
+
let runtimeVersionFromManifest: boolean;
|
|
13
|
+
}
|
|
14
|
+
let capabilities: {
|
|
15
|
+
type: string;
|
|
16
|
+
}[];
|
|
17
|
+
}
|
|
18
|
+
let imports: {
|
|
19
|
+
"@tailwindcss/forms": string;
|
|
20
|
+
"@tailwindcss/typography": string;
|
|
21
|
+
daisyui: string;
|
|
22
|
+
"tailwind-scrollbar-hide": string;
|
|
23
|
+
tailwindcss: string;
|
|
24
|
+
"tailwindcss-animate": string;
|
|
25
|
+
"tailwindcss/index.css": string;
|
|
26
|
+
"tailwindcss/package.json": string;
|
|
27
|
+
"@std/assert": string;
|
|
28
|
+
"@std/testing/bdd": string;
|
|
29
|
+
"veryfront/extensions": string;
|
|
30
|
+
"veryfront/extensions/css": string;
|
|
31
|
+
"veryfront/errors": string;
|
|
32
|
+
};
|
|
33
|
+
namespace tasks {
|
|
34
|
+
let test: string;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export default _default;
|
|
38
|
+
//# sourceMappingURL=deno.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deno.d.ts","sourceRoot":"","sources":["../src/deno.js"],"names":[],"mappings":""}
|
package/esm/deno.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"name": "@veryfront/ext-css-tailwind",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"exports": "./src/index.ts",
|
|
5
|
+
"veryfront": {
|
|
6
|
+
"extension": true,
|
|
7
|
+
"activation": "explicit",
|
|
8
|
+
"contracts": {
|
|
9
|
+
"provides": ["CSSProcessor"]
|
|
10
|
+
},
|
|
11
|
+
"npm": {
|
|
12
|
+
"runtimeVersionFromManifest": true
|
|
13
|
+
},
|
|
14
|
+
"capabilities": [{ "type": "fs:read" }]
|
|
15
|
+
},
|
|
16
|
+
"imports": {
|
|
17
|
+
"@tailwindcss/forms": "npm:@tailwindcss/forms@0.5.11",
|
|
18
|
+
"@tailwindcss/typography": "npm:@tailwindcss/typography@0.5.19",
|
|
19
|
+
"daisyui": "npm:daisyui@5.5.14",
|
|
20
|
+
"tailwind-scrollbar-hide": "npm:tailwind-scrollbar-hide@2.0.0",
|
|
21
|
+
"tailwindcss": "npm:tailwindcss@4.2.2",
|
|
22
|
+
"tailwindcss-animate": "npm:tailwindcss-animate@1.0.7",
|
|
23
|
+
"tailwindcss/index.css": "npm:tailwindcss@4.2.2/index.css",
|
|
24
|
+
"tailwindcss/package.json": "npm:tailwindcss@4.2.2/package.json",
|
|
25
|
+
"@std/assert": "jsr:@std/assert@1.0.19",
|
|
26
|
+
"@std/testing/bdd": "jsr:@std/testing@1.0.17/bdd",
|
|
27
|
+
"veryfront/extensions": "../../src/extensions/index.ts",
|
|
28
|
+
"veryfront/extensions/css": "../../src/extensions/css/index.ts",
|
|
29
|
+
"veryfront/errors": "../../src/errors/index.ts"
|
|
30
|
+
},
|
|
31
|
+
"tasks": {
|
|
32
|
+
"test": "deno test --frozen --allow-read src/"
|
|
33
|
+
}
|
|
34
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Tailwind CSS implementation of the provider-neutral CSSProcessor contract. */
|
|
2
|
+
import "../_dnt.polyfills.js";
|
|
3
|
+
import type { ExtensionFactory } from "veryfront/extensions";
|
|
4
|
+
import { type CSSCompiler, type CSSProcessor } from "veryfront/extensions/css";
|
|
5
|
+
export declare const TAILWIND_DEFAULT_STYLESHEET = "@import \"tailwindcss\";\n@plugin \"@tailwindcss/typography\";\n@custom-variant dark (&:is(.dark, [data-theme=\"dark\"]) *, &:is(.dark, [data-theme=\"dark\"]));";
|
|
6
|
+
export declare class TailwindCSSProcessor implements CSSProcessor {
|
|
7
|
+
readonly cacheIdentity: string;
|
|
8
|
+
readonly defaultStylesheet = "@import \"tailwindcss\";\n@plugin \"@tailwindcss/typography\";\n@custom-variant dark (&:is(.dark, [data-theme=\"dark\"]) *, &:is(.dark, [data-theme=\"dark\"]));";
|
|
9
|
+
constructor();
|
|
10
|
+
compile(stylesheet: string): Promise<CSSCompiler>;
|
|
11
|
+
}
|
|
12
|
+
declare const extTailwind: ExtensionFactory;
|
|
13
|
+
export default extTailwind;
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/src/index.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,OAAO,sBAAsB,CAAC;AAO9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAoB,MAAM,0BAA0B,CAAC;AAoBjG,eAAO,MAAM,2BAA2B,qKAEqD,CAAC;AAqD9F,qBAAa,oBAAqB,YAAW,YAAY;IACvD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,iBAAiB,sKAA+B;;IAenD,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;CA2CxD;AAKD,QAAA,MAAM,WAAW,EAAE,gBAYlB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
package/esm/src/index.js
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/** Tailwind CSS implementation of the provider-neutral CSSProcessor contract. */
|
|
2
|
+
import "../_dnt.polyfills.js";
|
|
3
|
+
import { createHash } from "node:crypto";
|
|
4
|
+
import { readFileSync } from "node:fs";
|
|
5
|
+
import { createRequire } from "node:module";
|
|
6
|
+
import { isProxy as isProxyWithoutHooks } from "node:util/types";
|
|
7
|
+
import { CSSProcessorName } from "veryfront/extensions/css";
|
|
8
|
+
import { IMPORT_RESOLUTION_ERROR } from "veryfront/errors";
|
|
9
|
+
import { compile } from "tailwindcss";
|
|
10
|
+
import extensionPackage from "../deno.js";
|
|
11
|
+
import { exactTailwindVersion } from "./manifest-dependency.js";
|
|
12
|
+
import { loadPlugin } from "./plugin-loader.js";
|
|
13
|
+
import { TAILWIND_PLUGIN_POLICY_IDENTITY } from "./plugin-policy.js";
|
|
14
|
+
const ENGINE_SEMANTICS_VERSION = "veryfront.css-tailwind.v4";
|
|
15
|
+
const apply = Reflect.apply;
|
|
16
|
+
const arrayJoin = Array.prototype.join;
|
|
17
|
+
const freeze = Object.freeze;
|
|
18
|
+
const getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
19
|
+
const getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors;
|
|
20
|
+
const getPrototypeOf = Object.getPrototypeOf;
|
|
21
|
+
const isArray = Array.isArray;
|
|
22
|
+
const objectPrototype = Object.prototype;
|
|
23
|
+
const ownKeys = Reflect.ownKeys;
|
|
24
|
+
const requireFromExtension = createRequire(globalThis[Symbol.for("import-meta-ponyfill-esmodule")](import.meta).url);
|
|
25
|
+
const tailwindVersion = exactTailwindVersion(extensionPackage.imports.tailwindcss);
|
|
26
|
+
export const TAILWIND_DEFAULT_STYLESHEET = `@import "tailwindcss";
|
|
27
|
+
@plugin "@tailwindcss/typography";
|
|
28
|
+
@custom-variant dark (&:is(.dark, [data-theme="dark"]) *, &:is(.dark, [data-theme="dark"]));`;
|
|
29
|
+
function sha256(value) {
|
|
30
|
+
return createHash("sha256").update(value, "utf8").digest("hex");
|
|
31
|
+
}
|
|
32
|
+
function loadTailwindBaseStylesheet() {
|
|
33
|
+
let resolved;
|
|
34
|
+
try {
|
|
35
|
+
resolved = requireFromExtension.resolve("tailwindcss/index.css");
|
|
36
|
+
}
|
|
37
|
+
catch (cause) {
|
|
38
|
+
throw IMPORT_RESOLUTION_ERROR.create({
|
|
39
|
+
detail: "ext-css-tailwind could not resolve its pinned base stylesheet",
|
|
40
|
+
cause,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
return readFileSync(resolved, "utf8");
|
|
45
|
+
}
|
|
46
|
+
catch (cause) {
|
|
47
|
+
throw IMPORT_RESOLUTION_ERROR.create({
|
|
48
|
+
detail: `ext-css-tailwind could not read its pinned base stylesheet: ${resolved}`,
|
|
49
|
+
cause,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const tailwindBaseStylesheet = loadTailwindBaseStylesheet();
|
|
54
|
+
function assertEmptyConfig(value) {
|
|
55
|
+
if (value === undefined)
|
|
56
|
+
return;
|
|
57
|
+
if (typeof value !== "object" ||
|
|
58
|
+
value === null ||
|
|
59
|
+
isArray(value) ||
|
|
60
|
+
isProxyWithoutHooks(value)) {
|
|
61
|
+
throw new TypeError("ext-css-tailwind config must be an object");
|
|
62
|
+
}
|
|
63
|
+
let prototype;
|
|
64
|
+
let keys;
|
|
65
|
+
try {
|
|
66
|
+
prototype = getPrototypeOf(value);
|
|
67
|
+
keys = ownKeys(getOwnPropertyDescriptors(value));
|
|
68
|
+
}
|
|
69
|
+
catch (cause) {
|
|
70
|
+
throw new TypeError("ext-css-tailwind config could not be inspected", { cause });
|
|
71
|
+
}
|
|
72
|
+
if (prototype !== objectPrototype && prototype !== null) {
|
|
73
|
+
throw new TypeError("ext-css-tailwind config must not inherit configuration");
|
|
74
|
+
}
|
|
75
|
+
if (keys.length !== 0) {
|
|
76
|
+
throw new TypeError("ext-css-tailwind does not accept configuration properties");
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
export class TailwindCSSProcessor {
|
|
80
|
+
cacheIdentity;
|
|
81
|
+
defaultStylesheet = TAILWIND_DEFAULT_STYLESHEET;
|
|
82
|
+
constructor() {
|
|
83
|
+
const identityParts = [
|
|
84
|
+
ENGINE_SEMANTICS_VERSION,
|
|
85
|
+
`ext-css-tailwind@${extensionPackage.version}`,
|
|
86
|
+
`tailwindcss@${tailwindVersion}`,
|
|
87
|
+
`base=${sha256(tailwindBaseStylesheet)}`,
|
|
88
|
+
`default=${sha256(this.defaultStylesheet)}`,
|
|
89
|
+
`plugins=${sha256(TAILWIND_PLUGIN_POLICY_IDENTITY)}`,
|
|
90
|
+
];
|
|
91
|
+
this.cacheIdentity = apply(arrayJoin, identityParts, [";"]);
|
|
92
|
+
freeze(this);
|
|
93
|
+
}
|
|
94
|
+
async compile(stylesheet) {
|
|
95
|
+
if (typeof stylesheet !== "string") {
|
|
96
|
+
throw new TypeError("ext-css-tailwind stylesheet must be a string");
|
|
97
|
+
}
|
|
98
|
+
const native = await compile(stylesheet, {
|
|
99
|
+
base: "/",
|
|
100
|
+
loadStylesheet: (id) => {
|
|
101
|
+
if (id !== "tailwindcss") {
|
|
102
|
+
throw IMPORT_RESOLUTION_ERROR.create({
|
|
103
|
+
detail: `ext-css-tailwind cannot resolve stylesheet import "${id}"`,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return Promise.resolve({
|
|
107
|
+
content: tailwindBaseStylesheet,
|
|
108
|
+
base: "/",
|
|
109
|
+
path: "/tailwindcss/index.css",
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
loadModule: (id) => Promise.resolve({
|
|
113
|
+
// deno-lint-ignore no-explicit-any -- Tailwind's vendor API accepts opaque plugin modules.
|
|
114
|
+
module: loadPlugin(id),
|
|
115
|
+
base: "/",
|
|
116
|
+
path: "/",
|
|
117
|
+
}),
|
|
118
|
+
});
|
|
119
|
+
const buildDescriptor = getOwnPropertyDescriptor(native, "build");
|
|
120
|
+
if (buildDescriptor === undefined ||
|
|
121
|
+
!("value" in buildDescriptor) ||
|
|
122
|
+
typeof buildDescriptor.value !== "function") {
|
|
123
|
+
throw IMPORT_RESOLUTION_ERROR.create({
|
|
124
|
+
detail: "ext-css-tailwind compiler did not expose a stable build method",
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
const nativeBuild = buildDescriptor.value;
|
|
128
|
+
return freeze({
|
|
129
|
+
build(candidates) {
|
|
130
|
+
return apply(nativeBuild, native, [candidates]);
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
freeze(TailwindCSSProcessor.prototype);
|
|
136
|
+
freeze(TailwindCSSProcessor);
|
|
137
|
+
const extTailwind = (config) => {
|
|
138
|
+
assertEmptyConfig(config);
|
|
139
|
+
return {
|
|
140
|
+
name: "ext-css-tailwind",
|
|
141
|
+
version: extensionPackage.version,
|
|
142
|
+
contracts: { provides: [CSSProcessorName] },
|
|
143
|
+
capabilities: [{ type: "fs:read" }],
|
|
144
|
+
setup(ctx) {
|
|
145
|
+
ctx.provide(CSSProcessorName, new TailwindCSSProcessor());
|
|
146
|
+
ctx.logger.debug(`[ext-css-tailwind] ${CSSProcessorName} registered`);
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
export default extTailwind;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-dependency.d.ts","sourceRoot":"","sources":["../../src/src/manifest-dependency.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAMlF,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,OAAO,GAAG,MAAM,CAc/D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Resolve Tailwind's exact version from this extension's checked-in manifest. */
|
|
2
|
+
const TAILWIND_NPM_PREFIX = "npm:tailwindcss@";
|
|
3
|
+
const EXACT_SEMVER_PATTERN = /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-(?:(?:0|[1-9]\d*)|\d*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:(?:0|[1-9]\d*)|\d*[A-Za-z-][0-9A-Za-z-]*))*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
|
|
4
|
+
export function exactTailwindVersion(specifier) {
|
|
5
|
+
if (typeof specifier !== "string" || !specifier.startsWith(TAILWIND_NPM_PREFIX)) {
|
|
6
|
+
throw new TypeError("ext-css-tailwind imports.tailwindcss must target npm:tailwindcss at an exact semantic version");
|
|
7
|
+
}
|
|
8
|
+
const version = specifier.slice(TAILWIND_NPM_PREFIX.length);
|
|
9
|
+
if (!EXACT_SEMVER_PATTERN.test(version)) {
|
|
10
|
+
throw new TypeError("ext-css-tailwind imports.tailwindcss must use an exact semantic version without a range or subpath");
|
|
11
|
+
}
|
|
12
|
+
return version;
|
|
13
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Static plugin loading owned entirely by ext-css-tailwind. */
|
|
2
|
+
/**
|
|
3
|
+
* Resolve an audited plugin from the extension's immutable local registry.
|
|
4
|
+
* Unknown packages and version overrides fail before Tailwind receives a value.
|
|
5
|
+
*/
|
|
6
|
+
export declare function loadPlugin(id: string): unknown;
|
|
7
|
+
//# sourceMappingURL=plugin-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-loader.d.ts","sourceRoot":"","sources":["../../src/src/plugin-loader.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAsEhE;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAK9C"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/** Static plugin loading owned entirely by ext-css-tailwind. */
|
|
2
|
+
import forms from "@tailwindcss/forms";
|
|
3
|
+
import typography from "@tailwindcss/typography";
|
|
4
|
+
import daisyui from "daisyui";
|
|
5
|
+
import scrollbarHide from "tailwind-scrollbar-hide";
|
|
6
|
+
import tailwindcssAnimate from "tailwindcss-animate";
|
|
7
|
+
import { IMPORT_RESOLUTION_ERROR, SECURITY_VIOLATION } from "veryfront/errors";
|
|
8
|
+
import { bareName, resolveTailwindPluginPolicy, TAILWIND_PLUGIN_ALLOWLIST, } from "./plugin-policy.js";
|
|
9
|
+
function getStaticPlugin(name) {
|
|
10
|
+
switch (name) {
|
|
11
|
+
case "@tailwindcss/forms":
|
|
12
|
+
return forms;
|
|
13
|
+
case "@tailwindcss/typography":
|
|
14
|
+
return typography;
|
|
15
|
+
case "daisyui":
|
|
16
|
+
return daisyui;
|
|
17
|
+
case "tailwind-scrollbar-hide":
|
|
18
|
+
return scrollbarHide;
|
|
19
|
+
case "tailwindcss-animate":
|
|
20
|
+
return tailwindcssAnimate;
|
|
21
|
+
default:
|
|
22
|
+
throw IMPORT_RESOLUTION_ERROR.create({
|
|
23
|
+
detail: `Tailwind plugin "${name}" is absent from the static extension registry`,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function requirePinnedPlugin(specifier) {
|
|
28
|
+
try {
|
|
29
|
+
return resolveTailwindPluginPolicy(specifier).name;
|
|
30
|
+
}
|
|
31
|
+
catch (cause) {
|
|
32
|
+
const displayName = typeof specifier === "string" ? bareName(specifier) : "<non-string>";
|
|
33
|
+
throw SECURITY_VIOLATION.create({
|
|
34
|
+
detail: `Package "${displayName}" is not an audited ext-css-tailwind plugin`,
|
|
35
|
+
cause,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function assertStaticPlugin(name, value) {
|
|
40
|
+
if (typeof value !== "function" &&
|
|
41
|
+
(typeof value !== "object" || value === null)) {
|
|
42
|
+
throw IMPORT_RESOLUTION_ERROR.create({
|
|
43
|
+
detail: `Tailwind plugin "${name}" did not export a plugin value`,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function assertCompleteStaticRegistry() {
|
|
48
|
+
for (let index = 0; index < TAILWIND_PLUGIN_ALLOWLIST.length; index++) {
|
|
49
|
+
const name = TAILWIND_PLUGIN_ALLOWLIST[index];
|
|
50
|
+
if (name === undefined) {
|
|
51
|
+
throw IMPORT_RESOLUTION_ERROR.create({
|
|
52
|
+
detail: "ext-css-tailwind plugin policy contains an invalid entry",
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
assertStaticPlugin(name, getStaticPlugin(name));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
assertCompleteStaticRegistry();
|
|
59
|
+
/**
|
|
60
|
+
* Resolve an audited plugin from the extension's immutable local registry.
|
|
61
|
+
* Unknown packages and version overrides fail before Tailwind receives a value.
|
|
62
|
+
*/
|
|
63
|
+
export function loadPlugin(id) {
|
|
64
|
+
const name = requirePinnedPlugin(id);
|
|
65
|
+
const plugin = getStaticPlugin(name);
|
|
66
|
+
assertStaticPlugin(name, plugin);
|
|
67
|
+
return plugin;
|
|
68
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** Audited local plugin policy owned by ext-css-tailwind. */
|
|
2
|
+
export type TailwindPluginPolicyEntry = Readonly<{
|
|
3
|
+
name: string;
|
|
4
|
+
version: string;
|
|
5
|
+
importSpecifier: string;
|
|
6
|
+
npmSpecifier: string;
|
|
7
|
+
}>;
|
|
8
|
+
/**
|
|
9
|
+
* Complete immutable inventory of third-party plugin implementations shipped
|
|
10
|
+
* by this extension. Each entry must have a matching exact import-map target
|
|
11
|
+
* and a static import in `plugin-loader.ts`.
|
|
12
|
+
*/
|
|
13
|
+
export declare const TAILWIND_PLUGIN_POLICY: readonly Readonly<{
|
|
14
|
+
name: string;
|
|
15
|
+
version: string;
|
|
16
|
+
importSpecifier: string;
|
|
17
|
+
npmSpecifier: string;
|
|
18
|
+
}>[];
|
|
19
|
+
export declare const PACKAGE_SPEC_RE: Readonly<RegExp>;
|
|
20
|
+
export declare function bareName(specifier: string): string;
|
|
21
|
+
export declare const TAILWIND_PLUGIN_ALLOWLIST: readonly string[];
|
|
22
|
+
export declare function resolveTailwindPluginPolicy(specifier: string): TailwindPluginPolicyEntry;
|
|
23
|
+
export declare const TAILWIND_PLUGIN_POLICY_IDENTITY: string;
|
|
24
|
+
//# sourceMappingURL=plugin-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-policy.d.ts","sourceRoot":"","sources":["../../src/src/plugin-policy.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D,MAAM,MAAM,yBAAyB,GAAG,QAAQ,CAAC;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC,CAAC;AA2BH;;;;GAIG;AACH,eAAO,MAAM,sBAAsB;UApC3B,MAAM;aACH,MAAM;qBACE,MAAM;kBACT,MAAM;IAuCpB,CAAC;AAEH,eAAO,MAAM,eAAe,kBAE3B,CAAC;AAEF,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAUlD;AAaD,eAAO,MAAM,yBAAyB,mBAAoB,CAAC;AAE3D,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,MAAM,GAChB,yBAAyB,CAqB3B;AAsBD,eAAO,MAAM,+BAA+B,EAIrC,MAAM,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/** Audited local plugin policy owned by ext-css-tailwind. */
|
|
2
|
+
const apply = Reflect.apply;
|
|
3
|
+
const MapConstructor = Map;
|
|
4
|
+
const NativeTypeError = TypeError;
|
|
5
|
+
const arrayMap = Array.prototype.map;
|
|
6
|
+
const arraySort = Array.prototype.sort;
|
|
7
|
+
const freeze = Object.freeze;
|
|
8
|
+
const jsonStringify = JSON.stringify;
|
|
9
|
+
const mapGet = Map.prototype.get;
|
|
10
|
+
const regexpExec = RegExp.prototype.exec;
|
|
11
|
+
const stringIndexOf = String.prototype.indexOf;
|
|
12
|
+
const stringSlice = String.prototype.slice;
|
|
13
|
+
const stringStartsWith = String.prototype.startsWith;
|
|
14
|
+
function definePlugin(name, version) {
|
|
15
|
+
return freeze({
|
|
16
|
+
name,
|
|
17
|
+
version,
|
|
18
|
+
importSpecifier: name,
|
|
19
|
+
npmSpecifier: `npm:${name}@${version}`,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Complete immutable inventory of third-party plugin implementations shipped
|
|
24
|
+
* by this extension. Each entry must have a matching exact import-map target
|
|
25
|
+
* and a static import in `plugin-loader.ts`.
|
|
26
|
+
*/
|
|
27
|
+
export const TAILWIND_PLUGIN_POLICY = freeze([
|
|
28
|
+
definePlugin("tailwindcss-animate", "1.0.7"),
|
|
29
|
+
definePlugin("@tailwindcss/typography", "0.5.19"),
|
|
30
|
+
definePlugin("@tailwindcss/forms", "0.5.11"),
|
|
31
|
+
definePlugin("tailwind-scrollbar-hide", "2.0.0"),
|
|
32
|
+
definePlugin("daisyui", "5.5.14"),
|
|
33
|
+
]);
|
|
34
|
+
export const PACKAGE_SPEC_RE = freeze(/^(?:@[a-z0-9][\w.-]*\/)?[a-z0-9][\w.-]*(?:@[\w.+-]+)?$/);
|
|
35
|
+
export function bareName(specifier) {
|
|
36
|
+
if (typeof specifier !== "string") {
|
|
37
|
+
throw new NativeTypeError("Tailwind plugin specifier must be a string");
|
|
38
|
+
}
|
|
39
|
+
if (apply(stringStartsWith, specifier, ["@"])) {
|
|
40
|
+
const index = apply(stringIndexOf, specifier, ["@", 1]);
|
|
41
|
+
return index === -1 ? specifier : apply(stringSlice, specifier, [0, index]);
|
|
42
|
+
}
|
|
43
|
+
const index = apply(stringIndexOf, specifier, ["@"]);
|
|
44
|
+
return index === -1 ? specifier : apply(stringSlice, specifier, [0, index]);
|
|
45
|
+
}
|
|
46
|
+
const POLICY_BY_NAME = new MapConstructor(apply(arrayMap, TAILWIND_PLUGIN_POLICY, [
|
|
47
|
+
(entry) => [entry.name, entry],
|
|
48
|
+
]));
|
|
49
|
+
/** Immutable public view of the packages this extension can load. */
|
|
50
|
+
const allowlist = apply(arrayMap, TAILWIND_PLUGIN_POLICY, [
|
|
51
|
+
(entry) => entry.name,
|
|
52
|
+
]);
|
|
53
|
+
apply(arraySort, allowlist, []);
|
|
54
|
+
export const TAILWIND_PLUGIN_ALLOWLIST = freeze(allowlist);
|
|
55
|
+
export function resolveTailwindPluginPolicy(specifier) {
|
|
56
|
+
if (typeof specifier !== "string" ||
|
|
57
|
+
apply(regexpExec, PACKAGE_SPEC_RE, [specifier]) === null) {
|
|
58
|
+
throw new NativeTypeError(`Invalid Tailwind plugin specifier: ${specifier}`);
|
|
59
|
+
}
|
|
60
|
+
const name = bareName(specifier);
|
|
61
|
+
const policy = apply(mapGet, POLICY_BY_NAME, [name]);
|
|
62
|
+
if (policy === undefined) {
|
|
63
|
+
throw new NativeTypeError(`Tailwind plugin is not allowlisted: ${name}`);
|
|
64
|
+
}
|
|
65
|
+
const pinnedSpecifier = `${policy.name}@${policy.version}`;
|
|
66
|
+
if (specifier !== name && specifier !== pinnedSpecifier) {
|
|
67
|
+
throw new NativeTypeError(`Tailwind plugin ${name} must use the audited version ${pinnedSpecifier}`);
|
|
68
|
+
}
|
|
69
|
+
return policy;
|
|
70
|
+
}
|
|
71
|
+
const identityPlugins = apply(arrayMap, TAILWIND_PLUGIN_POLICY, [
|
|
72
|
+
(entry) => ({
|
|
73
|
+
name: entry.name,
|
|
74
|
+
version: entry.version,
|
|
75
|
+
importSpecifier: entry.importSpecifier,
|
|
76
|
+
npmSpecifier: entry.npmSpecifier,
|
|
77
|
+
}),
|
|
78
|
+
]);
|
|
79
|
+
apply(arraySort, identityPlugins, [
|
|
80
|
+
(left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : 0,
|
|
81
|
+
]);
|
|
82
|
+
export const TAILWIND_PLUGIN_POLICY_IDENTITY = apply(jsonStringify, JSON, [{
|
|
83
|
+
schema: "veryfront.tailwind-plugin-policy.v3",
|
|
84
|
+
resolution: "extension-owned-static-npm-imports",
|
|
85
|
+
plugins: identityPlugins,
|
|
86
|
+
}]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veryfront/ext-css-tailwind",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1188",
|
|
4
4
|
"description": "Veryfront first-party extension package for ext-css-tailwind",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"veryfront",
|
|
@@ -18,47 +18,50 @@
|
|
|
18
18
|
"bugs": {
|
|
19
19
|
"url": "https://github.com/veryfront/veryfront-code/issues"
|
|
20
20
|
},
|
|
21
|
-
"module": "./esm/index.js",
|
|
21
|
+
"module": "./esm/src/index.js",
|
|
22
22
|
"exports": {
|
|
23
23
|
".": {
|
|
24
|
-
"import": "./esm/index.js",
|
|
25
|
-
"types": "./esm/index.d.ts"
|
|
24
|
+
"import": "./esm/src/index.js",
|
|
25
|
+
"types": "./esm/src/index.d.ts"
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"scripts": {},
|
|
29
29
|
"engines": {
|
|
30
|
-
"node": ">=
|
|
30
|
+
"node": ">=22.3.0"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
35
|
"veryfront": {
|
|
36
36
|
"extension": true,
|
|
37
|
+
"activation": "explicit",
|
|
37
38
|
"contracts": {
|
|
38
39
|
"provides": [
|
|
39
40
|
"CSSProcessor"
|
|
40
41
|
]
|
|
41
42
|
},
|
|
43
|
+
"npm": {
|
|
44
|
+
"runtimeVersionFromManifest": true
|
|
45
|
+
},
|
|
42
46
|
"capabilities": [
|
|
43
47
|
{
|
|
44
|
-
"type": "
|
|
45
|
-
"hosts": [
|
|
46
|
-
"esm.sh"
|
|
47
|
-
]
|
|
48
|
+
"type": "fs:read"
|
|
48
49
|
}
|
|
49
50
|
]
|
|
50
51
|
},
|
|
51
52
|
"dependencies": {
|
|
52
|
-
"@
|
|
53
|
-
"@
|
|
54
|
-
"
|
|
55
|
-
"
|
|
53
|
+
"@tailwindcss/forms": "0.5.11",
|
|
54
|
+
"@tailwindcss/typography": "0.5.19",
|
|
55
|
+
"daisyui": "5.5.14",
|
|
56
|
+
"tailwind-scrollbar-hide": "2.0.0",
|
|
57
|
+
"tailwindcss": "4.2.2",
|
|
58
|
+
"tailwindcss-animate": "1.0.7"
|
|
56
59
|
},
|
|
57
60
|
"peerDependencies": {
|
|
58
|
-
"veryfront": "^0.1.
|
|
61
|
+
"veryfront": "^0.1.1188"
|
|
59
62
|
},
|
|
60
63
|
"type": "module",
|
|
61
|
-
"types": "./esm/index.d.ts",
|
|
64
|
+
"types": "./esm/src/index.d.ts",
|
|
62
65
|
"files": [
|
|
63
66
|
"esm",
|
|
64
67
|
"LICENSE",
|
package/esm/_dnt.shims.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Deno } from "@deno/shim-deno";
|
|
2
|
-
export { Deno } from "@deno/shim-deno";
|
|
3
|
-
export { crypto, type Crypto, type SubtleCrypto, type AlgorithmIdentifier, type Algorithm, type RsaOaepParams, type BufferSource, type AesCtrParams, type AesCbcParams, type AesGcmParams, type CryptoKey, type KeyAlgorithm, type KeyType, type KeyUsage, type EcdhKeyDeriveParams, type HkdfParams, type HashAlgorithmIdentifier, type Pbkdf2Params, type AesDerivedKeyParams, type HmacImportParams, type JsonWebKey, type RsaOtherPrimesInfo, type KeyFormat, type RsaHashedKeyGenParams, type RsaKeyGenParams, type BigInteger, type EcKeyGenParams, type NamedCurve, type CryptoKeyPair, type AesKeyGenParams, type HmacKeyGenParams, type RsaHashedImportParams, type EcKeyImportParams, type AesKeyAlgorithm, type RsaPssParams, type EcdsaParams } from "@deno/shim-crypto";
|
|
4
|
-
export { setInterval, setTimeout } from "@deno/shim-timers";
|
|
5
|
-
export declare const dntGlobalThis: Omit<typeof globalThis, "Deno" | "crypto" | "setInterval" | "setTimeout"> & {
|
|
6
|
-
Deno: typeof Deno;
|
|
7
|
-
crypto: import("@deno/shim-crypto").Crypto;
|
|
8
|
-
setInterval: any;
|
|
9
|
-
setTimeout: any;
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=_dnt.shims.d.ts.map
|
package/esm/_dnt.shims.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_dnt.shims.d.ts","sourceRoot":"","sources":["../src/_dnt.shims.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,OAAO,EAAE,MAAM,EAAE,KAAK,MAAM,EAAE,KAAK,YAAY,EAAE,KAAK,mBAAmB,EAAE,KAAK,SAAS,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,KAAK,YAAY,EAAE,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,mBAAmB,EAAE,KAAK,UAAU,EAAE,KAAK,uBAAuB,EAAE,KAAK,YAAY,EAAE,KAAK,mBAAmB,EAAE,KAAK,gBAAgB,EAAE,KAAK,UAAU,EAAE,KAAK,kBAAkB,EAAE,KAAK,SAAS,EAAE,KAAK,qBAAqB,EAAE,KAAK,eAAe,EAAE,KAAK,UAAU,EAAE,KAAK,cAAc,EAAE,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,KAAK,iBAAiB,EAAE,KAAK,eAAe,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErvB,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAQ5D,eAAO,MAAM,aAAa;;;;;CAA2C,CAAC"}
|
package/esm/_dnt.shims.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { Deno } from "@deno/shim-deno";
|
|
2
|
-
export { Deno } from "@deno/shim-deno";
|
|
3
|
-
import { crypto } from "@deno/shim-crypto";
|
|
4
|
-
export { crypto } from "@deno/shim-crypto";
|
|
5
|
-
import { setInterval, setTimeout } from "@deno/shim-timers";
|
|
6
|
-
export { setInterval, setTimeout } from "@deno/shim-timers";
|
|
7
|
-
const dntGlobals = {
|
|
8
|
-
Deno,
|
|
9
|
-
crypto,
|
|
10
|
-
setInterval,
|
|
11
|
-
setTimeout,
|
|
12
|
-
};
|
|
13
|
-
export const dntGlobalThis = createMergeProxy(globalThis, dntGlobals);
|
|
14
|
-
function createMergeProxy(baseObj, extObj) {
|
|
15
|
-
return new Proxy(baseObj, {
|
|
16
|
-
get(_target, prop, _receiver) {
|
|
17
|
-
if (prop in extObj) {
|
|
18
|
-
return extObj[prop];
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
return baseObj[prop];
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
set(_target, prop, value) {
|
|
25
|
-
if (prop in extObj) {
|
|
26
|
-
delete extObj[prop];
|
|
27
|
-
}
|
|
28
|
-
baseObj[prop] = value;
|
|
29
|
-
return true;
|
|
30
|
-
},
|
|
31
|
-
deleteProperty(_target, prop) {
|
|
32
|
-
let success = false;
|
|
33
|
-
if (prop in extObj) {
|
|
34
|
-
delete extObj[prop];
|
|
35
|
-
success = true;
|
|
36
|
-
}
|
|
37
|
-
if (prop in baseObj) {
|
|
38
|
-
delete baseObj[prop];
|
|
39
|
-
success = true;
|
|
40
|
-
}
|
|
41
|
-
return success;
|
|
42
|
-
},
|
|
43
|
-
ownKeys(_target) {
|
|
44
|
-
const baseKeys = Reflect.ownKeys(baseObj);
|
|
45
|
-
const extKeys = Reflect.ownKeys(extObj);
|
|
46
|
-
const extKeysSet = new Set(extKeys);
|
|
47
|
-
return [...baseKeys.filter((k) => !extKeysSet.has(k)), ...extKeys];
|
|
48
|
-
},
|
|
49
|
-
defineProperty(_target, prop, desc) {
|
|
50
|
-
if (prop in extObj) {
|
|
51
|
-
delete extObj[prop];
|
|
52
|
-
}
|
|
53
|
-
Reflect.defineProperty(baseObj, prop, desc);
|
|
54
|
-
return true;
|
|
55
|
-
},
|
|
56
|
-
getOwnPropertyDescriptor(_target, prop) {
|
|
57
|
-
if (prop in extObj) {
|
|
58
|
-
return Reflect.getOwnPropertyDescriptor(extObj, prop);
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
return Reflect.getOwnPropertyDescriptor(baseObj, prop);
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
has(_target, prop) {
|
|
65
|
-
return prop in extObj || prop in baseObj;
|
|
66
|
-
},
|
|
67
|
-
});
|
|
68
|
-
}
|
package/esm/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ExtensionFactory } from "veryfront/extensions";
|
|
2
|
-
import type { CSSCompileOptions, CSSCompiler, CSSProcessor } from "veryfront/extensions/css";
|
|
3
|
-
declare class TailwindCSSProcessor implements CSSProcessor {
|
|
4
|
-
compile(stylesheet: string, options: CSSCompileOptions): Promise<CSSCompiler>;
|
|
5
|
-
}
|
|
6
|
-
declare const extTailwind: ExtensionFactory;
|
|
7
|
-
export default extTailwind;
|
|
8
|
-
export { TailwindCSSProcessor };
|
|
9
|
-
//# sourceMappingURL=index.d.ts.map
|
package/esm/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAgB7F,cAAM,oBAAqB,YAAW,YAAY;IAC1C,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC;CAgBpF;AAED,QAAA,MAAM,WAAW,EAAE,gBAsBlB,CAAC;AAEF,eAAe,WAAW,CAAC;AAC3B,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
package/esm/index.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ext-css-tailwind — CSSProcessor implementation backed by Tailwind CSS v4.
|
|
3
|
-
*
|
|
4
|
-
* Provides the `CSSProcessor` contract:
|
|
5
|
-
* - `compile(stylesheet, options)` — delegates to tailwindcss `compile()`
|
|
6
|
-
* and returns a compiler whose `build(candidates)` emits CSS for the
|
|
7
|
-
* class-name candidates discovered at render time.
|
|
8
|
-
*
|
|
9
|
-
* The extension also installs three `globalThis` shims on setup so that
|
|
10
|
-
* Tailwind plugin bundles loaded at runtime from esm.sh can bind their
|
|
11
|
-
* `tailwindcss/plugin`, `tailwindcss/defaultTheme`, and `tailwindcss/colors`
|
|
12
|
-
* imports to the same tailwindcss copy this extension ships. Core's
|
|
13
|
-
* `plugin-loader.ts` rewrites plugin bundle code to reference these shims
|
|
14
|
-
* by name; without the shims installed, dynamic plugin loading fails.
|
|
15
|
-
*
|
|
16
|
-
* @module extensions/ext-css-tailwind
|
|
17
|
-
*/
|
|
18
|
-
import * as dntShim from "./_dnt.shims.js";
|
|
19
|
-
import { compile } from "tailwindcss";
|
|
20
|
-
import plugin from "tailwindcss/plugin";
|
|
21
|
-
import defaultTheme from "tailwindcss/defaultTheme";
|
|
22
|
-
import colors from "tailwindcss/colors";
|
|
23
|
-
function installTailwindPluginShims() {
|
|
24
|
-
const g = dntShim.dntGlobalThis;
|
|
25
|
-
g.__tailwindPluginShim = { default: plugin, __esModule: true };
|
|
26
|
-
g.__tailwindDefaultThemeShim = { default: defaultTheme, __esModule: true };
|
|
27
|
-
g.__tailwindColorsShim = { default: colors, __esModule: true };
|
|
28
|
-
}
|
|
29
|
-
class TailwindCSSProcessor {
|
|
30
|
-
async compile(stylesheet, options) {
|
|
31
|
-
const native = await compile(stylesheet, {
|
|
32
|
-
base: options.base,
|
|
33
|
-
loadStylesheet: options.loadStylesheet,
|
|
34
|
-
loadModule: async (id) => {
|
|
35
|
-
const loaded = await options.loadModule(id);
|
|
36
|
-
// deno-lint-ignore no-explicit-any -- loaded plugin modules are opaque to the contract
|
|
37
|
-
return { module: loaded.module, base: loaded.base, path: loaded.path };
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
return {
|
|
41
|
-
build(candidates) {
|
|
42
|
-
return native.build(candidates);
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
const extTailwind = () => {
|
|
48
|
-
const impl = new TailwindCSSProcessor();
|
|
49
|
-
return {
|
|
50
|
-
name: "ext-css-tailwind",
|
|
51
|
-
version: "0.1.0",
|
|
52
|
-
contracts: {
|
|
53
|
-
provides: ["CSSProcessor"],
|
|
54
|
-
},
|
|
55
|
-
capabilities: [
|
|
56
|
-
{ type: "net:outbound", hosts: ["esm.sh"] },
|
|
57
|
-
],
|
|
58
|
-
setup(ctx) {
|
|
59
|
-
installTailwindPluginShims();
|
|
60
|
-
ctx.provide("CSSProcessor", impl);
|
|
61
|
-
ctx.logger.debug("[ext-css-tailwind] CSSProcessor registered");
|
|
62
|
-
},
|
|
63
|
-
teardown() {
|
|
64
|
-
// Shims stay installed — removing them could break in-flight plugin
|
|
65
|
-
// loads. The globalThis pollution is intentional and scoped to keys
|
|
66
|
-
// with `__tailwind` prefix.
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
export default extTailwind;
|
|
71
|
-
export { TailwindCSSProcessor };
|