@styleframe/plugin 1.0.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 (50) hide show
  1. package/LICENSE +21 -0
  2. package/dist/astro.d.ts +7 -0
  3. package/dist/astro.d.ts.map +1 -0
  4. package/dist/astro.js +15 -0
  5. package/dist/astro.js.map +1 -0
  6. package/dist/constants-CnbAL4bY.js +17 -0
  7. package/dist/constants-CnbAL4bY.js.map +1 -0
  8. package/dist/constants.d.ts +17 -0
  9. package/dist/constants.d.ts.map +1 -0
  10. package/dist/constants.js +3 -0
  11. package/dist/esbuild.d.ts +8 -0
  12. package/dist/esbuild.d.ts.map +1 -0
  13. package/dist/esbuild.js +10 -0
  14. package/dist/esbuild.js.map +1 -0
  15. package/dist/farm.d.ts +8 -0
  16. package/dist/farm.d.ts.map +1 -0
  17. package/dist/farm.js +10 -0
  18. package/dist/farm.js.map +1 -0
  19. package/dist/index.d.ts +10 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +4 -0
  22. package/dist/nuxt.d.ts +9 -0
  23. package/dist/nuxt.d.ts.map +1 -0
  24. package/dist/nuxt.js +22 -0
  25. package/dist/nuxt.js.map +1 -0
  26. package/dist/rollup.d.ts +8 -0
  27. package/dist/rollup.d.ts.map +1 -0
  28. package/dist/rollup.js +10 -0
  29. package/dist/rollup.js.map +1 -0
  30. package/dist/rspack.d.ts +7 -0
  31. package/dist/rspack.d.ts.map +1 -0
  32. package/dist/rspack.js +10 -0
  33. package/dist/rspack.js.map +1 -0
  34. package/dist/src-mpvRItvZ.js +67 -0
  35. package/dist/src-mpvRItvZ.js.map +1 -0
  36. package/dist/types-Clt7t35T.d.ts +12 -0
  37. package/dist/types-Clt7t35T.d.ts.map +1 -0
  38. package/dist/types.d.ts +2 -0
  39. package/dist/types.js +1 -0
  40. package/dist/vite-Cs6rddMM.js +9 -0
  41. package/dist/vite-Cs6rddMM.js.map +1 -0
  42. package/dist/vite.d.ts +8 -0
  43. package/dist/vite.d.ts.map +1 -0
  44. package/dist/vite.js +5 -0
  45. package/dist/webpack-D2mM1N3t.js +9 -0
  46. package/dist/webpack-D2mM1N3t.js.map +1 -0
  47. package/dist/webpack.d.ts +8 -0
  48. package/dist/webpack.d.ts.map +1 -0
  49. package/dist/webpack.js +5 -0
  50. package/package.json +116 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Alex Grozav
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,7 @@
1
+ import { Options } from "./types-Clt7t35T.js";
2
+
3
+ //#region src/astro.d.ts
4
+ declare const _default: (options: Options) => any;
5
+ //#endregion
6
+ export { _default as default };
7
+ //# sourceMappingURL=astro.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"astro.d.ts","names":[],"sources":["../src/astro.ts"],"sourcesContent":[],"mappings":";;;cAAuC,oBAId"}
package/dist/astro.js ADDED
@@ -0,0 +1,15 @@
1
+ import "./constants-CnbAL4bY.js";
2
+ import { src_default } from "./src-mpvRItvZ.js";
3
+
4
+ //#region src/astro.ts
5
+ var astro_default = (options) => ({
6
+ name: "unplugin-starter",
7
+ hooks: { "astro:config:setup": async (astro) => {
8
+ astro.config.vite.plugins ||= [];
9
+ astro.config.vite.plugins.push(src_default.vite(options));
10
+ } }
11
+ });
12
+
13
+ //#endregion
14
+ export { astro_default as default };
15
+ //# sourceMappingURL=astro.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"astro.js","names":["unplugin"],"sources":["../src/astro.ts"],"sourcesContent":["import type { Options } from \"./types\";\n\nimport unplugin from \".\";\n\nexport default (options: Options): any => ({\n\tname: \"unplugin-starter\",\n\thooks: {\n\t\t\"astro:config:setup\": async (astro: any) => {\n\t\t\tastro.config.vite.plugins ||= [];\n\t\t\tastro.config.vite.plugins.push(unplugin.vite(options));\n\t\t},\n\t},\n});\n"],"mappings":";;;;AAIA,qBAAgB,aAA2B;CAC1C,MAAM;CACN,OAAO,EACN,sBAAsB,OAAO,UAAe;AAC3C,QAAM,OAAO,KAAK,YAAY,EAAE;AAChC,QAAM,OAAO,KAAK,QAAQ,KAAKA,YAAS,KAAK,QAAQ,CAAC;IAEvD;CACD"}
@@ -0,0 +1,17 @@
1
+ //#region src/constants.ts
2
+ const DEFAULT_ENTRY = "./styleframe.config.ts";
3
+ const DEFAULT_OPTIONS = {
4
+ entry: DEFAULT_ENTRY,
5
+ silent: false
6
+ };
7
+ const PLUGIN_NAME = "styleframe";
8
+ const IMPORT_V_PREFIX = "virtual:";
9
+ const ROLLUP_V_PREFIX = "\0";
10
+ const VIRTUAL_CSS_MODULE_ID = `${IMPORT_V_PREFIX}${PLUGIN_NAME}.css`;
11
+ const RESOLVED_VIRTUAL_CSS_MODULE_ID = `${ROLLUP_V_PREFIX}${VIRTUAL_CSS_MODULE_ID}`;
12
+ const VIRTUAL_TS_MODULE_ID = `${IMPORT_V_PREFIX}${PLUGIN_NAME}`;
13
+ const RESOLVED_VIRTUAL_TS_MODULE_ID = `${ROLLUP_V_PREFIX}${VIRTUAL_TS_MODULE_ID}`;
14
+
15
+ //#endregion
16
+ export { DEFAULT_ENTRY, DEFAULT_OPTIONS, IMPORT_V_PREFIX, PLUGIN_NAME, RESOLVED_VIRTUAL_CSS_MODULE_ID, RESOLVED_VIRTUAL_TS_MODULE_ID, ROLLUP_V_PREFIX, VIRTUAL_CSS_MODULE_ID, VIRTUAL_TS_MODULE_ID };
17
+ //# sourceMappingURL=constants-CnbAL4bY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants-CnbAL4bY.js","names":["DEFAULT_OPTIONS: Options"],"sources":["../src/constants.ts"],"sourcesContent":["import type { Options } from \"./types\";\n\nexport const DEFAULT_ENTRY = \"./styleframe.config.ts\";\n\nexport const DEFAULT_OPTIONS: Options = {\n\tentry: DEFAULT_ENTRY,\n\tsilent: false,\n};\n\nexport const PLUGIN_NAME = \"styleframe\";\nexport const IMPORT_V_PREFIX = \"virtual:\"; // Vite \"virtual\" module id prefix\nexport const ROLLUP_V_PREFIX = \"\\0\"; // Rollup \"virtual\" id prefix\n\nexport const VIRTUAL_CSS_MODULE_ID = `${IMPORT_V_PREFIX}${PLUGIN_NAME}.css`;\nexport const RESOLVED_VIRTUAL_CSS_MODULE_ID = `${ROLLUP_V_PREFIX}${VIRTUAL_CSS_MODULE_ID}`;\nexport const VIRTUAL_TS_MODULE_ID = `${IMPORT_V_PREFIX}${PLUGIN_NAME}`;\nexport const RESOLVED_VIRTUAL_TS_MODULE_ID = `${ROLLUP_V_PREFIX}${VIRTUAL_TS_MODULE_ID}`;\n"],"mappings":";AAEA,MAAa,gBAAgB;AAE7B,MAAaA,kBAA2B;CACvC,OAAO;CACP,QAAQ;CACR;AAED,MAAa,cAAc;AAC3B,MAAa,kBAAkB;AAC/B,MAAa,kBAAkB;AAE/B,MAAa,wBAAwB,GAAG,kBAAkB,YAAY;AACtE,MAAa,iCAAiC,GAAG,kBAAkB;AACnE,MAAa,uBAAuB,GAAG,kBAAkB;AACzD,MAAa,gCAAgC,GAAG,kBAAkB"}
@@ -0,0 +1,17 @@
1
+ import { Options } from "./types-Clt7t35T.js";
2
+
3
+ //#region src/constants.d.ts
4
+ declare const DEFAULT_ENTRY = "./styleframe.config.ts";
5
+ declare const DEFAULT_OPTIONS: Options;
6
+ declare const PLUGIN_NAME = "styleframe";
7
+ declare const IMPORT_V_PREFIX = "virtual:";
8
+ declare const ROLLUP_V_PREFIX = "\0";
9
+ declare const VIRTUAL_CSS_MODULE_ID = "virtual:styleframe.css";
10
+ declare const RESOLVED_VIRTUAL_CSS_MODULE_ID = "\0virtual:styleframe.css";
11
+ declare const VIRTUAL_TS_MODULE_ID = "virtual:styleframe";
12
+ declare const RESOLVED_VIRTUAL_TS_MODULE_ID = "\0virtual:styleframe";
13
+ //# sourceMappingURL=constants.d.ts.map
14
+
15
+ //#endregion
16
+ export { DEFAULT_ENTRY, DEFAULT_OPTIONS, IMPORT_V_PREFIX, PLUGIN_NAME, RESOLVED_VIRTUAL_CSS_MODULE_ID, RESOLVED_VIRTUAL_TS_MODULE_ID, ROLLUP_V_PREFIX, VIRTUAL_CSS_MODULE_ID, VIRTUAL_TS_MODULE_ID };
17
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","names":[],"sources":["../src/constants.ts"],"sourcesContent":[],"mappings":";;;cAEa,aAAA;cAEA,iBAAiB;AAFjB,cAOA,WAAA,GAPa,YAAA;AAEb,cAMA,eAAA,GANiB,UAG7B;AAEY,cAEA,eAAA,GAFW,IAAA;AACX,cAGA,qBAAA,GAHe,wBAAA;AACf,cAGA,8BAAA,GAHe,0BAAA;AAEf,cAEA,oBAAA,GAFqB,oBAAA;AACrB,cAEA,6BAAA,GAF8B,sBAAA;AAC3C"}
@@ -0,0 +1,3 @@
1
+ import { DEFAULT_ENTRY, DEFAULT_OPTIONS, IMPORT_V_PREFIX, PLUGIN_NAME, RESOLVED_VIRTUAL_CSS_MODULE_ID, RESOLVED_VIRTUAL_TS_MODULE_ID, ROLLUP_V_PREFIX, VIRTUAL_CSS_MODULE_ID, VIRTUAL_TS_MODULE_ID } from "./constants-CnbAL4bY.js";
2
+
3
+ export { DEFAULT_ENTRY, DEFAULT_OPTIONS, IMPORT_V_PREFIX, PLUGIN_NAME, RESOLVED_VIRTUAL_CSS_MODULE_ID, RESOLVED_VIRTUAL_TS_MODULE_ID, ROLLUP_V_PREFIX, VIRTUAL_CSS_MODULE_ID, VIRTUAL_TS_MODULE_ID };
@@ -0,0 +1,8 @@
1
+ import { Options } from "./types-Clt7t35T.js";
2
+ import * as esbuild0 from "esbuild";
3
+
4
+ //#region src/esbuild.d.ts
5
+ declare const _default: (options?: Options | undefined) => esbuild0.Plugin;
6
+ //#endregion
7
+ export { _default as default };
8
+ //# sourceMappingURL=esbuild.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"esbuild.d.ts","names":[],"sources":["../src/esbuild.ts"],"sourcesContent":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import "./constants-CnbAL4bY.js";
2
+ import { unpluginFactory } from "./src-mpvRItvZ.js";
3
+ import { createEsbuildPlugin } from "unplugin";
4
+
5
+ //#region src/esbuild.ts
6
+ var esbuild_default = createEsbuildPlugin(unpluginFactory);
7
+
8
+ //#endregion
9
+ export { esbuild_default as default };
10
+ //# sourceMappingURL=esbuild.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"esbuild.js","names":[],"sources":["../src/esbuild.ts"],"sourcesContent":["import { createEsbuildPlugin } from \"unplugin\";\nimport { unpluginFactory } from \".\";\n\nexport default createEsbuildPlugin(unpluginFactory);\n"],"mappings":";;;;;AAGA,sBAAe,oBAAoB,gBAAgB"}
package/dist/farm.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import { Options } from "./types-Clt7t35T.js";
2
+ import * as _farmfe_core0 from "@farmfe/core";
3
+
4
+ //#region src/farm.d.ts
5
+ declare const _default: (options?: Options | undefined) => _farmfe_core0.JsPlugin;
6
+ //#endregion
7
+ export { _default as default };
8
+ //# sourceMappingURL=farm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"farm.d.ts","names":[],"sources":["../src/farm.ts"],"sourcesContent":[],"mappings":""}
package/dist/farm.js ADDED
@@ -0,0 +1,10 @@
1
+ import "./constants-CnbAL4bY.js";
2
+ import { unpluginFactory } from "./src-mpvRItvZ.js";
3
+ import { createFarmPlugin } from "unplugin";
4
+
5
+ //#region src/farm.ts
6
+ var farm_default = createFarmPlugin(unpluginFactory);
7
+
8
+ //#endregion
9
+ export { farm_default as default };
10
+ //# sourceMappingURL=farm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"farm.js","names":[],"sources":["../src/farm.ts"],"sourcesContent":["import { createFarmPlugin } from \"unplugin\";\nimport { unpluginFactory } from \".\";\n\nexport default createFarmPlugin(unpluginFactory);\n"],"mappings":";;;;;AAGA,mBAAe,iBAAiB,gBAAgB"}
@@ -0,0 +1,10 @@
1
+ import { Options } from "./types-Clt7t35T.js";
2
+ import * as unplugin1 from "unplugin";
3
+ import { UnpluginFactory } from "unplugin";
4
+
5
+ //#region src/index.d.ts
6
+ declare const unpluginFactory: UnpluginFactory<Options | undefined>;
7
+ declare const unplugin: unplugin1.UnpluginInstance<Options | undefined, boolean>;
8
+ //#endregion
9
+ export { unplugin as default, unplugin, unpluginFactory };
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;cAwBa,iBAAiB,gBAAgB;cAkGjC,UAAQ,SAAA,CAAA,iBAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ import "./constants-CnbAL4bY.js";
2
+ import { src_default, unplugin, unpluginFactory } from "./src-mpvRItvZ.js";
3
+
4
+ export { src_default as default, unplugin, unpluginFactory };
package/dist/nuxt.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ import { Options } from "./types-Clt7t35T.js";
2
+ import * as _nuxt_schema0 from "@nuxt/schema";
3
+
4
+ //#region src/nuxt.d.ts
5
+ interface ModuleOptions extends Options {}
6
+ declare const _default: _nuxt_schema0.NuxtModule<ModuleOptions, ModuleOptions, false>;
7
+ //#endregion
8
+ export { ModuleOptions, _default as default };
9
+ //# sourceMappingURL=nuxt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nuxt.d.ts","names":[],"sources":["../src/nuxt.ts"],"sourcesContent":[],"mappings":";;;;UAKiB,aAAA,SAAsB;cAAU"}
package/dist/nuxt.js ADDED
@@ -0,0 +1,22 @@
1
+ import "./constants-CnbAL4bY.js";
2
+ import "./src-mpvRItvZ.js";
3
+ import { vite_default } from "./vite-Cs6rddMM.js";
4
+ import { webpack_default } from "./webpack-D2mM1N3t.js";
5
+ import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from "@nuxt/kit";
6
+
7
+ //#region src/nuxt.ts
8
+ var nuxt_default = defineNuxtModule({
9
+ meta: {
10
+ name: "nuxt-unplugin-starter",
11
+ configKey: "unpluginStarter"
12
+ },
13
+ defaults: {},
14
+ setup(options, _nuxt) {
15
+ addVitePlugin(() => vite_default(options));
16
+ addWebpackPlugin(() => webpack_default(options));
17
+ }
18
+ });
19
+
20
+ //#endregion
21
+ export { nuxt_default as default };
22
+ //# sourceMappingURL=nuxt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nuxt.js","names":["vite","webpack"],"sources":["../src/nuxt.ts"],"sourcesContent":["import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from \"@nuxt/kit\";\nimport type { Options } from \"./types\";\nimport vite from \"./vite\";\nimport webpack from \"./webpack\";\n\nexport interface ModuleOptions extends Options {}\n\nexport default defineNuxtModule<ModuleOptions>({\n\tmeta: {\n\t\tname: \"nuxt-unplugin-starter\",\n\t\tconfigKey: \"unpluginStarter\",\n\t},\n\tdefaults: {},\n\tsetup(options, _nuxt) {\n\t\taddVitePlugin(() => vite(options));\n\t\taddWebpackPlugin(() => webpack(options));\n\t},\n});\n"],"mappings":";;;;;;;AAOA,mBAAe,iBAAgC;CAC9C,MAAM;EACL,MAAM;EACN,WAAW;EACX;CACD,UAAU,EAAE;CACZ,MAAM,SAAS,OAAO;AACrB,sBAAoBA,aAAK,QAAQ,CAAC;AAClC,yBAAuBC,gBAAQ,QAAQ,CAAC;;CAEzC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { Options } from "./types-Clt7t35T.js";
2
+ import * as rollup0 from "rollup";
3
+
4
+ //#region src/rollup.d.ts
5
+ declare const _default: (options?: Options | undefined) => rollup0.Plugin<any> | rollup0.Plugin<any>[];
6
+ //#endregion
7
+ export { _default as default };
8
+ //# sourceMappingURL=rollup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rollup.d.ts","names":[],"sources":["../src/rollup.ts"],"sourcesContent":[],"mappings":""}
package/dist/rollup.js ADDED
@@ -0,0 +1,10 @@
1
+ import "./constants-CnbAL4bY.js";
2
+ import { unpluginFactory } from "./src-mpvRItvZ.js";
3
+ import { createRollupPlugin } from "unplugin";
4
+
5
+ //#region src/rollup.ts
6
+ var rollup_default = createRollupPlugin(unpluginFactory);
7
+
8
+ //#endregion
9
+ export { rollup_default as default };
10
+ //# sourceMappingURL=rollup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rollup.js","names":[],"sources":["../src/rollup.ts"],"sourcesContent":["import { createRollupPlugin } from \"unplugin\";\nimport { unpluginFactory } from \".\";\n\nexport default createRollupPlugin(unpluginFactory);\n"],"mappings":";;;;;AAGA,qBAAe,mBAAmB,gBAAgB"}
@@ -0,0 +1,7 @@
1
+ import { Options } from "./types-Clt7t35T.js";
2
+
3
+ //#region src/rspack.d.ts
4
+ declare const _default: (options?: Options | undefined) => RspackPluginInstance;
5
+ //#endregion
6
+ export { _default as default };
7
+ //# sourceMappingURL=rspack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rspack.d.ts","names":[],"sources":["../src/rspack.ts"],"sourcesContent":[],"mappings":""}
package/dist/rspack.js ADDED
@@ -0,0 +1,10 @@
1
+ import "./constants-CnbAL4bY.js";
2
+ import { unpluginFactory } from "./src-mpvRItvZ.js";
3
+ import { createRspackPlugin } from "unplugin";
4
+
5
+ //#region src/rspack.ts
6
+ var rspack_default = createRspackPlugin(unpluginFactory);
7
+
8
+ //#endregion
9
+ export { rspack_default as default };
10
+ //# sourceMappingURL=rspack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rspack.js","names":[],"sources":["../src/rspack.ts"],"sourcesContent":["import { createRspackPlugin } from \"unplugin\";\nimport { unpluginFactory } from \".\";\n\nexport default createRspackPlugin(unpluginFactory);\n"],"mappings":";;;;;AAGA,qBAAe,mBAAmB,gBAAgB"}
@@ -0,0 +1,67 @@
1
+ import { DEFAULT_ENTRY, DEFAULT_OPTIONS, PLUGIN_NAME, RESOLVED_VIRTUAL_CSS_MODULE_ID, RESOLVED_VIRTUAL_TS_MODULE_ID, VIRTUAL_CSS_MODULE_ID, VIRTUAL_TS_MODULE_ID } from "./constants-CnbAL4bY.js";
2
+ import { loadConfigurationFromPath } from "@styleframe/loader";
3
+ import { transpile } from "@styleframe/transpiler";
4
+ import { consola } from "consola";
5
+ import path from "node:path";
6
+ import { createUnplugin } from "unplugin";
7
+
8
+ //#region src/index.ts
9
+ async function loadAndBuildEntry(entry, options) {
10
+ return transpile(await loadConfigurationFromPath(entry), options);
11
+ }
12
+ const unpluginFactory = (options = DEFAULT_OPTIONS) => {
13
+ const rawEntry = options.entry ?? DEFAULT_ENTRY;
14
+ const entries = (typeof rawEntry === "string" ? [rawEntry] : rawEntry).map((p) => path.isAbsolute(p) ? p : path.resolve(process.cwd(), p));
15
+ return {
16
+ name: PLUGIN_NAME,
17
+ enforce: "pre",
18
+ resolveId(id) {
19
+ if (id === VIRTUAL_CSS_MODULE_ID) return RESOLVED_VIRTUAL_CSS_MODULE_ID;
20
+ else if (id === VIRTUAL_TS_MODULE_ID) return RESOLVED_VIRTUAL_TS_MODULE_ID;
21
+ },
22
+ async load(id) {
23
+ if (id === RESOLVED_VIRTUAL_CSS_MODULE_ID || id === RESOLVED_VIRTUAL_TS_MODULE_ID) {
24
+ let hasError = false;
25
+ const type = id.endsWith(".css") ? "css" : "ts";
26
+ if (!options.silent && type === "css") {
27
+ console.log("");
28
+ consola.info(`[styleframe] Building...`);
29
+ }
30
+ const results = [];
31
+ for (const entry of entries) {
32
+ this.addWatchFile(entry);
33
+ try {
34
+ results.push(await loadAndBuildEntry(entry, { type }));
35
+ } catch (error) {
36
+ hasError = true;
37
+ consola.error(`[styleframe] Failed to build: ${entry}`, error);
38
+ }
39
+ }
40
+ const code = results.reduce((acc, result) => acc + "\n" + result.files.reduce((fileAcc, file) => `${fileAcc}\n${file.content}`, ""), "");
41
+ if (!options.silent && type === "css" && !hasError) {
42
+ consola.success(`[styleframe] Built successfully.`);
43
+ console.log("");
44
+ }
45
+ return { code };
46
+ }
47
+ },
48
+ vite: { async handleHotUpdate(ctx) {
49
+ const getModuleById = async (id) => {
50
+ return ctx.server?.moduleGraph.getModuleById(id) ?? await ctx.server?.moduleGraph.getModuleByUrl(id);
51
+ };
52
+ if (entries.includes(ctx.file)) {
53
+ const cssModule = await getModuleById(RESOLVED_VIRTUAL_CSS_MODULE_ID) ?? await getModuleById(VIRTUAL_CSS_MODULE_ID);
54
+ const tsModule = await getModuleById(RESOLVED_VIRTUAL_TS_MODULE_ID) ?? await getModuleById(VIRTUAL_TS_MODULE_ID);
55
+ if (cssModule || tsModule) return [...cssModule ? [cssModule] : [], ...tsModule ? [tsModule] : []];
56
+ ctx.server?.ws.send({ type: "full-reload" });
57
+ }
58
+ return ctx.modules;
59
+ } }
60
+ };
61
+ };
62
+ const unplugin = /* @__PURE__ */ createUnplugin(unpluginFactory);
63
+ var src_default = unplugin;
64
+
65
+ //#endregion
66
+ export { src_default, unplugin, unpluginFactory };
67
+ //# sourceMappingURL=src-mpvRItvZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"src-mpvRItvZ.js","names":["unpluginFactory: UnpluginFactory<Options | undefined>","entries: string[]"],"sources":["../src/index.ts"],"sourcesContent":["import { loadConfigurationFromPath } from \"@styleframe/loader\";\nimport type { TranspileOptions } from \"@styleframe/transpiler\";\nimport { transpile } from \"@styleframe/transpiler\";\nimport { consola } from \"consola\";\nimport path from \"node:path\";\nimport type { UnpluginFactory } from \"unplugin\";\nimport { createUnplugin } from \"unplugin\";\nimport {\n\tDEFAULT_ENTRY,\n\tDEFAULT_OPTIONS,\n\tPLUGIN_NAME,\n\tRESOLVED_VIRTUAL_CSS_MODULE_ID,\n\tRESOLVED_VIRTUAL_TS_MODULE_ID,\n\tVIRTUAL_CSS_MODULE_ID,\n\tVIRTUAL_TS_MODULE_ID,\n} from \"./constants\";\nimport type { Options } from \"./types\";\n\nasync function loadAndBuildEntry(entry: string, options: TranspileOptions) {\n\tconst instance = await loadConfigurationFromPath(entry);\n\n\treturn transpile(instance, options);\n}\n\nexport const unpluginFactory: UnpluginFactory<Options | undefined> = (\n\toptions = DEFAULT_OPTIONS,\n) => {\n\tconst rawEntry = options.entry ?? DEFAULT_ENTRY;\n\tconst entries: string[] = (\n\t\ttypeof rawEntry === \"string\" ? [rawEntry] : rawEntry\n\t).map((p) => (path.isAbsolute(p) ? p : path.resolve(process.cwd(), p)));\n\n\treturn {\n\t\tname: PLUGIN_NAME,\n\t\tenforce: \"pre\",\n\t\tresolveId(id) {\n\t\t\tif (id === VIRTUAL_CSS_MODULE_ID) {\n\t\t\t\treturn RESOLVED_VIRTUAL_CSS_MODULE_ID;\n\t\t\t} else if (id === VIRTUAL_TS_MODULE_ID) {\n\t\t\t\treturn RESOLVED_VIRTUAL_TS_MODULE_ID;\n\t\t\t}\n\t\t},\n\t\tasync load(id) {\n\t\t\tif (\n\t\t\t\tid === RESOLVED_VIRTUAL_CSS_MODULE_ID ||\n\t\t\t\tid === RESOLVED_VIRTUAL_TS_MODULE_ID\n\t\t\t) {\n\t\t\t\tlet hasError = false;\n\t\t\t\tconst type = id.endsWith(\".css\") ? \"css\" : \"ts\";\n\n\t\t\t\tif (!options.silent && type === \"css\") {\n\t\t\t\t\tconsole.log(\"\");\n\t\t\t\t\tconsola.info(`[styleframe] Building...`);\n\t\t\t\t}\n\n\t\t\t\tconst results = [];\n\t\t\t\tfor (const entry of entries) {\n\t\t\t\t\tthis.addWatchFile(entry);\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tresults.push(await loadAndBuildEntry(entry, { type }));\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\thasError = true;\n\t\t\t\t\t\tconsola.error(`[styleframe] Failed to build: ${entry}`, error);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst code = results.reduce(\n\t\t\t\t\t(acc, result) =>\n\t\t\t\t\t\tacc +\n\t\t\t\t\t\t\"\\n\" +\n\t\t\t\t\t\tresult.files.reduce(\n\t\t\t\t\t\t\t(fileAcc, file) => `${fileAcc}\\n${file.content}`,\n\t\t\t\t\t\t\t\"\",\n\t\t\t\t\t\t),\n\t\t\t\t\t\"\",\n\t\t\t\t);\n\n\t\t\t\tif (!options.silent && type === \"css\" && !hasError) {\n\t\t\t\t\tconsola.success(`[styleframe] Built successfully.`);\n\t\t\t\t\tconsole.log(\"\");\n\t\t\t\t}\n\n\t\t\t\treturn { code };\n\t\t\t}\n\t\t},\n\t\tvite: {\n\t\t\tasync handleHotUpdate(ctx) {\n\t\t\t\tconst getModuleById = async (id: string) => {\n\t\t\t\t\tconst mod = ctx.server?.moduleGraph.getModuleById(id);\n\t\t\t\t\treturn mod ?? (await ctx.server?.moduleGraph.getModuleByUrl(id));\n\t\t\t\t};\n\n\t\t\t\t// If a tracked entry changed, rebuild it and invalidate the virtual css module\n\t\t\t\tif (entries.includes(ctx.file)) {\n\t\t\t\t\t// Invalidate the virtual module so HMR pushes the updated css\n\t\t\t\t\tconst cssModule =\n\t\t\t\t\t\t(await getModuleById(RESOLVED_VIRTUAL_CSS_MODULE_ID)) ??\n\t\t\t\t\t\t(await getModuleById(VIRTUAL_CSS_MODULE_ID));\n\n\t\t\t\t\t// Invalidate the virtual module so HMR pushes the updated typescript module\n\t\t\t\t\tconst tsModule =\n\t\t\t\t\t\t(await getModuleById(RESOLVED_VIRTUAL_TS_MODULE_ID)) ??\n\t\t\t\t\t\t(await getModuleById(VIRTUAL_TS_MODULE_ID));\n\n\t\t\t\t\tif (cssModule || tsModule) {\n\t\t\t\t\t\t// Tell Vite that this module is affected\n\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\t...(cssModule ? [cssModule] : []),\n\t\t\t\t\t\t\t...(tsModule ? [tsModule] : []),\n\t\t\t\t\t\t];\n\t\t\t\t\t}\n\t\t\t\t\t// Fall back to a full reload if for some reason we didn’t find the module\n\t\t\t\t\tctx.server?.ws.send({ type: \"full-reload\" });\n\t\t\t\t}\n\n\t\t\t\treturn ctx.modules;\n\t\t\t},\n\t\t},\n\t};\n};\n\nexport const unplugin = /* #__PURE__ */ createUnplugin(unpluginFactory);\n\nexport default unplugin;\n"],"mappings":";;;;;;;;AAkBA,eAAe,kBAAkB,OAAe,SAA2B;AAG1E,QAAO,UAFU,MAAM,0BAA0B,MAAM,EAE5B,QAAQ;;AAGpC,MAAaA,mBACZ,UAAU,oBACN;CACJ,MAAM,WAAW,QAAQ,SAAS;CAClC,MAAMC,WACL,OAAO,aAAa,WAAW,CAAC,SAAS,GAAG,UAC3C,KAAK,MAAO,KAAK,WAAW,EAAE,GAAG,IAAI,KAAK,QAAQ,QAAQ,KAAK,EAAE,EAAE,CAAE;AAEvE,QAAO;EACN,MAAM;EACN,SAAS;EACT,UAAU,IAAI;AACb,OAAI,OAAO,sBACV,QAAO;YACG,OAAO,qBACjB,QAAO;;EAGT,MAAM,KAAK,IAAI;AACd,OACC,OAAO,kCACP,OAAO,+BACN;IACD,IAAI,WAAW;IACf,MAAM,OAAO,GAAG,SAAS,OAAO,GAAG,QAAQ;AAE3C,QAAI,CAAC,QAAQ,UAAU,SAAS,OAAO;AACtC,aAAQ,IAAI,GAAG;AACf,aAAQ,KAAK,2BAA2B;;IAGzC,MAAM,UAAU,EAAE;AAClB,SAAK,MAAM,SAAS,SAAS;AAC5B,UAAK,aAAa,MAAM;AAExB,SAAI;AACH,cAAQ,KAAK,MAAM,kBAAkB,OAAO,EAAE,MAAM,CAAC,CAAC;cAC9C,OAAO;AACf,iBAAW;AACX,cAAQ,MAAM,iCAAiC,SAAS,MAAM;;;IAIhE,MAAM,OAAO,QAAQ,QACnB,KAAK,WACL,MACA,OACA,OAAO,MAAM,QACX,SAAS,SAAS,GAAG,QAAQ,IAAI,KAAK,WACvC,GACA,EACF,GACA;AAED,QAAI,CAAC,QAAQ,UAAU,SAAS,SAAS,CAAC,UAAU;AACnD,aAAQ,QAAQ,mCAAmC;AACnD,aAAQ,IAAI,GAAG;;AAGhB,WAAO,EAAE,MAAM;;;EAGjB,MAAM,EACL,MAAM,gBAAgB,KAAK;GAC1B,MAAM,gBAAgB,OAAO,OAAe;AAE3C,WADY,IAAI,QAAQ,YAAY,cAAc,GAAG,IACtC,MAAM,IAAI,QAAQ,YAAY,eAAe,GAAG;;AAIhE,OAAI,QAAQ,SAAS,IAAI,KAAK,EAAE;IAE/B,MAAM,YACJ,MAAM,cAAc,+BAA+B,IACnD,MAAM,cAAc,sBAAsB;IAG5C,MAAM,WACJ,MAAM,cAAc,8BAA8B,IAClD,MAAM,cAAc,qBAAqB;AAE3C,QAAI,aAAa,SAEhB,QAAO,CACN,GAAI,YAAY,CAAC,UAAU,GAAG,EAAE,EAChC,GAAI,WAAW,CAAC,SAAS,GAAG,EAAE,CAC9B;AAGF,QAAI,QAAQ,GAAG,KAAK,EAAE,MAAM,eAAe,CAAC;;AAG7C,UAAO,IAAI;KAEZ;EACD;;AAGF,MAAa,WAA2B,+BAAe,gBAAgB;AAEvE,kBAAe"}
@@ -0,0 +1,12 @@
1
+ import { TranspileOptions } from "@styleframe/transpiler";
2
+
3
+ //#region src/types.d.ts
4
+ interface Options {
5
+ entry?: string | string[];
6
+ silent?: boolean;
7
+ transpiler?: TranspileOptions;
8
+ }
9
+ //# sourceMappingURL=types.d.ts.map
10
+ //#endregion
11
+ export { Options };
12
+ //# sourceMappingURL=types-Clt7t35T.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-Clt7t35T.d.ts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;UAEiB,OAAA;;EAAA,MAAA,CAAA,EAAA,OAAO;eAGV"}
@@ -0,0 +1,2 @@
1
+ import { Options } from "./types-Clt7t35T.js";
2
+ export { Options };
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,9 @@
1
+ import { unpluginFactory } from "./src-mpvRItvZ.js";
2
+ import { createVitePlugin } from "unplugin";
3
+
4
+ //#region src/vite.ts
5
+ var vite_default = createVitePlugin(unpluginFactory);
6
+
7
+ //#endregion
8
+ export { vite_default };
9
+ //# sourceMappingURL=vite-Cs6rddMM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite-Cs6rddMM.js","names":[],"sources":["../src/vite.ts"],"sourcesContent":["import { createVitePlugin } from \"unplugin\";\nimport { unpluginFactory } from \".\";\n\nexport default createVitePlugin(unpluginFactory);\n"],"mappings":";;;;AAGA,mBAAe,iBAAiB,gBAAgB"}
package/dist/vite.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import { Options } from "./types-Clt7t35T.js";
2
+ import * as unplugin0 from "unplugin";
3
+
4
+ //#region src/vite.d.ts
5
+ declare const _default: (options?: Options | undefined) => unplugin0.VitePlugin<any> | unplugin0.VitePlugin<any>[];
6
+ //#endregion
7
+ export { _default as default };
8
+ //# sourceMappingURL=vite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite.d.ts","names":[],"sources":["../src/vite.ts"],"sourcesContent":[],"mappings":""}
package/dist/vite.js ADDED
@@ -0,0 +1,5 @@
1
+ import "./constants-CnbAL4bY.js";
2
+ import "./src-mpvRItvZ.js";
3
+ import { vite_default } from "./vite-Cs6rddMM.js";
4
+
5
+ export { vite_default as default };
@@ -0,0 +1,9 @@
1
+ import { unpluginFactory } from "./src-mpvRItvZ.js";
2
+ import { createWebpackPlugin } from "unplugin";
3
+
4
+ //#region src/webpack.ts
5
+ var webpack_default = createWebpackPlugin(unpluginFactory);
6
+
7
+ //#endregion
8
+ export { webpack_default };
9
+ //# sourceMappingURL=webpack-D2mM1N3t.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webpack-D2mM1N3t.js","names":[],"sources":["../src/webpack.ts"],"sourcesContent":["import { createWebpackPlugin } from \"unplugin\";\nimport { unpluginFactory } from \".\";\n\nexport default createWebpackPlugin(unpluginFactory);\n"],"mappings":";;;;AAGA,sBAAe,oBAAoB,gBAAgB"}
@@ -0,0 +1,8 @@
1
+ import { Options } from "./types-Clt7t35T.js";
2
+ import * as webpack0 from "webpack";
3
+
4
+ //#region src/webpack.d.ts
5
+ declare const _default: (options?: Options | undefined) => webpack0.WebpackPluginInstance;
6
+ //#endregion
7
+ export { _default as default };
8
+ //# sourceMappingURL=webpack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webpack.d.ts","names":[],"sources":["../src/webpack.ts"],"sourcesContent":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import "./constants-CnbAL4bY.js";
2
+ import "./src-mpvRItvZ.js";
3
+ import { webpack_default } from "./webpack-D2mM1N3t.js";
4
+
5
+ export { webpack_default as default };
package/package.json ADDED
@@ -0,0 +1,116 @@
1
+ {
2
+ "name": "@styleframe/plugin",
3
+ "type": "module",
4
+ "version": "1.0.0",
5
+ "description": "Unplugin for Styleframe. Use it with Vite, Webpack, Astro, Nuxt, Rollup, Rspack, and more.",
6
+ "license": "MIT",
7
+ "keywords": [
8
+ "styleframe",
9
+ "unplugin",
10
+ "astro",
11
+ "nuxt",
12
+ "vite",
13
+ "webpack",
14
+ "rollup",
15
+ "rspack",
16
+ "transform"
17
+ ],
18
+ "exports": {
19
+ ".": "./dist/index.js",
20
+ "./astro": "./dist/astro.js",
21
+ "./esbuild": "./dist/esbuild.js",
22
+ "./farm": "./dist/farm.js",
23
+ "./nuxt": "./dist/nuxt.js",
24
+ "./rollup": "./dist/rollup.js",
25
+ "./rspack": "./dist/rspack.js",
26
+ "./types": "./dist/types.js",
27
+ "./vite": "./dist/vite.js",
28
+ "./webpack": "./dist/webpack.js",
29
+ "./package.json": "./package.json"
30
+ },
31
+ "main": "./dist/index.js",
32
+ "module": "./dist/index.js",
33
+ "types": "./dist/index.d.ts",
34
+ "typesVersions": {
35
+ "*": {
36
+ "*": [
37
+ "./dist/*",
38
+ "./*"
39
+ ]
40
+ }
41
+ },
42
+ "files": [
43
+ "dist"
44
+ ],
45
+ "peerDependencies": {
46
+ "@farmfe/core": ">=1",
47
+ "@nuxt/kit": "^3",
48
+ "@nuxt/schema": "^3",
49
+ "esbuild": "*",
50
+ "rollup": "^3",
51
+ "vite": ">=3",
52
+ "webpack": "^4 || ^5"
53
+ },
54
+ "peerDependenciesMeta": {
55
+ "@farmfe/core": {
56
+ "optional": true
57
+ },
58
+ "@nuxt/kit": {
59
+ "optional": true
60
+ },
61
+ "@nuxt/schema": {
62
+ "optional": true
63
+ },
64
+ "esbuild": {
65
+ "optional": true
66
+ },
67
+ "rollup": {
68
+ "optional": true
69
+ },
70
+ "vite": {
71
+ "optional": true
72
+ },
73
+ "webpack": {
74
+ "optional": true
75
+ }
76
+ },
77
+ "dependencies": {
78
+ "consola": "^3.4.2",
79
+ "unplugin": "^2.3.4",
80
+ "@styleframe/loader": "^1.0.2",
81
+ "@styleframe/transpiler": "^1.0.2"
82
+ },
83
+ "devDependencies": {
84
+ "@vitest/coverage-v8": "^3.2.4",
85
+ "@nuxt/kit": "^3.17.4",
86
+ "@nuxt/schema": "^3.17.4",
87
+ "@types/node": "^22.15.21",
88
+ "nodemon": "^3.1.10",
89
+ "rollup": "^4.41.0",
90
+ "tsdown": "^0.12.0",
91
+ "tsx": "^4.19.4",
92
+ "typescript": "^5.8.3",
93
+ "vite": "^6.3.5",
94
+ "vitest": "^3.1.4",
95
+ "webpack": "^5.99.9",
96
+ "@styleframe/config-typescript": "^1.0.1"
97
+ },
98
+ "homepage": "https://github.com/styleframe-dev/styleframe#readme",
99
+ "bugs": {
100
+ "url": "https://github.com/styleframe-dev/styleframe/issues"
101
+ },
102
+ "repository": {
103
+ "type": "git",
104
+ "url": "git+https://github.com/styleframe-dev/styleframe.git"
105
+ },
106
+ "author": "Alex Grozav <alex@styleframe.dev>",
107
+ "scripts": {
108
+ "build": "tsdown",
109
+ "dev": "tsdown -w",
110
+ "start": "tsx src/index.ts",
111
+ "playground:build": "cd playground && pnpm run build",
112
+ "playground:start": "cd playground && pnpm run start",
113
+ "playground:dev": "cd playground && pnpm run dev",
114
+ "test": "vitest run"
115
+ }
116
+ }