@styleframe/plugin 2.4.0 → 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 +14 -0
- package/dist/astro.js +1 -1
- package/dist/esbuild.js +1 -1
- package/dist/farm.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/nuxt.d.ts +1 -2
- package/dist/nuxt.d.ts.map +1 -1
- package/dist/nuxt.js +3 -3
- package/dist/rollup.js +1 -1
- package/dist/rspack.js +1 -1
- package/dist/{src-BfsicZRP.js → src-4YtKkWMH.js} +4 -2
- package/dist/src-4YtKkWMH.js.map +1 -0
- package/dist/{vite-Cd6Z9GAd.js → vite-BY9qXnXW.js} +2 -2
- package/dist/{vite-Cd6Z9GAd.js.map → vite-BY9qXnXW.js.map} +1 -1
- package/dist/vite.d.ts +2 -2
- package/dist/vite.js +2 -2
- package/dist/{webpack-yNnIZ6Rq.js → webpack-DpR7fAjO.js} +2 -2
- package/dist/{webpack-yNnIZ6Rq.js.map → webpack-DpR7fAjO.js.map} +1 -1
- package/dist/webpack.js +2 -2
- package/package.json +4 -3
- package/dist/src-BfsicZRP.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
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
|
+
|
|
3
17
|
## 2.4.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
package/dist/astro.js
CHANGED
package/dist/esbuild.js
CHANGED
package/dist/farm.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Options } from "./types-Clt7t35T.js";
|
|
2
|
-
import * as
|
|
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:
|
|
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
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;cAiJa,iBAAiB,gBAAgB;
|
|
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
package/dist/nuxt.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Options } from "./types-Clt7t35T.js";
|
|
2
|
-
import { NuxtModule } from "@nuxt/schema";
|
|
3
2
|
|
|
4
3
|
//#region src/nuxt.d.ts
|
|
5
4
|
interface ModuleOptions extends Options {}
|
|
6
|
-
declare const _default: NuxtModule<
|
|
5
|
+
declare const _default: NuxtModule<TOptions, TOptions, false>;
|
|
7
6
|
//#endregion
|
|
8
7
|
export { ModuleOptions, _default as default };
|
|
9
8
|
//# sourceMappingURL=nuxt.d.ts.map
|
package/dist/nuxt.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nuxt.d.ts","names":[],"sources":["../src/nuxt.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"nuxt.d.ts","names":[],"sources":["../src/nuxt.ts"],"sourcesContent":[],"mappings":";;;UAMiB,aAAA,SAAsB;AAAvC,cAAiD,QAAlB,YAAQ,SAAO,UAAA,EAAA,KAAA,CAAA"}
|
package/dist/nuxt.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./constants-CnbAL4bY.js";
|
|
2
|
-
import "./src-
|
|
3
|
-
import { vite_default } from "./vite-
|
|
4
|
-
import { webpack_default } from "./webpack-
|
|
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
package/dist/rspack.js
CHANGED
|
@@ -79,6 +79,7 @@ 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
85
|
if (!isCss && !(queryPart === "ts")) return null;
|
|
@@ -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
|
|
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-
|
|
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,GAAG,gBAAgB;AAExD,eAAe,kBACd,OACA,SACA,SACC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N,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-
|
|
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-
|
|
9
|
+
//# sourceMappingURL=vite-BY9qXnXW.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-
|
|
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
|
|
2
|
+
import * as unplugin1 from "unplugin";
|
|
3
3
|
|
|
4
4
|
//#region src/vite.d.ts
|
|
5
|
-
declare const _default: (options?: Options | undefined) =>
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import { unpluginFactory } from "./src-
|
|
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-
|
|
9
|
+
//# sourceMappingURL=webpack-DpR7fAjO.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack-
|
|
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.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@styleframe/plugin",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.4.
|
|
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,8 +78,8 @@
|
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
|
-
"@styleframe/license": "^2.0.
|
|
82
|
-
"@styleframe/loader": "^2.4.
|
|
81
|
+
"@styleframe/license": "^2.0.2",
|
|
82
|
+
"@styleframe/loader": "^2.4.1",
|
|
83
83
|
"@styleframe/transpiler": "^2.6.0",
|
|
84
84
|
"consola": "^3.4.2",
|
|
85
85
|
"unplugin": "^2.3.4"
|
|
@@ -87,6 +87,7 @@
|
|
|
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",
|
package/dist/src-BfsicZRP.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"src-BfsicZRP.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// 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\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":";;;;;;;;;;AAyBA,MAAM,0BAA0B;AAGhC,MAAM,gCAAgC,GAAG,gBAAgB;AACzD,MAAM,+BAA+B,GAAG,gBAAgB;AAExD,eAAe,kBACd,OACA,SACA,SACC;CACD,MAAM,WAAW,MAAM,kBAAkB,EAAE,OAAO,CAAC;AAEnD,OAAM,wBAAwB,UAAU;EACvC,YAAY,sBAAsB,IAAI;EACtC,aAAa,QAAQ,IAAI,YAAY;EACrC;EACA,CAAC;AAEF,QAAO,UAAU,UAAU,QAAQ;;AAGpC,SAAS,uBAAuB,IAAqB;AACpD,QAAO,wBAAwB,KAAK,GAAG;;AAGxC,SAAS,qBAAqB,UAAkB,MAA4B;AAS3E,QAAO,GAPN,SAAS,QACN,gCACA,+BAIH,SAAS,QAAQ,SAAS,QAAQ,SAAS,OAAO,GAAG;;AAIvD,SAAS,eACR,IACkD;AAClD,KAAI,GAAG,WAAW,8BAA8B,CAC/C,QAAO;EACN,MAAM;EAEN,UAAU,GACR,MAAM,8BAA8B,OAAO,CAC3C,QAAQ,UAAU,MAAM;EAC1B;AAEF,KAAI,GAAG,WAAW,6BAA6B,CAC9C,QAAO;EACN,M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