@styleframe/plugin 1.0.0 → 2.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.
- package/CHANGELOG.md +35 -0
- package/dist/astro.js +1 -1
- package/dist/esbuild.js +1 -1
- package/dist/farm.d.ts +2 -2
- package/dist/farm.d.ts.map +1 -1
- package/dist/farm.js +1 -1
- package/dist/farm.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/nuxt.js +3 -3
- package/dist/rollup.js +1 -1
- package/dist/rspack.js +1 -1
- package/dist/{src-mpvRItvZ.js → src-DZUr2xdj.js} +16 -5
- package/dist/src-DZUr2xdj.js.map +1 -0
- package/dist/{vite-Cs6rddMM.js → vite-DmSF1ssW.js} +2 -2
- package/dist/{vite-Cs6rddMM.js.map → vite-DmSF1ssW.js.map} +1 -1
- package/dist/vite.js +2 -2
- package/dist/{webpack-D2mM1N3t.js → webpack-D94H_tz3.js} +2 -2
- package/dist/{webpack-D2mM1N3t.js.map → webpack-D94H_tz3.js.map} +1 -1
- package/dist/webpack.js +2 -2
- package/package.json +11 -5
- package/dist/src-mpvRItvZ.js.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# @styleframe/plugin
|
|
2
|
+
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#50](https://github.com/styleframe-dev/styleframe/pull/50) [`0593c52`](https://github.com/styleframe-dev/styleframe/commit/0593c52798b8846d3c49762621baeb66354e0356) Thanks [@alexgrozav](https://github.com/alexgrozav)! - feat: add license check integration
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`0593c52`](https://github.com/styleframe-dev/styleframe/commit/0593c52798b8846d3c49762621baeb66354e0356)]:
|
|
12
|
+
- @styleframe/transpiler@1.1.0
|
|
13
|
+
- @styleframe/loader@1.1.0
|
|
14
|
+
|
|
15
|
+
## 1.0.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#35](https://github.com/styleframe-dev/styleframe/pull/35) [`5d53569`](https://github.com/styleframe-dev/styleframe/commit/5d5356960af687884703f3de5d3d1638d8ee9d8a) Thanks [@alexgrozav](https://github.com/alexgrozav)! - fix: Update published files references in package.json
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [[`5d53569`](https://github.com/styleframe-dev/styleframe/commit/5d5356960af687884703f3de5d3d1638d8ee9d8a)]:
|
|
22
|
+
- @styleframe/loader@1.0.3
|
|
23
|
+
- @styleframe/transpiler@1.0.3
|
|
24
|
+
|
|
25
|
+
## 1.0.0
|
|
26
|
+
|
|
27
|
+
### Major Changes
|
|
28
|
+
|
|
29
|
+
- [#30](https://github.com/styleframe-dev/styleframe/pull/30) [`68cd004`](https://github.com/styleframe-dev/styleframe/commit/68cd004b04395797876b5e805c0b910d6b665f35) Thanks [@alexgrozav](https://github.com/alexgrozav)! - feat: Initial release. Add `unplugin` instance with dedicated Vite support
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Updated dependencies [[`68cd004`](https://github.com/styleframe-dev/styleframe/commit/68cd004b04395797876b5e805c0b910d6b665f35), [`68cd004`](https://github.com/styleframe-dev/styleframe/commit/68cd004b04395797876b5e805c0b910d6b665f35)]:
|
|
34
|
+
- @styleframe/loader@1.0.2
|
|
35
|
+
- @styleframe/transpiler@1.0.2
|
package/dist/astro.js
CHANGED
package/dist/esbuild.js
CHANGED
package/dist/farm.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Options } from "./types-Clt7t35T.js";
|
|
2
|
-
import
|
|
2
|
+
import { JsPlugin } from "@farmfe/core";
|
|
3
3
|
|
|
4
4
|
//#region src/farm.d.ts
|
|
5
|
-
declare const _default: (options?: Options | undefined) =>
|
|
5
|
+
declare const _default: (options?: Options | undefined) => JsPlugin;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { _default as default };
|
|
8
8
|
//# sourceMappingURL=farm.d.ts.map
|
package/dist/farm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"farm.d.ts","names":[],"sources":["../src/farm.ts"],"sourcesContent":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"farm.d.ts","names":[],"sources":["../src/farm.ts"],"sourcesContent":[],"mappings":";;;;cACiE"}
|
package/dist/farm.js
CHANGED
package/dist/farm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"farm.js","names":[],"sources":["../src/farm.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"farm.js","names":[],"sources":["../src/farm.ts"],"sourcesContent":["// biome-ignore:lint/correctness/noUnusedImports\nimport type { CompilationContext, JsPlugin } from \"@farmfe/core\";\nimport { createFarmPlugin } from \"unplugin\";\nimport { unpluginFactory } from \".\";\n\nexport default createFarmPlugin(unpluginFactory);\n"],"mappings":";;;;;AAKA,mBAAe,iBAAiB,gBAAgB"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;cAsCa,iBAAiB,gBAAgB;cAmHjC,UAAQ,SAAA,CAAA,iBAAA"}
|
package/dist/index.js
CHANGED
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-DZUr2xdj.js";
|
|
3
|
+
import { vite_default } from "./vite-DmSF1ssW.js";
|
|
4
|
+
import { webpack_default } from "./webpack-D94H_tz3.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
|
@@ -1,17 +1,25 @@
|
|
|
1
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 path from "node:path";
|
|
3
|
+
import { getLicenseKeyFromEnv, validateInstanceLicense } from "@styleframe/license";
|
|
2
4
|
import { loadConfigurationFromPath } from "@styleframe/loader";
|
|
3
5
|
import { transpile } from "@styleframe/transpiler";
|
|
4
6
|
import { consola } from "consola";
|
|
5
|
-
import path from "node:path";
|
|
6
7
|
import { createUnplugin } from "unplugin";
|
|
7
8
|
|
|
8
9
|
//#region src/index.ts
|
|
9
|
-
async function loadAndBuildEntry(entry, options) {
|
|
10
|
-
|
|
10
|
+
async function loadAndBuildEntry(entry, options, isBuild) {
|
|
11
|
+
const instance = await loadConfigurationFromPath(entry);
|
|
12
|
+
await validateInstanceLicense(instance, {
|
|
13
|
+
licenseKey: getLicenseKeyFromEnv() || "",
|
|
14
|
+
environment: process.env.NODE_ENV || "development",
|
|
15
|
+
isBuild
|
|
16
|
+
});
|
|
17
|
+
return transpile(instance, options);
|
|
11
18
|
}
|
|
12
19
|
const unpluginFactory = (options = DEFAULT_OPTIONS) => {
|
|
13
20
|
const rawEntry = options.entry ?? DEFAULT_ENTRY;
|
|
14
21
|
const entries = (typeof rawEntry === "string" ? [rawEntry] : rawEntry).map((p) => path.isAbsolute(p) ? p : path.resolve(process.cwd(), p));
|
|
22
|
+
let isBuildCommand = false;
|
|
15
23
|
return {
|
|
16
24
|
name: PLUGIN_NAME,
|
|
17
25
|
enforce: "pre",
|
|
@@ -19,6 +27,9 @@ const unpluginFactory = (options = DEFAULT_OPTIONS) => {
|
|
|
19
27
|
if (id === VIRTUAL_CSS_MODULE_ID) return RESOLVED_VIRTUAL_CSS_MODULE_ID;
|
|
20
28
|
else if (id === VIRTUAL_TS_MODULE_ID) return RESOLVED_VIRTUAL_TS_MODULE_ID;
|
|
21
29
|
},
|
|
30
|
+
buildStart() {
|
|
31
|
+
isBuildCommand = process.argv.includes("build");
|
|
32
|
+
},
|
|
22
33
|
async load(id) {
|
|
23
34
|
if (id === RESOLVED_VIRTUAL_CSS_MODULE_ID || id === RESOLVED_VIRTUAL_TS_MODULE_ID) {
|
|
24
35
|
let hasError = false;
|
|
@@ -31,7 +42,7 @@ const unpluginFactory = (options = DEFAULT_OPTIONS) => {
|
|
|
31
42
|
for (const entry of entries) {
|
|
32
43
|
this.addWatchFile(entry);
|
|
33
44
|
try {
|
|
34
|
-
results.push(await loadAndBuildEntry(entry, { type }));
|
|
45
|
+
results.push(await loadAndBuildEntry(entry, { type }, isBuildCommand));
|
|
35
46
|
} catch (error) {
|
|
36
47
|
hasError = true;
|
|
37
48
|
consola.error(`[styleframe] Failed to build: ${entry}`, error);
|
|
@@ -64,4 +75,4 @@ var src_default = unplugin;
|
|
|
64
75
|
|
|
65
76
|
//#endregion
|
|
66
77
|
export { src_default, unplugin, unpluginFactory };
|
|
67
|
-
//# sourceMappingURL=src-
|
|
78
|
+
//# sourceMappingURL=src-DZUr2xdj.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"src-DZUr2xdj.js","names":["unpluginFactory: UnpluginFactory<Options | undefined>","entries: string[]"],"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 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(\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\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\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\tbuildStart() {\n\t\t\tisBuildCommand = process.argv.includes(\"build\");\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(\n\t\t\t\t\t\t\tawait loadAndBuildEntry(\n\t\t\t\t\t\t\t\tentry,\n\t\t\t\t\t\t\t\t{ type },\n\t\t\t\t\t\t\t\tisBuildCommand,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\thasError = true;\n\t\t\t\t\t\tconsola.error(\n\t\t\t\t\t\t\t`[styleframe] Failed to build: ${entry}`,\n\t\t\t\t\t\t\terror,\n\t\t\t\t\t\t);\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 (\n\t\t\t\t\t\tmod ??\n\t\t\t\t\t\t(await ctx.server?.moduleGraph.getModuleByUrl(id))\n\t\t\t\t\t);\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":";;;;;;;;;AAsBA,eAAe,kBACd,OACA,SACA,SACC;CACD,MAAM,WAAW,MAAM,0BAA0B,MAAM;AAEvD,OAAM,wBAAwB,UAAU;EACvC,YAAY,sBAAsB,IAAI;EACtC,aAAa,QAAQ,IAAI,YAAY;EACrC;EACA,CAAC;AAEF,QAAO,UAAU,UAAU,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;CAEvE,IAAI,iBAAiB;AAErB,QAAO;EACN,MAAM;EACN,SAAS;EACT,UAAU,IAAI;AACb,OAAI,OAAO,sBACV,QAAO;YACG,OAAO,qBACjB,QAAO;;EAGT,aAAa;AACZ,oBAAiB,QAAQ,KAAK,SAAS,QAAQ;;EAEhD,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,KACP,MAAM,kBACL,OACA,EAAE,MAAM,EACR,eACA,CACD;cACO,OAAO;AACf,iBAAW;AACX,cAAQ,MACP,iCAAiC,SACjC,MACA;;;IAIH,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,IAGnD,MAAM,IAAI,QAAQ,YAAY,eAAe,GAAG;;AAKnD,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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { unpluginFactory } from "./src-
|
|
1
|
+
import { unpluginFactory } from "./src-DZUr2xdj.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-DmSF1ssW.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-
|
|
1
|
+
{"version":3,"file":"vite-DmSF1ssW.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.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { unpluginFactory } from "./src-
|
|
1
|
+
import { unpluginFactory } from "./src-DZUr2xdj.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-D94H_tz3.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack-
|
|
1
|
+
{"version":3,"file":"webpack-D94H_tz3.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": "
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"description": "Unplugin for Styleframe. Use it with Vite, Webpack, Astro, Nuxt, Rollup, Rspack, and more.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"keywords": [
|
|
@@ -40,7 +40,10 @@
|
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
42
|
"files": [
|
|
43
|
-
"dist"
|
|
43
|
+
"dist",
|
|
44
|
+
"LICENSE",
|
|
45
|
+
"CHANGELOG.md",
|
|
46
|
+
"README.md"
|
|
44
47
|
],
|
|
45
48
|
"peerDependencies": {
|
|
46
49
|
"@farmfe/core": ">=1",
|
|
@@ -75,12 +78,14 @@
|
|
|
75
78
|
}
|
|
76
79
|
},
|
|
77
80
|
"dependencies": {
|
|
81
|
+
"@styleframe/license": "^1.1.0",
|
|
78
82
|
"consola": "^3.4.2",
|
|
79
83
|
"unplugin": "^2.3.4",
|
|
80
|
-
"@styleframe/loader": "^
|
|
81
|
-
"@styleframe/transpiler": "^
|
|
84
|
+
"@styleframe/loader": "^2.0.0",
|
|
85
|
+
"@styleframe/transpiler": "^2.0.0"
|
|
82
86
|
},
|
|
83
87
|
"devDependencies": {
|
|
88
|
+
"@farmfe/core": "^1.7.11",
|
|
84
89
|
"@vitest/coverage-v8": "^3.2.4",
|
|
85
90
|
"@nuxt/kit": "^3.17.4",
|
|
86
91
|
"@nuxt/schema": "^3.17.4",
|
|
@@ -93,7 +98,7 @@
|
|
|
93
98
|
"vite": "^6.3.5",
|
|
94
99
|
"vitest": "^3.1.4",
|
|
95
100
|
"webpack": "^5.99.9",
|
|
96
|
-
"@styleframe/config-typescript": "^
|
|
101
|
+
"@styleframe/config-typescript": "^2.0.0"
|
|
97
102
|
},
|
|
98
103
|
"homepage": "https://github.com/styleframe-dev/styleframe#readme",
|
|
99
104
|
"bugs": {
|
|
@@ -107,6 +112,7 @@
|
|
|
107
112
|
"scripts": {
|
|
108
113
|
"build": "tsdown",
|
|
109
114
|
"dev": "tsdown -w",
|
|
115
|
+
"typecheck": "tsc --noEmit",
|
|
110
116
|
"start": "tsx src/index.ts",
|
|
111
117
|
"playground:build": "cd playground && pnpm run build",
|
|
112
118
|
"playground:start": "cd playground && pnpm run start",
|
package/dist/src-mpvRItvZ.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|