@vertesia/plugin-builder 0.81.1 → 0.82.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertesia/plugin-builder",
3
- "version": "0.81.1",
3
+ "version": "0.82.0",
4
4
  "description": "A vite plugin to build vertesia UI plugins",
5
5
  "type": "module",
6
6
  "types": "./lib/index.d.ts",
package/lib/index.d.ts DELETED
@@ -1,18 +0,0 @@
1
- interface VertesiaPluginBuilderOptions {
2
- inlineCss?: boolean;
3
- cssVar?: string;
4
- input?: string;
5
- output?: string;
6
- }
7
- export declare function vertesiaPluginBuilder({ inlineCss, cssVar, input, output, }?: VertesiaPluginBuilderOptions): {
8
- name: string;
9
- apply: "build";
10
- enforce: "post";
11
- resolveId(this: import("rollup").PluginContext, id: string): "virtual:vertesia-plugin-css-entry" | null;
12
- load(this: import("rollup").PluginContext, id: string): string | null;
13
- buildStart(this: import("rollup").PluginContext): void;
14
- generateBundle(this: import("rollup").PluginContext, _options: import("rollup").NormalizedOutputOptions, bundle: import("rollup").OutputBundle): void;
15
- writeBundle(this: import("rollup").PluginContext, options: import("rollup").NormalizedOutputOptions, bundle: import("rollup").OutputBundle): void;
16
- };
17
- export {};
18
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,UAAU,4BAA4B;IAClC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AACD,wBAAgB,qBAAqB,CAAC,EAClC,SAAS,EACT,MAAM,EACN,KAAK,EACL,MAAM,GACT,GAAE,4BAAiC;;WAQV,OAAO;;;;;;;EA+ChC"}
package/lib/index.js DELETED
@@ -1,63 +0,0 @@
1
- import { readFileSync, writeFileSync } from "node:fs";
2
- import { join } from "node:path";
3
- import { extractTailwindUtilitiesLayer } from "./parse-css.js";
4
- export function vertesiaPluginBuilder({ inlineCss, cssVar, input, output, } = {}) {
5
- const CSS_VAR = cssVar || 'css';
6
- if (!input)
7
- input = 'src/index.css';
8
- if (!output)
9
- output = 'plugin.css';
10
- const inputRelative = input.startsWith('./') ? input : `./${input}`;
11
- const jsOutput = output.replace('.css', '.js');
12
- return {
13
- name: 'vertesia-plugin-builder',
14
- apply: 'build',
15
- enforce: 'post',
16
- resolveId(id) {
17
- // Create a virtual CSS entry module
18
- if (id === 'virtual:vertesia-plugin-css-entry') {
19
- return id;
20
- }
21
- return null;
22
- },
23
- load(id) {
24
- if (id === 'virtual:vertesia-plugin-css-entry') {
25
- // This creates a virtual JS file that imports your actual CSS
26
- return `import "${inputRelative}";`;
27
- }
28
- return null;
29
- },
30
- buildStart() {
31
- // This emits the file into the build pipeline
32
- this.emitFile({
33
- type: 'chunk',
34
- fileName: 'virtual-vertesia-plugin-css-entry.js',
35
- id: 'virtual:vertesia-plugin-css-entry',
36
- });
37
- },
38
- generateBundle(_options, bundle) {
39
- delete bundle['virtual-vertesia-plugin-css-entry.js'];
40
- },
41
- writeBundle(options, bundle) {
42
- if (!inlineCss)
43
- return;
44
- // Look for the generated CSS file in the output directory
45
- const keys = Object.keys(bundle).filter(k => k === output);
46
- if (keys.length === 1) {
47
- const asset = bundle[jsOutput];
48
- if (asset) {
49
- const cssContent = readFileSync(join(options.dir, output), 'utf8');
50
- if (cssContent) {
51
- const exportedContent = extractTailwindUtilitiesLayer(cssContent);
52
- if (exportedContent) {
53
- const jsFile = join(options.dir, jsOutput);
54
- const jsContent = readFileSync(jsFile, 'utf8');
55
- writeFileSync(jsFile, `${jsContent}\nexport const ${CSS_VAR} = \`\n${exportedContent}\n\`;\n`);
56
- }
57
- }
58
- }
59
- }
60
- },
61
- };
62
- }
63
- //# sourceMappingURL=index.js.map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AChD,EAAE,EAAE,mCAAmC;aAC1C,CAAC,CAAC;QACP,CAAC;QACD,cAAc,CAAC,QAAQ,EAAE,MAAM;YAC3B,OAAO,MAAM,CAAC,sCAAsC,CAAC,CAAC;QAC1D,CAAC;QACD,WAAW,CAAO,OAAO,EAAE,MAAM;YAC7B,IAAI,CAAC,SAAS;gBAAE,OAAO;YACvB,0DAA0D;YAC1D,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC;YAC3D,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACpB,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;gBAC/B,IAAI,KAAK,EAAE,CAAC;oBACR,MAAM,UAAU,GAAG,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,GAAI,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAA;oBACnE,IAAI,UAAU,EAAE,CAAC;wBACb,MAAM,eAAe,GAAG,6BAA6B,CAAC,UAAU,CAAC,CAAC;wBAClE,IAAI,eAAe,EAAE,CAAC;4BAClB,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAI,EAAE,QAAQ,CAAC,CAAC;4BAC5C,MAAM,SAAS,GAAG,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;4BAC/C,aAAa,CAAC,MAAM,EAAE,GAAG,SAAS,kBAAkB,OAAO,UAAU,eAAe,SAAS,CAAC,CAAC;wBACnG,CAAC;oBACL,CAAC;gBACL,CAAC;YACL,CAAC;QACL,CAAC;KACa,CAAC;AACvB,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare function extractTailwindUtilitiesLayer(content: string): string;
2
- //# sourceMappingURL=parse-css.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parse-css.d.ts","sourceRoot":"","sources":["../src/parse-css.ts"],"names":[],"mappings":"AAGA,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,MAAM,UAiB5D"}
package/lib/parse-css.js DELETED
@@ -1,20 +0,0 @@
1
- import { parse, stringify } from '@adobe/css-tools';
2
- export function extractTailwindUtilitiesLayer(content) {
3
- let obj = parse(content, {});
4
- let result = '';
5
- for (const rule of obj.stylesheet.rules) {
6
- if (rule.type === 'layer' && rule.layer === 'utilities') {
7
- if (rule.rules) {
8
- const output = {
9
- type: 'stylesheet',
10
- stylesheet: {
11
- rules: rule.rules
12
- }
13
- };
14
- result = stringify(output, {});
15
- }
16
- }
17
- }
18
- return result;
19
- }
20
- //# sourceMappingURL=parse-css.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parse-css.js","sourceRoot":"","sources":["../src/parse-css.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEtE,MAAM,UAAU,6BAA6B,CAAC,OAAe;IACzD,IAAI,GAAG,GAAG,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAC7B,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;QACtC,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,IAAI,CAAC,KAAK,KAAK,WAAW,EAAE,CAAC;YACtD,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;gBACb,MAAM,MAAM,GAAG;oBACX,IAAI,EAAE,YAAY;oBAClB,UAAU,EAAE;wBACR,KAAK,EAAE,IAAI,CAAC,KAAK;qBACpB;iBACgB,CAAC;gBACtB,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YACnC,CAAC;QACL,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC"}