@fragno-dev/unplugin-fragno 0.0.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.
Files changed (50) hide show
  1. package/README.md +3 -0
  2. package/dist/index-DxDbJ0wz.d.ts +16 -0
  3. package/dist/index-DxDbJ0wz.d.ts.map +1 -0
  4. package/dist/index.d.ts +3 -0
  5. package/dist/index.js +4 -0
  6. package/dist/integrations/astro.d.ts +7 -0
  7. package/dist/integrations/astro.d.ts.map +1 -0
  8. package/dist/integrations/astro.js +15 -0
  9. package/dist/integrations/astro.js.map +1 -0
  10. package/dist/integrations/esbuild.d.ts +9 -0
  11. package/dist/integrations/esbuild.d.ts.map +1 -0
  12. package/dist/integrations/esbuild.js +10 -0
  13. package/dist/integrations/esbuild.js.map +1 -0
  14. package/dist/integrations/farm.d.ts +8 -0
  15. package/dist/integrations/farm.d.ts.map +1 -0
  16. package/dist/integrations/farm.js +10 -0
  17. package/dist/integrations/farm.js.map +1 -0
  18. package/dist/integrations/nuxt.d.ts +9 -0
  19. package/dist/integrations/nuxt.d.ts.map +1 -0
  20. package/dist/integrations/nuxt.js +21 -0
  21. package/dist/integrations/nuxt.js.map +1 -0
  22. package/dist/integrations/rollup.d.ts +9 -0
  23. package/dist/integrations/rollup.d.ts.map +1 -0
  24. package/dist/integrations/rollup.js +11 -0
  25. package/dist/integrations/rollup.js.map +1 -0
  26. package/dist/integrations/rspack.d.ts +8 -0
  27. package/dist/integrations/rspack.d.ts.map +1 -0
  28. package/dist/integrations/rspack.js +10 -0
  29. package/dist/integrations/rspack.js.map +1 -0
  30. package/dist/integrations/vite.d.ts +9 -0
  31. package/dist/integrations/vite.d.ts.map +1 -0
  32. package/dist/integrations/vite.js +5 -0
  33. package/dist/integrations/webpack.d.ts +9 -0
  34. package/dist/integrations/webpack.d.ts.map +1 -0
  35. package/dist/integrations/webpack.js +5 -0
  36. package/dist/macros.d.ts +22 -0
  37. package/dist/macros.d.ts.map +1 -0
  38. package/dist/macros.js +20 -0
  39. package/dist/macros.js.map +1 -0
  40. package/dist/package-DVqxmLAc.js +6 -0
  41. package/dist/package-DVqxmLAc.js.map +1 -0
  42. package/dist/src--rYTODVa.js +197 -0
  43. package/dist/src--rYTODVa.js.map +1 -0
  44. package/dist/types-B2lQo1ln.d.ts +8 -0
  45. package/dist/types-B2lQo1ln.d.ts.map +1 -0
  46. package/dist/vite-CXr48_Nq.js +9 -0
  47. package/dist/vite-CXr48_Nq.js.map +1 -0
  48. package/dist/webpack-BHY3Ecxw.js +9 -0
  49. package/dist/webpack-BHY3Ecxw.js.map +1 -0
  50. package/package.json +155 -0
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # unplugin-fragno
2
+
3
+ Code is adopted from [vite-env-only](https://github.com/pcattori/vite-env-only) (MIT License)
@@ -0,0 +1,16 @@
1
+ import { Options } from "./types-B2lQo1ln.js";
2
+ import * as unplugin0 from "unplugin";
3
+ import { UnpluginFactory } from "unplugin";
4
+ import "@babel/types";
5
+ import { Binding } from "@babel/traverse";
6
+
7
+ //#region src/transform-macros.d.ts
8
+
9
+ declare const isMacroBinding: (binding: Binding, macro: string) => boolean;
10
+ //#endregion
11
+ //#region src/index.d.ts
12
+ declare const unpluginFactory: UnpluginFactory<Options | undefined>;
13
+ declare const unplugin: unplugin0.UnpluginInstance<Options | undefined, boolean>;
14
+ //#endregion
15
+ export { isMacroBinding, unplugin, unpluginFactory };
16
+ //# sourceMappingURL=index-DxDbJ0wz.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-DxDbJ0wz.d.ts","names":[],"sources":["../../src/transform-macros.ts","../../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;cAgBa,0BAA2B;;;cCX3B,iBAAiB,gBAAgB;cA0BjC,UAAQ,SAAA,CAAA,iBAAA"}
@@ -0,0 +1,3 @@
1
+ import { Options } from "./types-B2lQo1ln.js";
2
+ import { isMacroBinding, unplugin, unpluginFactory } from "./index-DxDbJ0wz.js";
3
+ export { Options, unplugin as default, unplugin, isMacroBinding, unpluginFactory };
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ import "./package-DVqxmLAc.js";
2
+ import { isMacroBinding, src_default, unplugin, unpluginFactory } from "./src--rYTODVa.js";
3
+
4
+ export { src_default as default, isMacroBinding, unplugin, unpluginFactory };
@@ -0,0 +1,7 @@
1
+ import { Options } from "../types-B2lQo1ln.js";
2
+
3
+ //#region src/integrations/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/integrations/astro.ts"],"sourcesContent":[],"mappings":";;;cAAwC,oBAKf"}
@@ -0,0 +1,15 @@
1
+ import "../package-DVqxmLAc.js";
2
+ import { src_default } from "../src--rYTODVa.js";
3
+
4
+ //#region src/integrations/astro.ts
5
+ var astro_default = (options) => ({
6
+ name: "unplugin-fragno",
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/integrations/astro.ts"],"sourcesContent":["import type { Options } from \"../types\";\n\nimport unplugin from \"..\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport default (options: Options): any => ({\n name: \"unplugin-fragno\",\n hooks: {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n \"astro:config:setup\": async (astro: any) => {\n astro.config.vite.plugins ||= [];\n astro.config.vite.plugins.push(unplugin.vite(options));\n },\n },\n});\n"],"mappings":";;;;AAKA,qBAAgB,aAA2B;CACzC,MAAM;CACN,OAAO,EAEL,sBAAsB,OAAO,UAAe;AAC1C,QAAM,OAAO,KAAK,YAAY,EAAE;AAChC,QAAM,OAAO,KAAK,QAAQ,KAAKA,YAAS,KAAK,QAAQ,CAAC;IAEzD;CACF"}
@@ -0,0 +1,9 @@
1
+ import { Options } from "../types-B2lQo1ln.js";
2
+ import "../index-DxDbJ0wz.js";
3
+ import * as unplugin0 from "unplugin";
4
+
5
+ //#region src/integrations/esbuild.d.ts
6
+ declare const _default: (options?: Options | undefined) => unplugin0.EsbuildPlugin;
7
+ //#endregion
8
+ export { _default as default };
9
+ //# sourceMappingURL=esbuild.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"esbuild.d.ts","names":[],"sources":["../../../src/integrations/esbuild.ts"],"sourcesContent":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import "../package-DVqxmLAc.js";
2
+ import { unpluginFactory } from "../src--rYTODVa.js";
3
+ import { createEsbuildPlugin } from "unplugin";
4
+
5
+ //#region src/integrations/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/integrations/esbuild.ts"],"sourcesContent":["import { createEsbuildPlugin } from \"unplugin\";\nimport { unpluginFactory } from \"..\";\n\nexport default createEsbuildPlugin(unpluginFactory);\n"],"mappings":";;;;;AAGA,sBAAe,oBAAoB,gBAAgB"}
@@ -0,0 +1,8 @@
1
+ import { Options } from "../types-B2lQo1ln.js";
2
+ import "../index-DxDbJ0wz.js";
3
+
4
+ //#region src/integrations/farm.d.ts
5
+ declare const _default: (options?: Options | undefined) => 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/integrations/farm.ts"],"sourcesContent":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import "../package-DVqxmLAc.js";
2
+ import { unpluginFactory } from "../src--rYTODVa.js";
3
+ import { createFarmPlugin } from "unplugin";
4
+
5
+ //#region src/integrations/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/integrations/farm.ts"],"sourcesContent":["import { createFarmPlugin } from \"unplugin\";\nimport { unpluginFactory } from \"..\";\n\nexport default createFarmPlugin(unpluginFactory);\n"],"mappings":";;;;;AAGA,mBAAe,iBAAiB,gBAAgB"}
@@ -0,0 +1,9 @@
1
+ import { Options } from "../types-B2lQo1ln.js";
2
+ import * as _nuxt_schema0 from "@nuxt/schema";
3
+
4
+ //#region src/integrations/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/integrations/nuxt.ts"],"sourcesContent":[],"mappings":";;;;UAMiB,aAAA,SAAsB;cAAU"}
@@ -0,0 +1,21 @@
1
+ import "../package-DVqxmLAc.js";
2
+ import "../src--rYTODVa.js";
3
+ import { vite_default } from "../vite-CXr48_Nq.js";
4
+ import { webpack_default } from "../webpack-BHY3Ecxw.js";
5
+ import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from "@nuxt/kit";
6
+
7
+ //#region src/integrations/nuxt.ts
8
+ var nuxt_default = defineNuxtModule({
9
+ meta: {
10
+ name: "nuxt-unplugin-fragno",
11
+ configKey: "unpluginFragno"
12
+ },
13
+ setup(options, _nuxt) {
14
+ addVitePlugin(() => vite_default(options));
15
+ addWebpackPlugin(() => webpack_default(options));
16
+ }
17
+ });
18
+
19
+ //#endregion
20
+ export { nuxt_default as default };
21
+ //# sourceMappingURL=nuxt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nuxt.js","names":["vite","webpack"],"sources":["../../src/integrations/nuxt.ts"],"sourcesContent":["import type { Options } from \"../types\";\nimport { addVitePlugin, addWebpackPlugin, defineNuxtModule } from \"@nuxt/kit\";\nimport vite from \"./vite.ts\";\nimport webpack from \"./webpack\";\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface ModuleOptions extends Options {}\n\nexport default defineNuxtModule<ModuleOptions>({\n meta: {\n name: \"nuxt-unplugin-fragno\",\n configKey: \"unpluginFragno\",\n },\n setup(options, _nuxt) {\n addVitePlugin(() => vite(options));\n addWebpackPlugin(() => webpack(options));\n },\n});\n"],"mappings":";;;;;;;AAQA,mBAAe,iBAAgC;CAC7C,MAAM;EACJ,MAAM;EACN,WAAW;EACZ;CACD,MAAM,SAAS,OAAO;AACpB,sBAAoBA,aAAK,QAAQ,CAAC;AAClC,yBAAuBC,gBAAQ,QAAQ,CAAC;;CAE3C,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { Options } from "../types-B2lQo1ln.js";
2
+ import "../index-DxDbJ0wz.js";
3
+ import * as rollup0 from "rollup";
4
+
5
+ //#region src/integrations/rollup.d.ts
6
+ declare const _default: (options?: Options | undefined) => rollup0.Plugin<any> | rollup0.Plugin<any>[];
7
+ //#endregion
8
+ export { _default as default };
9
+ //# sourceMappingURL=rollup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rollup.d.ts","names":[],"sources":["../../../src/integrations/rollup.ts"],"sourcesContent":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import "../package-DVqxmLAc.js";
2
+ import { unpluginFactory } from "../src--rYTODVa.js";
3
+ import { createRollupPlugin } from "unplugin";
4
+
5
+ //#region src/integrations/rollup.ts
6
+ console.log("rollup");
7
+ var rollup_default = createRollupPlugin(unpluginFactory);
8
+
9
+ //#endregion
10
+ export { rollup_default as default };
11
+ //# sourceMappingURL=rollup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rollup.js","names":[],"sources":["../../src/integrations/rollup.ts"],"sourcesContent":["import { createRollupPlugin } from \"unplugin\";\nimport { unpluginFactory } from \"..\";\n\nconsole.log(\"rollup\");\nexport default createRollupPlugin(unpluginFactory);\n"],"mappings":";;;;;AAGA,QAAQ,IAAI,SAAS;AACrB,qBAAe,mBAAmB,gBAAgB"}
@@ -0,0 +1,8 @@
1
+ import { Options } from "../types-B2lQo1ln.js";
2
+ import "../index-DxDbJ0wz.js";
3
+
4
+ //#region src/integrations/rspack.d.ts
5
+ declare const _default: (options?: Options | undefined) => RspackPluginInstance;
6
+ //#endregion
7
+ export { _default as default };
8
+ //# sourceMappingURL=rspack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rspack.d.ts","names":[],"sources":["../../../src/integrations/rspack.ts"],"sourcesContent":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import "../package-DVqxmLAc.js";
2
+ import { unpluginFactory } from "../src--rYTODVa.js";
3
+ import { createRspackPlugin } from "unplugin";
4
+
5
+ //#region src/integrations/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/integrations/rspack.ts"],"sourcesContent":["import { createRspackPlugin } from \"unplugin\";\nimport { unpluginFactory } from \"..\";\n\nexport default createRspackPlugin(unpluginFactory);\n"],"mappings":";;;;;AAGA,qBAAe,mBAAmB,gBAAgB"}
@@ -0,0 +1,9 @@
1
+ import { Options } from "../types-B2lQo1ln.js";
2
+ import "../index-DxDbJ0wz.js";
3
+ import * as unplugin1 from "unplugin";
4
+
5
+ //#region src/integrations/vite.d.ts
6
+ declare const _default: (options?: Options | undefined) => unplugin1.VitePlugin<any> | unplugin1.VitePlugin<any>[];
7
+ //#endregion
8
+ export { _default as default };
9
+ //# sourceMappingURL=vite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite.d.ts","names":[],"sources":["../../../src/integrations/vite.ts"],"sourcesContent":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import "../package-DVqxmLAc.js";
2
+ import "../src--rYTODVa.js";
3
+ import { vite_default } from "../vite-CXr48_Nq.js";
4
+
5
+ export { vite_default as default };
@@ -0,0 +1,9 @@
1
+ import { Options } from "../types-B2lQo1ln.js";
2
+ import "../index-DxDbJ0wz.js";
3
+ import * as webpack0 from "webpack";
4
+
5
+ //#region src/integrations/webpack.d.ts
6
+ declare const _default: (options?: Options | undefined) => webpack0.WebpackPluginInstance;
7
+ //#endregion
8
+ export { _default as default };
9
+ //# sourceMappingURL=webpack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webpack.d.ts","names":[],"sources":["../../../src/integrations/webpack.ts"],"sourcesContent":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import "../package-DVqxmLAc.js";
2
+ import "../src--rYTODVa.js";
3
+ import { webpack_default } from "../webpack-BHY3Ecxw.js";
4
+
5
+ export { webpack_default as default };
@@ -0,0 +1,22 @@
1
+ //#region src/macros.d.ts
2
+ /**
3
+ * Modified from: pcattori/vite-env-only
4
+ * Original source: https://github.com/pcattori/vite-env-only/blob/45a39e7fb52e9fae4300e95aa51ed0880374f507/src/transform.ts
5
+ * License: MIT
6
+ * Date obtained: September 4 2025
7
+ * Copyright (c) 2024 Pedro Cattori
8
+ */
9
+ /**
10
+ * On the server, replaced with the value passed in.
11
+ * On the client, replaced with `undefined`.
12
+ */
13
+ declare const serverOnly$: <T>(_: T) => T | undefined;
14
+ /**
15
+ * On the client, replaced with the value passed in.
16
+ * On the server, replaced with `undefined`.
17
+ */
18
+ declare const clientOnly$: <T>(_: T) => T | undefined;
19
+ //# sourceMappingURL=macros.d.ts.map
20
+ //#endregion
21
+ export { clientOnly$, serverOnly$ };
22
+ //# sourceMappingURL=macros.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"macros.d.ts","names":[],"sources":["../../src/macros.ts"],"sourcesContent":[],"mappings":";;AAkBA;;;;;AAMA;;;;;cANa,oBARQ,MAAI;;;;;cAcZ,oBAdQ,MAAI"}
package/dist/macros.js ADDED
@@ -0,0 +1,20 @@
1
+ import { name } from "./package-DVqxmLAc.js";
2
+
3
+ //#region src/macros.ts
4
+ const maybe = (_) => {
5
+ throw Error([`${name}: unreplaced macro`].join("\n"));
6
+ };
7
+ /**
8
+ * On the server, replaced with the value passed in.
9
+ * On the client, replaced with `undefined`.
10
+ */
11
+ const serverOnly$ = maybe;
12
+ /**
13
+ * On the client, replaced with the value passed in.
14
+ * On the server, replaced with `undefined`.
15
+ */
16
+ const clientOnly$ = maybe;
17
+
18
+ //#endregion
19
+ export { clientOnly$, serverOnly$ };
20
+ //# sourceMappingURL=macros.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"macros.js","names":["pkgName"],"sources":["../src/macros.ts"],"sourcesContent":["/**\n * Modified from: pcattori/vite-env-only\n * Original source: https://github.com/pcattori/vite-env-only/blob/45a39e7fb52e9fae4300e95aa51ed0880374f507/src/transform.ts\n * License: MIT\n * Date obtained: September 4 2025\n * Copyright (c) 2024 Pedro Cattori\n */\n\nimport { name as pkgName } from \"../package.json\";\n\nconst maybe = <T>(_: T): T | undefined => {\n throw Error([`${pkgName}: unreplaced macro`].join(\"\\n\"));\n};\n\n/**\n * On the server, replaced with the value passed in.\n * On the client, replaced with `undefined`.\n */\nexport const serverOnly$ = maybe;\n\n/**\n * On the client, replaced with the value passed in.\n * On the server, replaced with `undefined`.\n */\nexport const clientOnly$ = maybe;\n"],"mappings":";;;AAUA,MAAM,SAAY,MAAwB;AACxC,OAAM,MAAM,CAAC,GAAGA,KAAQ,oBAAoB,CAAC,KAAK,KAAK,CAAC;;;;;;AAO1D,MAAa,cAAc;;;;;AAM3B,MAAa,cAAc"}
@@ -0,0 +1,6 @@
1
+ //#region package.json
2
+ var name = "@fragno-dev/unplugin-fragno";
3
+
4
+ //#endregion
5
+ export { name };
6
+ //# sourceMappingURL=package-DVqxmLAc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-DVqxmLAc.js","names":[],"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"@fragno-dev/unplugin-fragno\",\n \"type\": \"module\",\n \"version\": \"0.0.1\",\n \"description\": \"\",\n \"keywords\": [\n \"fragno\",\n \"unplugin\"\n ],\n \"exports\": {\n \".\": {\n \"bun\": \"./src/index.ts\",\n \"development\": \"./src/index.ts\",\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n },\n \"./macros\": {\n \"bun\": \"./src/macros.ts\",\n \"development\": \"./src/macros.ts\",\n \"types\": \"./dist/macros.d.ts\",\n \"default\": \"./dist/macros.js\"\n },\n \"./astro\": {\n \"bun\": \"./src/integrations/astro.ts\",\n \"development\": \"./src/integrations/astro.ts\",\n \"types\": \"./dist/integrations/astro.d.ts\",\n \"default\": \"./dist/integrations/astro.js\"\n },\n \"./esbuild\": {\n \"bun\": \"./src/integrations/esbuild.ts\",\n \"development\": \"./src/integrations/esbuild.ts\",\n \"types\": \"./dist/integrations/esbuild.d.ts\",\n \"default\": \"./dist/integrations/esbuild.js\"\n },\n \"./farm\": {\n \"bun\": \"./src/integrations/farm.ts\",\n \"development\": \"./src/integrations/farm.ts\",\n \"types\": \"./dist/integrations/farm.d.ts\",\n \"default\": \"./dist/integrations/farm.js\"\n },\n \"./nuxt\": {\n \"bun\": \"./src/integrations/nuxt.ts\",\n \"development\": \"./src/integrations/nuxt.ts\",\n \"types\": \"./dist/integrations/nuxt.d.ts\",\n \"default\": \"./dist/integrations/nuxt.js\"\n },\n \"./rollup\": {\n \"bun\": \"./src/integrations/rollup.ts\",\n \"development\": \"./src/integrations/rollup.ts\",\n \"types\": \"./dist/integrations/rollup.d.ts\",\n \"default\": \"./dist/integrations/rollup.js\"\n },\n \"./rspack\": {\n \"bun\": \"./src/integrations/rspack.ts\",\n \"development\": \"./src/integrations/rspack.ts\",\n \"types\": \"./dist/integrations/rspack.d.ts\",\n \"default\": \"./dist/integrations/rspack.js\"\n },\n \"./vite\": {\n \"bun\": \"./src/integrations/vite.ts\",\n \"development\": \"./src/integrations/vite.ts\",\n \"types\": \"./dist/integrations/vite.d.ts\",\n \"default\": \"./dist/integrations/vite.js\"\n },\n \"./webpack\": {\n \"bun\": \"./src/integrations/webpack.ts\",\n \"development\": \"./src/integrations/webpack.ts\",\n \"types\": \"./dist/integrations/webpack.d.ts\",\n \"default\": \"./dist/integrations/webpack.js\"\n },\n \"./types\": \"./dist/types.js\",\n \"./package.json\": \"./package.json\"\n },\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"typesVersions\": {\n \"*\": {\n \"*\": [\n \"./dist/*\",\n \"./*\"\n ]\n }\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"types:check\": \"tsc --noEmit\",\n \"build\": \"tsdown\",\n \"build:watch\": \"tsdown --watch\",\n \"test\": \"vitest\"\n },\n \"peerDependencies\": {\n \"@farmfe/core\": \">=1\",\n \"@nuxt/kit\": \"^3 || ^4\",\n \"@nuxt/schema\": \"^3 || ^4\",\n \"esbuild\": \"*\",\n \"rollup\": \"^3\",\n \"vite\": \">=3\",\n \"webpack\": \"^4 || ^5\"\n },\n \"peerDependenciesMeta\": {\n \"@farmfe/core\": {\n \"optional\": true\n },\n \"@nuxt/kit\": {\n \"optional\": true\n },\n \"@nuxt/schema\": {\n \"optional\": true\n },\n \"esbuild\": {\n \"optional\": true\n },\n \"rollup\": {\n \"optional\": true\n },\n \"vite\": {\n \"optional\": true\n },\n \"webpack\": {\n \"optional\": true\n }\n },\n \"dependencies\": {\n \"unplugin\": \"^2.3.4\",\n \"@babel/core\": \"^7.23.7\",\n \"@babel/generator\": \"^7.23.6\",\n \"@babel/parser\": \"^7.23.6\",\n \"@babel/traverse\": \"^7.23.7\",\n \"@babel/types\": \"^7.23.6\",\n \"babel-dead-code-elimination\": \"^1.0.6\"\n },\n \"devDependencies\": {\n \"@antfu/eslint-config\": \"^4.13.2\",\n \"@fragno-private/typescript-config\": \"workspace:*\",\n \"@nuxt/kit\": \"^4.0.3\",\n \"@nuxt/schema\": \"^4.0.3\",\n \"@types/babel__core\": \"^7.20.5\",\n \"@types/babel__generator\": \"^7.6.8\",\n \"@types/babel__traverse\": \"^7.20.5\",\n \"@types/node\": \"^22.15.21\",\n \"dedent\": \"^1.7.0\",\n \"eslint\": \"^9.27.0\",\n \"nodemon\": \"^3.1.10\",\n \"rollup\": \"^4.41.0\",\n \"tsdown\": \"^0.12.0\",\n \"tsx\": \"^4.19.4\",\n \"typescript\": \"^5.8.3\",\n \"vite\": \"^6.3.5\",\n \"vitest\": \"^3.1.4\",\n \"webpack\": \"^5.99.9\"\n }\n}\n"],"mappings":";WACU"}
@@ -0,0 +1,197 @@
1
+ import { name } from "./package-DVqxmLAc.js";
2
+ import { createUnplugin } from "unplugin";
3
+ import * as babel from "@babel/core";
4
+ import { traverse } from "@babel/core";
5
+ import { parse } from "@babel/parser";
6
+ import { generate } from "@babel/generator";
7
+ import { deadCodeElimination, findReferencedIdentifiers } from "babel-dead-code-elimination";
8
+ import * as t from "@babel/types";
9
+
10
+ //#region src/transform-macros.ts
11
+ const macrosSpecifier = `${name}/macros`;
12
+ const isMacroBinding = (binding, macro) => {
13
+ if (!t.isImportDeclaration(binding?.path.parent)) return false;
14
+ if (binding.path.parent.source.value !== macrosSpecifier) return false;
15
+ if (!t.isImportSpecifier(binding?.path.node)) return false;
16
+ const { imported } = binding.path.node;
17
+ if (!t.isIdentifier(imported)) return false;
18
+ if (imported.name !== macro) return false;
19
+ return true;
20
+ };
21
+ const isMacro = (path, macro) => {
22
+ if (!t.isIdentifier(path.node.callee)) return false;
23
+ const binding = path.scope.getBinding(path.node.callee.name);
24
+ if (!binding) return false;
25
+ if (!isMacroBinding(binding, macro)) return false;
26
+ if (path.node.arguments.length !== 1) throw path.buildCodeFrameError(`'${macro}' must take exactly one argument`);
27
+ return true;
28
+ };
29
+ function transformMacros(ast, options) {
30
+ traverse(ast, {
31
+ CallExpression(path) {
32
+ if (isMacro(path, options.ssr ? "clientOnly$" : "serverOnly$")) path.replaceWith(t.identifier("undefined"));
33
+ if (isMacro(path, options.ssr ? "serverOnly$" : "clientOnly$")) {
34
+ const arg = path.node.arguments[0];
35
+ if (t.isExpression(arg)) path.replaceWith(arg);
36
+ }
37
+ },
38
+ Identifier(path) {
39
+ if (t.isImportSpecifier(path.parent)) return;
40
+ const binding = path.scope.getBinding(path.node.name);
41
+ if (!binding) return;
42
+ if (!isMacroBinding(binding, "serverOnly$") && !isMacroBinding(binding, "clientOnly$")) return;
43
+ if (t.isCallExpression(path.parent)) return;
44
+ throw path.buildCodeFrameError(`'${path.node.name}' macro cannot be manipulated at runtime as it must be statically analysable`);
45
+ },
46
+ ImportDeclaration(path) {
47
+ if (path.node.source.value !== macrosSpecifier) return;
48
+ path.node.specifiers.forEach((specifier, i) => {
49
+ if (t.isImportNamespaceSpecifier(specifier)) {
50
+ const subpath = path.get(`specifiers.${i}`);
51
+ if (Array.isArray(subpath)) throw new Error("unreachable");
52
+ throw subpath.buildCodeFrameError(`Namespace import is not supported by '${macrosSpecifier}'`);
53
+ }
54
+ });
55
+ }
56
+ });
57
+ }
58
+
59
+ //#endregion
60
+ //#region src/transform-define-route.ts
61
+ const FRAGNO_PACKAGES$1 = ["@fragno-dev/core"];
62
+ const isAddRouteBinding = (binding) => {
63
+ if (!t.isImportDeclaration(binding?.path.parent)) return false;
64
+ const source = binding.path.parent.source.value;
65
+ if (!FRAGNO_PACKAGES$1.some((pkg) => source.startsWith(pkg))) return false;
66
+ if (!t.isImportSpecifier(binding?.path.node)) return false;
67
+ const { imported } = binding.path.node;
68
+ if (!t.isIdentifier(imported)) return false;
69
+ if (imported.name !== "addRoute" && imported.name !== "defineRoute") return false;
70
+ return true;
71
+ };
72
+ const isAddRouteCall = (path) => {
73
+ if (!t.isIdentifier(path.node.callee)) return false;
74
+ const binding = path.scope.getBinding(path.node.callee.name);
75
+ if (!binding) return false;
76
+ return isAddRouteBinding(binding);
77
+ };
78
+ function replaceHandlerWithNoop(routeConfig) {
79
+ if (!t.isObjectExpression(routeConfig)) return;
80
+ const handlerProp = routeConfig.properties.find((prop) => {
81
+ if (t.isObjectProperty(prop) || t.isObjectMethod(prop)) {
82
+ const key = prop.key;
83
+ return t.isIdentifier(key) && key.name === "handler";
84
+ }
85
+ return false;
86
+ });
87
+ if (!handlerProp) return;
88
+ if (t.isObjectProperty(handlerProp)) handlerProp.value = t.arrowFunctionExpression([], t.blockStatement([]));
89
+ else if (t.isObjectMethod(handlerProp)) {
90
+ handlerProp.body = t.blockStatement([]);
91
+ handlerProp.params = [];
92
+ }
93
+ }
94
+ function transformDefineRoute(ast, options) {
95
+ if (options.ssr) return;
96
+ traverse(ast, { CallExpression(path) {
97
+ if (!isAddRouteCall(path)) return;
98
+ if (path.node.arguments.length > 0) {
99
+ const firstArg = path.node.arguments[0];
100
+ if (t.isExpression(firstArg)) replaceHandlerWithNoop(firstArg);
101
+ }
102
+ } });
103
+ }
104
+
105
+ //#endregion
106
+ //#region src/transform-define-library.ts
107
+ const FRAGNO_PACKAGES = ["@fragno-dev/core"];
108
+ const isDefineLibraryBinding = (binding) => {
109
+ if (!t.isImportDeclaration(binding?.path.parent)) return false;
110
+ const source = binding.path.parent.source.value;
111
+ if (!FRAGNO_PACKAGES.some((pkg) => source.startsWith(pkg))) return false;
112
+ if (!t.isImportSpecifier(binding?.path.node)) return false;
113
+ const { imported } = binding.path.node;
114
+ if (!t.isIdentifier(imported)) return false;
115
+ if (imported.name !== "defineFragment") return false;
116
+ return true;
117
+ };
118
+ const isDefineLibraryCall = (node, scope) => {
119
+ if (!t.isIdentifier(node.callee)) return false;
120
+ const binding = scope.getBinding(node.callee.name);
121
+ if (!binding) return false;
122
+ return isDefineLibraryBinding(binding);
123
+ };
124
+ const createNoOpArrowFunction = () => {
125
+ return t.arrowFunctionExpression([], t.blockStatement([]));
126
+ };
127
+ const isDefineLibraryChain = (node, scope) => {
128
+ if (t.isCallExpression(node) && isDefineLibraryCall(node, scope)) return true;
129
+ if (t.isCallExpression(node) && t.isMemberExpression(node.callee)) return isDefineLibraryChain(node.callee.object, scope);
130
+ if (t.isIdentifier(node)) {
131
+ const binding = scope.getBinding(node.name);
132
+ if (binding && binding.path.isVariableDeclarator()) {
133
+ const init = binding.path.node.init;
134
+ if (init) return isDefineLibraryChain(init, scope);
135
+ }
136
+ }
137
+ return false;
138
+ };
139
+ function transformDefineLibrary(ast, options) {
140
+ if (options.ssr) return;
141
+ traverse(ast, { CallExpression(path) {
142
+ const { callee } = path.node;
143
+ if (!t.isMemberExpression(callee)) return;
144
+ const { property, object } = callee;
145
+ if (!t.isIdentifier(property)) return;
146
+ const methodName = property.name;
147
+ if (methodName !== "withDependencies" && methodName !== "withServices") return;
148
+ if (!isDefineLibraryChain(object, path.scope)) return;
149
+ path.node.arguments = [createNoOpArrowFunction()];
150
+ } });
151
+ }
152
+
153
+ //#endregion
154
+ //#region src/transform.ts
155
+ const transform = (code, id, options) => {
156
+ const ast = parse(code, {
157
+ sourceType: "module",
158
+ plugins: [["typescript", {}]]
159
+ });
160
+ new babel.File({ filename: void 0 }, {
161
+ code,
162
+ ast
163
+ });
164
+ const refs = findReferencedIdentifiers(ast);
165
+ transformMacros(ast, options);
166
+ transformDefineRoute(ast, options);
167
+ transformDefineLibrary(ast, options);
168
+ deadCodeElimination(ast, refs);
169
+ return generate(ast, {
170
+ sourceMaps: true,
171
+ sourceFileName: id
172
+ }, code);
173
+ };
174
+
175
+ //#endregion
176
+ //#region src/index.ts
177
+ const unpluginFactory = (options = {}) => {
178
+ const { platform } = options;
179
+ if (platform !== "browser") return [];
180
+ return {
181
+ name: "unplugin-fragno",
182
+ transformInclude(id) {
183
+ if (id.endsWith(".d.ts")) return false;
184
+ if (id.includes("@fragno-dev/unplugin-fragno") || id.includes("@fragno-dev/core")) return false;
185
+ return true;
186
+ },
187
+ transform(code, id) {
188
+ return transform(code, id, { ssr: false });
189
+ }
190
+ };
191
+ };
192
+ const unplugin = /* @__PURE__ */ createUnplugin(unpluginFactory);
193
+ var src_default = unplugin;
194
+
195
+ //#endregion
196
+ export { isMacroBinding, src_default, unplugin, unpluginFactory };
197
+ //# sourceMappingURL=src--rYTODVa.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"src--rYTODVa.js","names":["pkgName","FRAGNO_PACKAGES","unpluginFactory: UnpluginFactory<Options | undefined>"],"sources":["../src/transform-macros.ts","../src/transform-define-route.ts","../src/transform-define-library.ts","../src/transform.ts","../src/index.ts"],"sourcesContent":["/**\n * Modified from: pcattori/vite-env-only\n * Original source: https://github.com/pcattori/vite-env-only/blob/45a39e7fb52e9fae4300e95aa51ed0880374f507/src/transform.ts\n * License: MIT\n * Date obtained: September 4 2025\n * Copyright (c) 2024 Pedro Cattori\n */\n\nimport { traverse } from \"@babel/core\";\nimport type { Binding, NodePath } from \"@babel/traverse\";\nimport * as t from \"@babel/types\";\nimport type { Node } from \"@babel/types\";\nimport { name as pkgName } from \"../package.json\";\n\nconst macrosSpecifier = `${pkgName}/macros`;\n\nexport const isMacroBinding = (binding: Binding, macro: string): boolean => {\n if (!t.isImportDeclaration(binding?.path.parent)) return false;\n if (binding.path.parent.source.value !== macrosSpecifier) return false;\n\n if (!t.isImportSpecifier(binding?.path.node)) return false;\n const { imported } = binding.path.node;\n if (!t.isIdentifier(imported)) return false;\n if (imported.name !== macro) return false;\n return true;\n};\n\nconst isMacro = (path: NodePath<t.CallExpression>, macro: string) => {\n if (!t.isIdentifier(path.node.callee)) return false;\n const binding = path.scope.getBinding(path.node.callee.name);\n\n if (!binding) return false;\n if (!isMacroBinding(binding, macro)) return false;\n\n if (path.node.arguments.length !== 1) {\n throw path.buildCodeFrameError(`'${macro}' must take exactly one argument`);\n }\n return true;\n};\n\nexport function transformMacros(ast: Node, options: { ssr: boolean }) {\n traverse(ast, {\n CallExpression(path) {\n if (isMacro(path, options.ssr ? \"clientOnly$\" : \"serverOnly$\")) {\n path.replaceWith(t.identifier(\"undefined\"));\n }\n if (isMacro(path, options.ssr ? \"serverOnly$\" : \"clientOnly$\")) {\n const arg = path.node.arguments[0];\n if (t.isExpression(arg)) {\n path.replaceWith(arg);\n }\n }\n },\n\n Identifier(path) {\n if (t.isImportSpecifier(path.parent)) return;\n\n const binding = path.scope.getBinding(path.node.name);\n if (!binding) return;\n if (!isMacroBinding(binding, \"serverOnly$\") && !isMacroBinding(binding, \"clientOnly$\")) {\n return;\n }\n if (t.isCallExpression(path.parent)) return;\n throw path.buildCodeFrameError(\n `'${path.node.name}' macro cannot be manipulated at runtime as it must be statically analysable`,\n );\n },\n\n ImportDeclaration(path) {\n if (path.node.source.value !== macrosSpecifier) return;\n path.node.specifiers.forEach((specifier, i) => {\n if (t.isImportNamespaceSpecifier(specifier)) {\n const subpath = path.get(`specifiers.${i}`);\n if (Array.isArray(subpath)) throw new Error(\"unreachable\");\n throw subpath.buildCodeFrameError(\n `Namespace import is not supported by '${macrosSpecifier}'`,\n );\n }\n });\n },\n });\n}\n","import { traverse } from \"@babel/core\";\nimport type { Binding, NodePath } from \"@babel/traverse\";\nimport * as t from \"@babel/types\";\nimport type { Node } from \"@babel/types\";\n\nconst FRAGNO_PACKAGES = [\"@fragno-dev/core\"];\n\nconst isAddRouteBinding = (binding: Binding): boolean => {\n if (!t.isImportDeclaration(binding?.path.parent)) {\n return false;\n }\n\n const source = binding.path.parent.source.value;\n if (!FRAGNO_PACKAGES.some((pkg) => source.startsWith(pkg))) {\n return false;\n }\n\n if (!t.isImportSpecifier(binding?.path.node)) {\n return false;\n }\n\n const { imported } = binding.path.node;\n if (!t.isIdentifier(imported)) {\n return false;\n }\n\n if (imported.name !== \"addRoute\" && imported.name !== \"defineRoute\") {\n return false;\n }\n\n return true;\n};\n\nconst isAddRouteCall = (path: NodePath<t.CallExpression>): boolean => {\n if (!t.isIdentifier(path.node.callee)) {\n return false;\n }\n const binding = path.scope.getBinding(path.node.callee.name);\n\n if (!binding) {\n return false;\n }\n\n return isAddRouteBinding(binding);\n};\n\nfunction replaceHandlerWithNoop(routeConfig: t.Expression) {\n if (!t.isObjectExpression(routeConfig)) {\n return;\n }\n\n const handlerProp = routeConfig.properties.find((prop) => {\n if (t.isObjectProperty(prop) || t.isObjectMethod(prop)) {\n const key = prop.key;\n return t.isIdentifier(key) && key.name === \"handler\";\n }\n return false;\n });\n\n if (!handlerProp) {\n return;\n }\n\n if (t.isObjectProperty(handlerProp)) {\n handlerProp.value = t.arrowFunctionExpression([], t.blockStatement([]));\n } else if (t.isObjectMethod(handlerProp)) {\n handlerProp.body = t.blockStatement([]);\n handlerProp.params = [];\n }\n}\n\nexport function transformDefineRoute(ast: Node, options: { ssr: boolean }) {\n if (options.ssr) {\n return;\n }\n\n traverse(ast, {\n CallExpression(path) {\n if (!isAddRouteCall(path)) {\n return;\n }\n\n if (path.node.arguments.length > 0) {\n const firstArg = path.node.arguments[0];\n if (t.isExpression(firstArg)) {\n replaceHandlerWithNoop(firstArg);\n }\n }\n },\n });\n}\n","import { traverse } from \"@babel/core\";\nimport type { Binding, Scope } from \"@babel/traverse\";\nimport * as t from \"@babel/types\";\nimport type { Node } from \"@babel/types\";\n\nconst FRAGNO_PACKAGES = [\"@fragno-dev/core\"];\n\nconst isDefineLibraryBinding = (binding: Binding): boolean => {\n if (!t.isImportDeclaration(binding?.path.parent)) {\n return false;\n }\n\n const source = binding.path.parent.source.value;\n if (!FRAGNO_PACKAGES.some((pkg) => source.startsWith(pkg))) {\n return false;\n }\n\n if (!t.isImportSpecifier(binding?.path.node)) {\n return false;\n }\n\n const { imported } = binding.path.node;\n if (!t.isIdentifier(imported)) {\n return false;\n }\n\n if (imported.name !== \"defineFragment\") {\n return false;\n }\n\n return true;\n};\n\nconst isDefineLibraryCall = (node: t.CallExpression, scope: Scope): boolean => {\n if (!t.isIdentifier(node.callee)) {\n return false;\n }\n const binding = scope.getBinding(node.callee.name);\n\n if (!binding) {\n return false;\n }\n return isDefineLibraryBinding(binding);\n};\n\nconst createNoOpArrowFunction = (): t.ArrowFunctionExpression => {\n return t.arrowFunctionExpression([], t.blockStatement([]));\n};\n\nconst isDefineLibraryChain = (node: t.Node, scope: Scope): boolean => {\n // Check direct defineFragment call\n if (t.isCallExpression(node) && isDefineLibraryCall(node, scope)) {\n return true;\n }\n\n // Check chained method calls\n if (t.isCallExpression(node) && t.isMemberExpression(node.callee)) {\n return isDefineLibraryChain(node.callee.object, scope);\n }\n\n // Check if it's an identifier that refers to a defineFragment result\n if (t.isIdentifier(node)) {\n const binding = scope.getBinding(node.name);\n if (binding && binding.path.isVariableDeclarator()) {\n const init = binding.path.node.init;\n if (init) {\n return isDefineLibraryChain(init, scope);\n }\n }\n }\n\n return false;\n};\n\nexport function transformDefineLibrary(ast: Node, options: { ssr: boolean }): void {\n if (options.ssr) {\n return;\n }\n\n traverse(ast, {\n CallExpression(path) {\n const { callee } = path.node;\n\n // Check if this is a method call\n if (!t.isMemberExpression(callee)) {\n return;\n }\n\n const { property, object } = callee;\n\n // Check if the method is withDependencies or withServices\n if (!t.isIdentifier(property)) {\n return;\n }\n\n const methodName = property.name;\n if (methodName !== \"withDependencies\" && methodName !== \"withServices\") {\n return;\n }\n\n // Check if this is part of a defineFragment chain\n if (!isDefineLibraryChain(object, path.scope)) {\n return;\n }\n\n // Replace the argument with a no-op function that returns this\n path.node.arguments = [createNoOpArrowFunction()];\n },\n });\n}\n","import * as babel from \"@babel/core\";\nimport { parse } from \"@babel/parser\";\nimport { generate } from \"@babel/generator\";\nimport type { GeneratorResult } from \"@babel/generator\";\n\nimport { deadCodeElimination, findReferencedIdentifiers } from \"babel-dead-code-elimination\";\nimport { transformMacros } from \"./transform-macros\";\nimport { transformDefineRoute } from \"./transform-define-route\";\nimport { transformDefineLibrary } from \"./transform-define-library\";\n\nexport const transform = (code: string, id: string, options: { ssr: boolean }): GeneratorResult => {\n const ast = parse(code, { sourceType: \"module\", plugins: [[\"typescript\", {}]] });\n\n // - https://github.com/babel/babel/issues/11889\n // - https://github.com/babel/babel/issues/11350#issuecomment-606169054\n // @ts-expect-error `@types/babel__core` is missing types for `File`\n new babel.File({ filename: undefined }, { code, ast });\n\n const refs = findReferencedIdentifiers(ast);\n\n transformMacros(ast, options);\n transformDefineRoute(ast, options);\n transformDefineLibrary(ast, options);\n\n deadCodeElimination(ast, refs);\n return generate(ast, { sourceMaps: true, sourceFileName: id }, code);\n};\n","import type { UnpluginFactory } from \"unplugin\";\nimport type { Options } from \"./types\";\nimport { createUnplugin } from \"unplugin\";\nimport { transform } from \"./transform\";\n\nexport const unpluginFactory: UnpluginFactory<Options | undefined> = (options = {}) => {\n const { platform } = options;\n\n if (platform !== \"browser\") {\n return [];\n }\n\n return {\n name: \"unplugin-fragno\",\n transformInclude(id) {\n if (id.endsWith(\".d.ts\")) {\n return false;\n }\n\n if (id.includes(\"@fragno-dev/unplugin-fragno\") || id.includes(\"@fragno-dev/core\")) {\n return false;\n }\n\n return true;\n },\n transform(code, id) {\n return transform(code, id, { ssr: false });\n },\n };\n};\n\nexport const unplugin = /* #__PURE__ */ createUnplugin(unpluginFactory);\n\nexport default unplugin;\nexport type { Options };\nexport { isMacroBinding } from \"./transform-macros\";\n"],"mappings":";;;;;;;;;;AAcA,MAAM,kBAAkB,GAAGA,KAAQ;AAEnC,MAAa,kBAAkB,SAAkB,UAA2B;AAC1E,KAAI,CAAC,EAAE,oBAAoB,SAAS,KAAK,OAAO,CAAE,QAAO;AACzD,KAAI,QAAQ,KAAK,OAAO,OAAO,UAAU,gBAAiB,QAAO;AAEjE,KAAI,CAAC,EAAE,kBAAkB,SAAS,KAAK,KAAK,CAAE,QAAO;CACrD,MAAM,EAAE,aAAa,QAAQ,KAAK;AAClC,KAAI,CAAC,EAAE,aAAa,SAAS,CAAE,QAAO;AACtC,KAAI,SAAS,SAAS,MAAO,QAAO;AACpC,QAAO;;AAGT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AAiB,IAAI;AACnB,OAAI,GAAG,SAAS,QAAQ,CACtB,QAAO;AAGT,OAAI,GAAG,SAAS,8BAA8B,IAAI,GAAG,SAAS,mBAAmB,CAC/E,QAAO;AAGT,UAAO;;EAET,UAAU,MAAM,IAAI;AAClB,UAAO,UAAU,MAAM,IAAI,EAAE,KAAK,OAAO,CAAC;;EAE7C;;AAGH,MAAa,WAA2B,+BAAe,gBAAgB;AAEvE,kBAAe"}
@@ -0,0 +1,8 @@
1
+ //#region src/types.d.ts
2
+ interface Options {
3
+ platform?: "browser" | "node";
4
+ }
5
+ //# sourceMappingURL=types.d.ts.map
6
+ //#endregion
7
+ export { Options };
8
+ //# sourceMappingURL=types-B2lQo1ln.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-B2lQo1ln.d.ts","names":[],"sources":["../../src/types.ts"],"sourcesContent":[],"mappings":";UAAiB,OAAA;EAAA,QAAA,CAAA,EAAO,SAAA,GAAA,MAAA"}
@@ -0,0 +1,9 @@
1
+ import { unpluginFactory } from "./src--rYTODVa.js";
2
+ import { createVitePlugin } from "unplugin";
3
+
4
+ //#region src/integrations/vite.ts
5
+ var vite_default = createVitePlugin(unpluginFactory);
6
+
7
+ //#endregion
8
+ export { vite_default };
9
+ //# sourceMappingURL=vite-CXr48_Nq.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite-CXr48_Nq.js","names":[],"sources":["../src/integrations/vite.ts"],"sourcesContent":["import { createVitePlugin } from \"unplugin\";\nimport { unpluginFactory } from \"..\";\n\nexport default createVitePlugin(unpluginFactory);\n"],"mappings":";;;;AAGA,mBAAe,iBAAiB,gBAAgB"}
@@ -0,0 +1,9 @@
1
+ import { unpluginFactory } from "./src--rYTODVa.js";
2
+ import { createWebpackPlugin } from "unplugin";
3
+
4
+ //#region src/integrations/webpack.ts
5
+ var webpack_default = createWebpackPlugin(unpluginFactory);
6
+
7
+ //#endregion
8
+ export { webpack_default };
9
+ //# sourceMappingURL=webpack-BHY3Ecxw.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webpack-BHY3Ecxw.js","names":[],"sources":["../src/integrations/webpack.ts"],"sourcesContent":["import { createWebpackPlugin } from \"unplugin\";\nimport { unpluginFactory } from \"..\";\n\nexport default createWebpackPlugin(unpluginFactory);\n"],"mappings":";;;;AAGA,sBAAe,oBAAoB,gBAAgB"}
package/package.json ADDED
@@ -0,0 +1,155 @@
1
+ {
2
+ "name": "@fragno-dev/unplugin-fragno",
3
+ "type": "module",
4
+ "version": "0.0.1",
5
+ "description": "",
6
+ "keywords": [
7
+ "fragno",
8
+ "unplugin"
9
+ ],
10
+ "exports": {
11
+ ".": {
12
+ "bun": "./src/index.ts",
13
+ "development": "./src/index.ts",
14
+ "types": "./dist/index.d.ts",
15
+ "default": "./dist/index.js"
16
+ },
17
+ "./macros": {
18
+ "bun": "./src/macros.ts",
19
+ "development": "./src/macros.ts",
20
+ "types": "./dist/macros.d.ts",
21
+ "default": "./dist/macros.js"
22
+ },
23
+ "./astro": {
24
+ "bun": "./src/integrations/astro.ts",
25
+ "development": "./src/integrations/astro.ts",
26
+ "types": "./dist/integrations/astro.d.ts",
27
+ "default": "./dist/integrations/astro.js"
28
+ },
29
+ "./esbuild": {
30
+ "bun": "./src/integrations/esbuild.ts",
31
+ "development": "./src/integrations/esbuild.ts",
32
+ "types": "./dist/integrations/esbuild.d.ts",
33
+ "default": "./dist/integrations/esbuild.js"
34
+ },
35
+ "./farm": {
36
+ "bun": "./src/integrations/farm.ts",
37
+ "development": "./src/integrations/farm.ts",
38
+ "types": "./dist/integrations/farm.d.ts",
39
+ "default": "./dist/integrations/farm.js"
40
+ },
41
+ "./nuxt": {
42
+ "bun": "./src/integrations/nuxt.ts",
43
+ "development": "./src/integrations/nuxt.ts",
44
+ "types": "./dist/integrations/nuxt.d.ts",
45
+ "default": "./dist/integrations/nuxt.js"
46
+ },
47
+ "./rollup": {
48
+ "bun": "./src/integrations/rollup.ts",
49
+ "development": "./src/integrations/rollup.ts",
50
+ "types": "./dist/integrations/rollup.d.ts",
51
+ "default": "./dist/integrations/rollup.js"
52
+ },
53
+ "./rspack": {
54
+ "bun": "./src/integrations/rspack.ts",
55
+ "development": "./src/integrations/rspack.ts",
56
+ "types": "./dist/integrations/rspack.d.ts",
57
+ "default": "./dist/integrations/rspack.js"
58
+ },
59
+ "./vite": {
60
+ "bun": "./src/integrations/vite.ts",
61
+ "development": "./src/integrations/vite.ts",
62
+ "types": "./dist/integrations/vite.d.ts",
63
+ "default": "./dist/integrations/vite.js"
64
+ },
65
+ "./webpack": {
66
+ "bun": "./src/integrations/webpack.ts",
67
+ "development": "./src/integrations/webpack.ts",
68
+ "types": "./dist/integrations/webpack.d.ts",
69
+ "default": "./dist/integrations/webpack.js"
70
+ },
71
+ "./types": "./dist/types.js",
72
+ "./package.json": "./package.json"
73
+ },
74
+ "main": "./dist/index.js",
75
+ "module": "./dist/index.js",
76
+ "types": "./dist/index.d.ts",
77
+ "typesVersions": {
78
+ "*": {
79
+ "*": [
80
+ "./dist/*",
81
+ "./*"
82
+ ]
83
+ }
84
+ },
85
+ "files": [
86
+ "dist"
87
+ ],
88
+ "scripts": {
89
+ "types:check": "tsc --noEmit",
90
+ "build": "tsdown",
91
+ "build:watch": "tsdown --watch",
92
+ "test": "vitest"
93
+ },
94
+ "peerDependencies": {
95
+ "@farmfe/core": ">=1",
96
+ "@nuxt/kit": "^3 || ^4",
97
+ "@nuxt/schema": "^3 || ^4",
98
+ "esbuild": "*",
99
+ "rollup": "^3",
100
+ "vite": ">=3",
101
+ "webpack": "^4 || ^5"
102
+ },
103
+ "peerDependenciesMeta": {
104
+ "@farmfe/core": {
105
+ "optional": true
106
+ },
107
+ "@nuxt/kit": {
108
+ "optional": true
109
+ },
110
+ "@nuxt/schema": {
111
+ "optional": true
112
+ },
113
+ "esbuild": {
114
+ "optional": true
115
+ },
116
+ "rollup": {
117
+ "optional": true
118
+ },
119
+ "vite": {
120
+ "optional": true
121
+ },
122
+ "webpack": {
123
+ "optional": true
124
+ }
125
+ },
126
+ "dependencies": {
127
+ "unplugin": "^2.3.4",
128
+ "@babel/core": "^7.23.7",
129
+ "@babel/generator": "^7.23.6",
130
+ "@babel/parser": "^7.23.6",
131
+ "@babel/traverse": "^7.23.7",
132
+ "@babel/types": "^7.23.6",
133
+ "babel-dead-code-elimination": "^1.0.6"
134
+ },
135
+ "devDependencies": {
136
+ "@antfu/eslint-config": "^4.13.2",
137
+ "@fragno-private/typescript-config": "0.0.1",
138
+ "@nuxt/kit": "^4.0.3",
139
+ "@nuxt/schema": "^4.0.3",
140
+ "@types/babel__core": "^7.20.5",
141
+ "@types/babel__generator": "^7.6.8",
142
+ "@types/babel__traverse": "^7.20.5",
143
+ "@types/node": "^22.15.21",
144
+ "dedent": "^1.7.0",
145
+ "eslint": "^9.27.0",
146
+ "nodemon": "^3.1.10",
147
+ "rollup": "^4.41.0",
148
+ "tsdown": "^0.12.0",
149
+ "tsx": "^4.19.4",
150
+ "typescript": "^5.8.3",
151
+ "vite": "^6.3.5",
152
+ "vitest": "^3.1.4",
153
+ "webpack": "^5.99.9"
154
+ }
155
+ }