@styleframe/plugin 2.3.1 → 2.4.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # @styleframe/plugin
2
2
 
3
+ ## 2.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#113](https://github.com/styleframe-dev/styleframe/pull/113) [`b73095f`](https://github.com/styleframe-dev/styleframe/commit/b73095f114ef41158ab552e2784500215393b294) Thanks [@alexgrozav](https://github.com/alexgrozav)! - Improve color previews and HMR handling
8
+ - Fix caching configuration in loader to use fsCache and moduleCache options
9
+ - Add HMR refetch handling for .styleframe.css virtual imports
10
+ - Update SwatchCard styling with proper footer alignment and better contrast
11
+
12
+ - [#111](https://github.com/styleframe-dev/styleframe/pull/111) [`152d221`](https://github.com/styleframe-dev/styleframe/commit/152d221934ed3c86e76c31229a8925152081243c) Thanks [@alexgrozav](https://github.com/alexgrozav)! - Fix HMR for virtual imports by normalizing file paths and adding fallback full-reload
13
+
14
+ - Updated dependencies [[`b73095f`](https://github.com/styleframe-dev/styleframe/commit/b73095f114ef41158ab552e2784500215393b294)]:
15
+ - @styleframe/loader@2.4.1
16
+
17
+ ## 2.4.0
18
+
19
+ ### Minor Changes
20
+
21
+ - [#96](https://github.com/styleframe-dev/styleframe/pull/96) [`8460f16`](https://github.com/styleframe-dev/styleframe/commit/8460f169cec1199810e9203b357dac9f2f128c56) Thanks [@alexgrozav](https://github.com/alexgrozav)! - Rename `?recipe` imports to `?ts` and add named selector export support
22
+ - **Breaking:** Renamed import query parameter from `?recipe` to `?ts` for styleframe files
23
+ - Add support for exporting named selectors alongside recipes via `?ts` imports
24
+ - Add `_exportName` property to `Selector` and `Recipe` types for tracking named exports
25
+ - Replace `c12` with `chokidar` + `jiti` for simpler, more reliable config loading
26
+ - Add `onError` callback to `watchConfiguration` for error reporting during file watch
27
+ - Add file deletion detection with `unlink` handler in watch mode
28
+ - Simplify `loadConfiguration` API by merging `loadConfigurationFromPath`
29
+ - Add comprehensive unit tests for TypeScript selector consumer
30
+
31
+ ### Patch Changes
32
+
33
+ - [`4e06424`](https://github.com/styleframe-dev/styleframe/commit/4e064245e78903307e6996eebf3f6dae5565de5f) Thanks [@alexgrozav](https://github.com/alexgrozav)! - fix: add Nuxt 4 compatibility
34
+
35
+ Updated `@nuxt/kit` and `@nuxt/schema` dependencies to v4.1.3 via the nuxt catalog. Peer dependencies now accept both `^3 || ^4` to support Nuxt 3 and Nuxt 4 projects.
36
+
37
+ - Updated dependencies [[`8460f16`](https://github.com/styleframe-dev/styleframe/commit/8460f169cec1199810e9203b357dac9f2f128c56)]:
38
+ - @styleframe/loader@2.4.0
39
+ - @styleframe/transpiler@2.6.0
40
+
3
41
  ## 2.3.1
4
42
 
5
43
  ### Patch Changes
package/dist/astro.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./constants-CnbAL4bY.js";
2
- import { src_default } from "./src-DVgZLQc5.js";
2
+ import { src_default } from "./src-4YtKkWMH.js";
3
3
 
4
4
  //#region src/astro.ts
5
5
  var astro_default = (options) => ({
package/dist/esbuild.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./constants-CnbAL4bY.js";
2
- import { unpluginFactory } from "./src-DVgZLQc5.js";
2
+ import { unpluginFactory } from "./src-4YtKkWMH.js";
3
3
  import { createEsbuildPlugin } from "unplugin";
4
4
 
5
5
  //#region src/esbuild.ts
package/dist/farm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./constants-CnbAL4bY.js";
2
- import { unpluginFactory } from "./src-DVgZLQc5.js";
2
+ import { unpluginFactory } from "./src-4YtKkWMH.js";
3
3
  import { createFarmPlugin } from "unplugin";
4
4
 
5
5
  //#region src/farm.ts
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { Options } from "./types-Clt7t35T.js";
2
- import * as unplugin2 from "unplugin";
2
+ import * as unplugin0 from "unplugin";
3
3
  import { UnpluginFactory } from "unplugin";
4
4
 
5
5
  //#region src/index.d.ts
6
6
  declare const unpluginFactory: UnpluginFactory<Options | undefined>;
7
- declare const unplugin: unplugin2.UnpluginInstance<Options | undefined, boolean>;
7
+ declare const unplugin: unplugin0.UnpluginInstance<Options | undefined, boolean>;
8
8
  //#endregion
9
9
  export { unplugin as default, unplugin, unpluginFactory };
10
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;cAiJa,iBAAiB,gBAAgB;cAiLjC,UAAQ,SAAA,CAAA,iBAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;cAiJa,iBAAiB,gBAAgB;cA2LjC,UAAQ,SAAA,CAAA,iBAAA"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import "./constants-CnbAL4bY.js";
2
- import { src_default, unplugin, unpluginFactory } from "./src-DVgZLQc5.js";
2
+ import { src_default, unplugin, unpluginFactory } from "./src-4YtKkWMH.js";
3
3
 
4
4
  export { src_default as default, unplugin, unpluginFactory };
package/dist/nuxt.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import "./constants-CnbAL4bY.js";
2
- import "./src-DVgZLQc5.js";
3
- import { vite_default } from "./vite-D0xhCTaK.js";
4
- import { webpack_default } from "./webpack-D755lXgr.js";
2
+ import "./src-4YtKkWMH.js";
3
+ import { vite_default } from "./vite-BY9qXnXW.js";
4
+ import { webpack_default } from "./webpack-DpR7fAjO.js";
5
5
  import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from "@nuxt/kit";
6
6
 
7
7
  //#region src/nuxt.ts
package/dist/rollup.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./constants-CnbAL4bY.js";
2
- import { unpluginFactory } from "./src-DVgZLQc5.js";
2
+ import { unpluginFactory } from "./src-4YtKkWMH.js";
3
3
  import { createRollupPlugin } from "unplugin";
4
4
 
5
5
  //#region src/rollup.ts
package/dist/rspack.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./constants-CnbAL4bY.js";
2
- import { unpluginFactory } from "./src-DVgZLQc5.js";
2
+ import { unpluginFactory } from "./src-4YtKkWMH.js";
3
3
  import { createRspackPlugin } from "unplugin";
4
4
 
5
5
  //#region src/rspack.ts
@@ -1,7 +1,7 @@
1
1
  import { DEFAULT_ENTRY, DEFAULT_OPTIONS, 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
2
  import path from "node:path";
3
3
  import { getLicenseKeyFromEnv, validateInstanceLicense } from "@styleframe/license";
4
- import { loadConfigurationFromPath } from "@styleframe/loader";
4
+ import { loadConfiguration } from "@styleframe/loader";
5
5
  import { transpile } from "@styleframe/transpiler";
6
6
  import { consola } from "consola";
7
7
  import { transform } from "esbuild";
@@ -12,7 +12,7 @@ const STYLEFRAME_SOURCE_REGEX = /\.styleframe\.ts$/;
12
12
  const STYLEFRAME_CSS_VIRTUAL_PREFIX = `${ROLLUP_V_PREFIX}styleframe.css:`;
13
13
  const STYLEFRAME_TS_VIRTUAL_PREFIX = `${ROLLUP_V_PREFIX}styleframe.ts:`;
14
14
  async function loadAndBuildEntry(entry, options, isBuild) {
15
- const instance = await loadConfigurationFromPath(entry);
15
+ const instance = await loadConfiguration({ entry });
16
16
  await validateInstanceLicense(instance, {
17
17
  licenseKey: getLicenseKeyFromEnv() || "",
18
18
  environment: process.env.NODE_ENV || "development",
@@ -79,9 +79,10 @@ const unpluginFactory = (options = DEFAULT_OPTIONS) => {
79
79
  if (id === VIRTUAL_CSS_MODULE_ID) return RESOLVED_VIRTUAL_CSS_MODULE_ID;
80
80
  else if (id === VIRTUAL_TS_MODULE_ID) return RESOLVED_VIRTUAL_TS_MODULE_ID;
81
81
  const [pathPart, queryPart] = id.split("?");
82
+ if (pathPart?.endsWith(".styleframe.css")) return getResolvedVirtualId(resolveSourcePath(pathPart.replace(/\.css$/, ".ts"), importer), "css");
82
83
  if (!pathPart || !/\.styleframe(\.ts)?$/.test(pathPart)) return null;
83
84
  const isCss = queryPart === "css";
84
- if (!isCss && !(queryPart === "recipe")) return null;
85
+ if (!isCss && !(queryPart === "ts")) return null;
85
86
  let sourceFile = pathPart;
86
87
  if (!sourceFile.endsWith(".ts")) sourceFile += ".ts";
87
88
  const resolvedSourcePath = resolveSourcePath(sourceFile, importer);
@@ -137,7 +138,8 @@ const unpluginFactory = (options = DEFAULT_OPTIONS) => {
137
138
  ctx.server?.ws.send({ type: "full-reload" });
138
139
  }
139
140
  if (isStyleframeSourceFile(ctx.file)) {
140
- const virtualModuleIds = sourceToVirtualModules.get(ctx.file);
141
+ const normalizedFile = path.resolve(ctx.file);
142
+ const virtualModuleIds = sourceToVirtualModules.get(normalizedFile);
141
143
  if (virtualModuleIds && virtualModuleIds.size > 0) {
142
144
  const modulesToInvalidate = [];
143
145
  for (const virtualId of virtualModuleIds) {
@@ -157,4 +159,4 @@ var src_default = unplugin;
157
159
 
158
160
  //#endregion
159
161
  export { src_default, unplugin, unpluginFactory };
160
- //# sourceMappingURL=src-DVgZLQc5.js.map
162
+ //# sourceMappingURL=src-4YtKkWMH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"src-4YtKkWMH.js","names":["unpluginFactory: UnpluginFactory<Options | undefined>","entries: string[]","esbuildTransform"],"sources":["../src/index.ts"],"sourcesContent":["import path from \"node:path\";\nimport {\n\tgetLicenseKeyFromEnv,\n\tvalidateInstanceLicense,\n} from \"@styleframe/license\";\nimport { loadConfiguration } from \"@styleframe/loader\";\nimport type { TranspileOptions } from \"@styleframe/transpiler\";\nimport { transpile } from \"@styleframe/transpiler\";\nimport { consola } from \"consola\";\nimport { transform as esbuildTransform } from \"esbuild\";\nimport type { UnpluginBuildContext, 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\tROLLUP_V_PREFIX,\n\tVIRTUAL_CSS_MODULE_ID,\n\tVIRTUAL_TS_MODULE_ID,\n} from \"./constants\";\nimport type { Options } from \"./types\";\n\n// Matches the source file: ./button.styleframe.ts\nconst STYLEFRAME_SOURCE_REGEX = /\\.styleframe\\.ts$/;\n\n// Virtual module prefixes for styleframe files\nconst STYLEFRAME_CSS_VIRTUAL_PREFIX = `${ROLLUP_V_PREFIX}styleframe.css:`;\nconst STYLEFRAME_TS_VIRTUAL_PREFIX = `${ROLLUP_V_PREFIX}styleframe.ts:`;\n\nasync function loadAndBuildEntry(\n\tentry: string,\n\toptions: TranspileOptions,\n\tisBuild: boolean,\n) {\n\tconst instance = await loadConfiguration({ entry });\n\n\tawait validateInstanceLicense(instance, {\n\t\tlicenseKey: getLicenseKeyFromEnv() || \"\",\n\t\tenvironment: process.env.NODE_ENV || \"development\",\n\t\tisBuild,\n\t});\n\n\treturn transpile(instance, options);\n}\n\nfunction isStyleframeSourceFile(id: string): boolean {\n\treturn STYLEFRAME_SOURCE_REGEX.test(id);\n}\n\nfunction getResolvedVirtualId(filePath: string, type: \"css\" | \"ts\"): string {\n\tconst prefix =\n\t\ttype === \"css\"\n\t\t\t? STYLEFRAME_CSS_VIRTUAL_PREFIX\n\t\t\t: STYLEFRAME_TS_VIRTUAL_PREFIX;\n\t// Change extension based on output type for proper handling by Vite/Rollup\n\t// CSS virtual modules end in .css, TS virtual modules end in .ts\n\tconst outputPath =\n\t\ttype === \"css\" ? filePath.replace(/\\.ts$/, \".css\") : filePath;\n\treturn `${prefix}${outputPath}`;\n}\n\nfunction parseVirtualId(\n\tid: string,\n): { type: \"css\" | \"ts\"; filePath: string } | null {\n\tif (id.startsWith(STYLEFRAME_CSS_VIRTUAL_PREFIX)) {\n\t\treturn {\n\t\t\ttype: \"css\",\n\t\t\t// Convert back to source .ts path\n\t\t\tfilePath: id\n\t\t\t\t.slice(STYLEFRAME_CSS_VIRTUAL_PREFIX.length)\n\t\t\t\t.replace(/\\.css$/, \".ts\"),\n\t\t};\n\t}\n\tif (id.startsWith(STYLEFRAME_TS_VIRTUAL_PREFIX)) {\n\t\treturn {\n\t\t\ttype: \"ts\",\n\t\t\tfilePath: id.slice(STYLEFRAME_TS_VIRTUAL_PREFIX.length),\n\t\t};\n\t}\n\treturn null;\n}\n\nfunction resolveSourcePath(file: string, importer?: string): string {\n\tif (path.isAbsolute(file)) {\n\t\treturn file;\n\t}\n\tif (importer) {\n\t\treturn path.resolve(path.dirname(importer), file);\n\t}\n\treturn path.resolve(process.cwd(), file);\n}\n\nasync function buildEntries(\n\tctx: UnpluginBuildContext,\n\tentries: string[],\n\ttype: \"css\" | \"ts\",\n\toutputName: string,\n\toptions: Options,\n\tisBuildCommand: boolean,\n) {\n\tlet hasError = false;\n\tconst isGlobalConfig = outputName.startsWith(\"styleframe.config\");\n\n\tif (!options.silent) {\n\t\tif (isGlobalConfig) {\n\t\t\tconsole.log(\"\");\n\t\t}\n\t\tconsola.info(`[styleframe] Building ${outputName}...`);\n\t}\n\n\tconst results = [];\n\tfor (const entry of entries) {\n\t\tctx.addWatchFile(entry);\n\n\t\ttry {\n\t\t\tresults.push(await loadAndBuildEntry(entry, { type }, isBuildCommand));\n\t\t} catch (error) {\n\t\t\thasError = true;\n\t\t\tconsola.error(`[styleframe] Failed to build: ${entry}`, error);\n\t\t\tif (!isGlobalConfig) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t}\n\n\tconst code = results.reduce(\n\t\t(acc, result) =>\n\t\t\tacc +\n\t\t\t\"\\n\" +\n\t\t\tresult.files.reduce((fileAcc, file) => `${fileAcc}\\n${file.content}`, \"\"),\n\t\t\"\",\n\t);\n\n\tif (!options.silent && !hasError) {\n\t\tconsola.success(`[styleframe] Built ${outputName} successfully.`);\n\t\tif (isGlobalConfig) {\n\t\t\tconsole.log(\"\");\n\t\t}\n\t}\n\n\treturn { code };\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\tlet isBuildCommand = false;\n\n\t// Track styleframe source files and their virtual module mappings\n\tconst sourceToVirtualModules = new Map<string, Set<string>>();\n\n\treturn {\n\t\tname: PLUGIN_NAME,\n\t\tenforce: \"pre\",\n\t\tresolveId(id, importer) {\n\t\t\t// Handle existing virtual modules\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\n\t\t\t// Parse query parameters\n\t\t\tconst [pathPart, queryPart] = id.split(\"?\");\n\n\t\t\t// Handle HMR refetch requests for .styleframe.css files\n\t\t\t// These come in as \"SwatchCard.styleframe.css?t=123456\"\n\t\t\tif (pathPart?.endsWith(\".styleframe.css\")) {\n\t\t\t\tconst sourceFile = pathPart.replace(/\\.css$/, \".ts\");\n\t\t\t\tconst resolvedSourcePath = resolveSourcePath(sourceFile, importer);\n\t\t\t\treturn getResolvedVirtualId(resolvedSourcePath, \"css\");\n\t\t\t}\n\n\t\t\t// Only handle .styleframe files with specific queries\n\t\t\t// .styleframe or .styleframe.ts\n\t\t\tif (!pathPart || !/\\.styleframe(\\.ts)?$/.test(pathPart)) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst isCss = queryPart === \"css\";\n\t\t\tconst isTs = queryPart === \"ts\";\n\n\t\t\tif (!isCss && !isTs) {\n\t\t\t\t// Pass through for default resolution (e.g. importing the instance itself)\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t// Resolve the source file path\n\t\t\tlet sourceFile = pathPart;\n\t\t\tif (!sourceFile.endsWith(\".ts\")) {\n\t\t\t\tsourceFile += \".ts\";\n\t\t\t}\n\n\t\t\tconst resolvedSourcePath = resolveSourcePath(sourceFile, importer);\n\t\t\tconst type = isCss ? \"css\" : \"ts\";\n\t\t\tconst virtualId = getResolvedVirtualId(resolvedSourcePath, type);\n\n\t\t\t// Track the mapping for HMR\n\t\t\tlet modules = sourceToVirtualModules.get(resolvedSourcePath);\n\t\t\tif (!modules) {\n\t\t\t\tmodules = new Set();\n\t\t\t\tsourceToVirtualModules.set(resolvedSourcePath, modules);\n\t\t\t}\n\t\t\tmodules.add(virtualId);\n\n\t\t\treturn virtualId;\n\t\t},\n\t\tbuildStart() {\n\t\t\tisBuildCommand = process.argv.includes(\"build\");\n\t\t},\n\t\tasync load(id) {\n\t\t\t// Handle existing virtual CSS/TS modules\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\tconst type = id.endsWith(\".css\") ? \"css\" : \"ts\";\n\t\t\t\treturn buildEntries(\n\t\t\t\t\tthis,\n\t\t\t\t\tentries,\n\t\t\t\t\ttype,\n\t\t\t\t\t`styleframe.config.${type}`,\n\t\t\t\t\toptions,\n\t\t\t\t\tisBuildCommand,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Handle .styleframe virtual modules\n\t\t\tconst parsed = parseVirtualId(id);\n\t\t\tif (parsed) {\n\t\t\t\tconst { type, filePath } = parsed;\n\t\t\t\tconst relativePath = path.relative(process.cwd(), filePath);\n\t\t\t\tconst consolePath =\n\t\t\t\t\ttype === \"css\" ? relativePath.replace(\".ts\", \".css\") : relativePath;\n\n\t\t\t\treturn buildEntries(\n\t\t\t\t\tthis,\n\t\t\t\t\t[filePath],\n\t\t\t\t\ttype,\n\t\t\t\t\tconsolePath,\n\t\t\t\t\toptions,\n\t\t\t\t\tisBuildCommand,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn null;\n\t\t},\n\t\tvite: {\n\t\t\tasync transform(code, id) {\n\t\t\t\t// Transform TypeScript virtual modules since Vite's esbuild doesn't process them\n\t\t\t\tconst isVirtualTsModule =\n\t\t\t\t\tid === RESOLVED_VIRTUAL_TS_MODULE_ID ||\n\t\t\t\t\tid.startsWith(STYLEFRAME_TS_VIRTUAL_PREFIX);\n\n\t\t\t\tif (isVirtualTsModule) {\n\t\t\t\t\tconst result = await esbuildTransform(code, {\n\t\t\t\t\t\tloader: \"ts\",\n\t\t\t\t\t\tformat: \"esm\",\n\t\t\t\t\t\ttarget: \"esnext\",\n\t\t\t\t\t});\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcode: result.code,\n\t\t\t\t\t\tmap: result.map || null,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\treturn null;\n\t\t\t},\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\t// Handle HMR for .styleframe.ts source files\n\t\t\t\tif (isStyleframeSourceFile(ctx.file)) {\n\t\t\t\t\t// Normalize path to match keys in sourceToVirtualModules (resolveSourcePath returns resolved absolute paths)\n\t\t\t\t\tconst normalizedFile = path.resolve(ctx.file);\n\t\t\t\t\tconst virtualModuleIds = sourceToVirtualModules.get(normalizedFile);\n\n\t\t\t\t\tif (virtualModuleIds && virtualModuleIds.size > 0) {\n\t\t\t\t\t\tconst modulesToInvalidate = [];\n\n\t\t\t\t\t\tfor (const virtualId of virtualModuleIds) {\n\t\t\t\t\t\t\tconst virtualModule = await getModuleById(virtualId);\n\t\t\t\t\t\t\tif (virtualModule) {\n\t\t\t\t\t\t\t\tmodulesToInvalidate.push(virtualModule);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (modulesToInvalidate.length > 0) {\n\t\t\t\t\t\t\treturn modulesToInvalidate;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\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":";;;;;;;;;;AAyBA,MAAM,0BAA0B;AAGhC,MAAM,gCAAgC,GAAG,gBAAgB;AACzD,MAAM,+BAA+B,GA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qBAAqB;AAE3C,SAAI,aAAa,SAEhB,QAAO,CACN,GAAI,YAAY,CAAC,UAAU,GAAG,EAAE,EAChC,GAAI,WAAW,CAAC,SAAS,GAAG,EAAE,CAC9B;AAGF,SAAI,QAAQ,GAAG,KAAK,EAAE,MAAM,eAAe,CAAC;;AAI7C,QAAI,uBAAuB,IAAI,KAAK,EAAE;KAErC,MAAM,iBAAiB,KAAK,QAAQ,IAAI,KAAK;KAC7C,MAAM,mBAAmB,uBAAuB,IAAI,eAAe;AAEnE,SAAI,oBAAoB,iBAAiB,OAAO,GAAG;MAClD,MAAM,sBAAsB,EAAE;AAE9B,WAAK,MAAM,aAAa,kBAAkB;OACzC,MAAM,gBAAgB,MAAM,cAAc,UAAU;AACpD,WAAI,cACH,qBAAoB,KAAK,cAAc;;AAIzC,UAAI,oBAAoB,SAAS,EAChC,QAAO;;;AAKV,WAAO,IAAI;;GAEZ;EACD;;AAGF,MAAa,WAA2B,+BAAe,gBAAgB;AAEvE,kBAAe"}
@@ -1,4 +1,4 @@
1
- import { unpluginFactory } from "./src-DVgZLQc5.js";
1
+ import { unpluginFactory } from "./src-4YtKkWMH.js";
2
2
  import { createVitePlugin } from "unplugin";
3
3
 
4
4
  //#region src/vite.ts
@@ -6,4 +6,4 @@ var vite_default = createVitePlugin(unpluginFactory);
6
6
 
7
7
  //#endregion
8
8
  export { vite_default };
9
- //# sourceMappingURL=vite-D0xhCTaK.js.map
9
+ //# sourceMappingURL=vite-BY9qXnXW.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"vite-D0xhCTaK.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"}
1
+ {"version":3,"file":"vite-BY9qXnXW.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 CHANGED
@@ -1,8 +1,8 @@
1
1
  import { Options } from "./types-Clt7t35T.js";
2
- import * as unplugin0 from "unplugin";
2
+ import * as unplugin1 from "unplugin";
3
3
 
4
4
  //#region src/vite.d.ts
5
- declare const _default: (options?: Options | undefined) => unplugin0.VitePlugin<any> | unplugin0.VitePlugin<any>[];
5
+ declare const _default: (options?: Options | undefined) => unplugin1.VitePlugin<any> | unplugin1.VitePlugin<any>[];
6
6
  //#endregion
7
7
  export { _default as default };
8
8
  //# sourceMappingURL=vite.d.ts.map
package/dist/vite.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./constants-CnbAL4bY.js";
2
- import "./src-DVgZLQc5.js";
3
- import { vite_default } from "./vite-D0xhCTaK.js";
2
+ import "./src-4YtKkWMH.js";
3
+ import { vite_default } from "./vite-BY9qXnXW.js";
4
4
 
5
5
  export { vite_default as default };
@@ -1,4 +1,4 @@
1
- import { unpluginFactory } from "./src-DVgZLQc5.js";
1
+ import { unpluginFactory } from "./src-4YtKkWMH.js";
2
2
  import { createWebpackPlugin } from "unplugin";
3
3
 
4
4
  //#region src/webpack.ts
@@ -6,4 +6,4 @@ var webpack_default = createWebpackPlugin(unpluginFactory);
6
6
 
7
7
  //#endregion
8
8
  export { webpack_default };
9
- //# sourceMappingURL=webpack-D755lXgr.js.map
9
+ //# sourceMappingURL=webpack-DpR7fAjO.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"webpack-D755lXgr.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"}
1
+ {"version":3,"file":"webpack-DpR7fAjO.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"}
package/dist/webpack.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { Options } from "./types-Clt7t35T.js";
2
- import * as unplugin1 from "unplugin";
2
+ import * as unplugin0 from "unplugin";
3
3
 
4
4
  //#region src/webpack.d.ts
5
- declare const _default: (options?: Options | undefined) => unplugin1.WebpackPluginInstance;
5
+ declare const _default: (options?: Options | undefined) => unplugin0.WebpackPluginInstance;
6
6
  //#endregion
7
7
  export { _default as default };
8
8
  //# sourceMappingURL=webpack.d.ts.map
package/dist/webpack.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./constants-CnbAL4bY.js";
2
- import "./src-DVgZLQc5.js";
3
- import { webpack_default } from "./webpack-D755lXgr.js";
2
+ import "./src-4YtKkWMH.js";
3
+ import { webpack_default } from "./webpack-DpR7fAjO.js";
4
4
 
5
5
  export { webpack_default as default };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@styleframe/plugin",
3
3
  "type": "module",
4
- "version": "2.3.1",
4
+ "version": "2.4.1",
5
5
  "description": "Unplugin for Styleframe. Use it with Vite, Webpack, Astro, Nuxt, Rollup, Rspack, and more.",
6
6
  "license": "MIT",
7
7
  "keywords": [
@@ -78,15 +78,16 @@
78
78
  }
79
79
  },
80
80
  "dependencies": {
81
- "@styleframe/license": "^2.0.0",
82
- "@styleframe/loader": "^2.3.0",
83
- "@styleframe/transpiler": "^2.5.0",
81
+ "@styleframe/license": "^2.0.2",
82
+ "@styleframe/loader": "^2.4.1",
83
+ "@styleframe/transpiler": "^2.6.0",
84
84
  "consola": "^3.4.2",
85
85
  "unplugin": "^2.3.4"
86
86
  },
87
87
  "devDependencies": {
88
88
  "@farmfe/core": "^1.7.11",
89
89
  "@styleframe/config-typescript": "^2",
90
+ "@styleframe/core": "^2.5.0",
90
91
  "@vitest/coverage-v8": "^3.2.4",
91
92
  "@nuxt/kit": "4.1.3",
92
93
  "@nuxt/schema": "4.1.3",
@@ -1 +0,0 @@
1
- {"version":3,"file":"src-DVgZLQc5.js","names":["unpluginFactory: UnpluginFactory<Options | undefined>","entries: string[]","esbuildTransform"],"sources":["../src/index.ts"],"sourcesContent":["import path from \"node:path\";\nimport {\n\tgetLicenseKeyFromEnv,\n\tvalidateInstanceLicense,\n} from \"@styleframe/license\";\nimport { loadConfigurationFromPath } from \"@styleframe/loader\";\nimport type { TranspileOptions } from \"@styleframe/transpiler\";\nimport { transpile } from \"@styleframe/transpiler\";\nimport { consola } from \"consola\";\nimport { transform as esbuildTransform } from \"esbuild\";\nimport type { UnpluginBuildContext, 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\tROLLUP_V_PREFIX,\n\tVIRTUAL_CSS_MODULE_ID,\n\tVIRTUAL_TS_MODULE_ID,\n} from \"./constants\";\nimport type { Options } from \"./types\";\n\n// Matches the source file: ./button.styleframe.ts\nconst STYLEFRAME_SOURCE_REGEX = /\\.styleframe\\.ts$/;\n\n// Virtual module prefixes for styleframe files\nconst STYLEFRAME_CSS_VIRTUAL_PREFIX = `${ROLLUP_V_PREFIX}styleframe.css:`;\nconst STYLEFRAME_TS_VIRTUAL_PREFIX = `${ROLLUP_V_PREFIX}styleframe.ts:`;\n\nasync function loadAndBuildEntry(\n\tentry: string,\n\toptions: TranspileOptions,\n\tisBuild: boolean,\n) {\n\tconst instance = await loadConfigurationFromPath(entry);\n\n\tawait validateInstanceLicense(instance, {\n\t\tlicenseKey: getLicenseKeyFromEnv() || \"\",\n\t\tenvironment: process.env.NODE_ENV || \"development\",\n\t\tisBuild,\n\t});\n\n\treturn transpile(instance, options);\n}\n\nfunction isStyleframeSourceFile(id: string): boolean {\n\treturn STYLEFRAME_SOURCE_REGEX.test(id);\n}\n\nfunction getResolvedVirtualId(filePath: string, type: \"css\" | \"ts\"): string {\n\tconst prefix =\n\t\ttype === \"css\"\n\t\t\t? STYLEFRAME_CSS_VIRTUAL_PREFIX\n\t\t\t: STYLEFRAME_TS_VIRTUAL_PREFIX;\n\t// Change extension based on output type for proper handling by Vite/Rollup\n\t// CSS virtual modules end in .css, TS virtual modules end in .ts\n\tconst outputPath =\n\t\ttype === \"css\" ? filePath.replace(/\\.ts$/, \".css\") : filePath;\n\treturn `${prefix}${outputPath}`;\n}\n\nfunction parseVirtualId(\n\tid: string,\n): { type: \"css\" | \"ts\"; filePath: string } | null {\n\tif (id.startsWith(STYLEFRAME_CSS_VIRTUAL_PREFIX)) {\n\t\treturn {\n\t\t\ttype: \"css\",\n\t\t\t// Convert back to source .ts path\n\t\t\tfilePath: id\n\t\t\t\t.slice(STYLEFRAME_CSS_VIRTUAL_PREFIX.length)\n\t\t\t\t.replace(/\\.css$/, \".ts\"),\n\t\t};\n\t}\n\tif (id.startsWith(STYLEFRAME_TS_VIRTUAL_PREFIX)) {\n\t\treturn {\n\t\t\ttype: \"ts\",\n\t\t\tfilePath: id.slice(STYLEFRAME_TS_VIRTUAL_PREFIX.length),\n\t\t};\n\t}\n\treturn null;\n}\n\nfunction resolveSourcePath(file: string, importer?: string): string {\n\tif (path.isAbsolute(file)) {\n\t\treturn file;\n\t}\n\tif (importer) {\n\t\treturn path.resolve(path.dirname(importer), file);\n\t}\n\treturn path.resolve(process.cwd(), file);\n}\n\nasync function buildEntries(\n\tctx: UnpluginBuildContext,\n\tentries: string[],\n\ttype: \"css\" | \"ts\",\n\toutputName: string,\n\toptions: Options,\n\tisBuildCommand: boolean,\n) {\n\tlet hasError = false;\n\tconst isGlobalConfig = outputName.startsWith(\"styleframe.config\");\n\n\tif (!options.silent) {\n\t\tif (isGlobalConfig) {\n\t\t\tconsole.log(\"\");\n\t\t}\n\t\tconsola.info(`[styleframe] Building ${outputName}...`);\n\t}\n\n\tconst results = [];\n\tfor (const entry of entries) {\n\t\tctx.addWatchFile(entry);\n\n\t\ttry {\n\t\t\tresults.push(await loadAndBuildEntry(entry, { type }, isBuildCommand));\n\t\t} catch (error) {\n\t\t\thasError = true;\n\t\t\tconsola.error(`[styleframe] Failed to build: ${entry}`, error);\n\t\t\tif (!isGlobalConfig) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t}\n\n\tconst code = results.reduce(\n\t\t(acc, result) =>\n\t\t\tacc +\n\t\t\t\"\\n\" +\n\t\t\tresult.files.reduce((fileAcc, file) => `${fileAcc}\\n${file.content}`, \"\"),\n\t\t\"\",\n\t);\n\n\tif (!options.silent && !hasError) {\n\t\tconsola.success(`[styleframe] Built ${outputName} successfully.`);\n\t\tif (isGlobalConfig) {\n\t\t\tconsole.log(\"\");\n\t\t}\n\t}\n\n\treturn { code };\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\tlet isBuildCommand = false;\n\n\t// Track styleframe source files and their virtual module mappings\n\tconst sourceToVirtualModules = new Map<string, Set<string>>();\n\n\treturn {\n\t\tname: PLUGIN_NAME,\n\t\tenforce: \"pre\",\n\t\tresolveId(id, importer) {\n\t\t\t// Handle existing virtual modules\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\n\t\t\t// Parse query parameters\n\t\t\tconst [pathPart, queryPart] = id.split(\"?\");\n\n\t\t\t// Only handle .styleframe files with specific queries\n\t\t\t// .styleframe or .styleframe.ts\n\t\t\tif (!pathPart || !/\\.styleframe(\\.ts)?$/.test(pathPart)) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst isCss = queryPart === \"css\";\n\t\t\tconst isRecipe = queryPart === \"recipe\";\n\n\t\t\tif (!isCss && !isRecipe) {\n\t\t\t\t// Pass through for default resolution (e.g. importing the instance itself)\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t// Resolve the source file path\n\t\t\tlet sourceFile = pathPart;\n\t\t\tif (!sourceFile.endsWith(\".ts\")) {\n\t\t\t\tsourceFile += \".ts\";\n\t\t\t}\n\n\t\t\tconst resolvedSourcePath = resolveSourcePath(sourceFile, importer);\n\t\t\tconst type = isCss ? \"css\" : \"ts\";\n\t\t\tconst virtualId = getResolvedVirtualId(resolvedSourcePath, type);\n\n\t\t\t// Track the mapping for HMR\n\t\t\tlet modules = sourceToVirtualModules.get(resolvedSourcePath);\n\t\t\tif (!modules) {\n\t\t\t\tmodules = new Set();\n\t\t\t\tsourceToVirtualModules.set(resolvedSourcePath, modules);\n\t\t\t}\n\t\t\tmodules.add(virtualId);\n\n\t\t\treturn virtualId;\n\t\t},\n\t\tbuildStart() {\n\t\t\tisBuildCommand = process.argv.includes(\"build\");\n\t\t},\n\t\tasync load(id) {\n\t\t\t// Handle existing virtual CSS/TS modules\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\tconst type = id.endsWith(\".css\") ? \"css\" : \"ts\";\n\t\t\t\treturn buildEntries(\n\t\t\t\t\tthis,\n\t\t\t\t\tentries,\n\t\t\t\t\ttype,\n\t\t\t\t\t`styleframe.config.${type}`,\n\t\t\t\t\toptions,\n\t\t\t\t\tisBuildCommand,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Handle .styleframe virtual modules\n\t\t\tconst parsed = parseVirtualId(id);\n\t\t\tif (parsed) {\n\t\t\t\tconst { type, filePath } = parsed;\n\t\t\t\tconst relativePath = path.relative(process.cwd(), filePath);\n\t\t\t\tconst consolePath =\n\t\t\t\t\ttype === \"css\" ? relativePath.replace(\".ts\", \".css\") : relativePath;\n\n\t\t\t\treturn buildEntries(\n\t\t\t\t\tthis,\n\t\t\t\t\t[filePath],\n\t\t\t\t\ttype,\n\t\t\t\t\tconsolePath,\n\t\t\t\t\toptions,\n\t\t\t\t\tisBuildCommand,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn null;\n\t\t},\n\t\tvite: {\n\t\t\tasync transform(code, id) {\n\t\t\t\t// Transform TypeScript virtual modules since Vite's esbuild doesn't process them\n\t\t\t\tconst isVirtualTsModule =\n\t\t\t\t\tid === RESOLVED_VIRTUAL_TS_MODULE_ID ||\n\t\t\t\t\tid.startsWith(STYLEFRAME_TS_VIRTUAL_PREFIX);\n\n\t\t\t\tif (isVirtualTsModule) {\n\t\t\t\t\tconst result = await esbuildTransform(code, {\n\t\t\t\t\t\tloader: \"ts\",\n\t\t\t\t\t\tformat: \"esm\",\n\t\t\t\t\t\ttarget: \"esnext\",\n\t\t\t\t\t});\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcode: result.code,\n\t\t\t\t\t\tmap: result.map || null,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\treturn null;\n\t\t\t},\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\t// Handle HMR for .styleframe.ts source files\n\t\t\t\tif (isStyleframeSourceFile(ctx.file)) {\n\t\t\t\t\tconst virtualModuleIds = sourceToVirtualModules.get(ctx.file);\n\n\t\t\t\t\tif (virtualModuleIds && virtualModuleIds.size > 0) {\n\t\t\t\t\t\tconst modulesToInvalidate = [];\n\n\t\t\t\t\t\tfor (const virtualId of virtualModuleIds) {\n\t\t\t\t\t\t\tconst virtualModule = await getModuleById(virtualId);\n\t\t\t\t\t\t\tif (virtualModule) {\n\t\t\t\t\t\t\t\tmodulesToInvalidate.push(virtualModule);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (modulesToInvalidate.length > 0) {\n\t\t\t\t\t\t\treturn modulesToInvalidate;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\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":";;;;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