@torpor/unplugin 0.2.1 → 1.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.
- package/dist/{astro.d.ts → astro.d.mts} +2 -3
- package/dist/astro.d.mts.map +1 -0
- package/dist/{astro.js → astro.mjs} +4 -5
- package/dist/astro.mjs.map +1 -0
- package/dist/{esbuild.d.ts → esbuild.d.mts} +2 -3
- package/dist/esbuild.d.mts.map +1 -0
- package/dist/esbuild.mjs +8 -0
- package/dist/esbuild.mjs.map +1 -0
- package/dist/{index.d.ts → index.d.mts} +2 -3
- package/dist/index.d.mts.map +1 -0
- package/dist/{src-DwW80l3g.js → index.mjs} +6 -8
- package/dist/index.mjs.map +1 -0
- package/dist/{nuxt.d.ts → nuxt.d.mts} +2 -3
- package/dist/nuxt.d.mts.map +1 -0
- package/dist/nuxt.mjs +20 -0
- package/dist/nuxt.mjs.map +1 -0
- package/dist/{rollup.d.ts → rollup.d.mts} +2 -3
- package/dist/rollup.d.mts.map +1 -0
- package/dist/rollup.mjs +8 -0
- package/dist/rollup.mjs.map +1 -0
- package/dist/{rspack.d.ts → rspack.d.mts} +2 -3
- package/dist/rspack.d.mts.map +1 -0
- package/dist/rspack.mjs +8 -0
- package/dist/rspack.mjs.map +1 -0
- package/dist/types.d.mts +23 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +1 -0
- package/dist/{vite.d.ts → vite.d.mts} +2 -3
- package/dist/vite.d.mts.map +1 -0
- package/dist/vite.mjs +8 -0
- package/dist/vite.mjs.map +1 -0
- package/dist/{webpack.d.ts → webpack.d.mts} +2 -3
- package/dist/webpack.d.mts.map +1 -0
- package/dist/webpack.mjs +8 -0
- package/dist/webpack.mjs.map +1 -0
- package/package.json +38 -42
- package/dist/astro.d.ts.map +0 -1
- package/dist/astro.js.map +0 -1
- package/dist/esbuild.d.ts.map +0 -1
- package/dist/esbuild.js +0 -10
- package/dist/esbuild.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -3
- package/dist/nuxt.d.ts.map +0 -1
- package/dist/nuxt.js +0 -23
- package/dist/nuxt.js.map +0 -1
- package/dist/rollup.d.ts.map +0 -1
- package/dist/rollup.js +0 -10
- package/dist/rollup.js.map +0 -1
- package/dist/rspack.d.ts.map +0 -1
- package/dist/rspack.js +0 -10
- package/dist/rspack.js.map +0 -1
- package/dist/src-DwW80l3g.js.map +0 -1
- package/dist/types-ZsfXj8_y.d.ts +0 -18
- package/dist/types-ZsfXj8_y.d.ts.map +0 -1
- package/dist/types.d.ts +0 -2
- package/dist/types.js +0 -1
- package/dist/vite-CORCTD4q.js +0 -10
- package/dist/vite-CORCTD4q.js.map +0 -1
- package/dist/vite.d.ts.map +0 -1
- package/dist/vite.js +0 -4
- package/dist/webpack-C7qBCJQK.js +0 -10
- package/dist/webpack-C7qBCJQK.js.map +0 -1
- package/dist/webpack.d.ts.map +0 -1
- package/dist/webpack.js +0 -4
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import Options from "./types.mjs";
|
|
3
2
|
//#region src/astro.d.ts
|
|
4
3
|
declare const _default: (options: Options) => {
|
|
5
4
|
name: string;
|
|
@@ -9,4 +8,4 @@ declare const _default: (options: Options) => {
|
|
|
9
8
|
};
|
|
10
9
|
//#endregion
|
|
11
10
|
export { _default as default };
|
|
12
|
-
//# sourceMappingURL=astro.d.
|
|
11
|
+
//# sourceMappingURL=astro.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"astro.d.mts","names":[],"sources":["../src/astro.ts"],"mappings":";;cAGA,WAAgB,SAAS;EACxB;EACA;IACC,uBAA6B,eAAa"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import unplugin from "./index.mjs";
|
|
3
2
|
//#region src/astro.ts
|
|
4
3
|
var astro_default = (options) => ({
|
|
5
4
|
name: "unplugin-torpor",
|
|
6
5
|
hooks: { "astro:config:setup": async (astro) => {
|
|
7
6
|
astro.config.vite.plugins ||= [];
|
|
8
|
-
astro.config.vite.plugins.push(
|
|
7
|
+
astro.config.vite.plugins.push(unplugin.vite(options));
|
|
9
8
|
} }
|
|
10
9
|
});
|
|
11
|
-
|
|
12
10
|
//#endregion
|
|
13
11
|
export { astro_default as default };
|
|
14
|
-
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=astro.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"astro.mjs","names":[],"sources":["../src/astro.ts"],"sourcesContent":["import unplugin from \".\";\nimport type Options from \"./types\";\n\nexport default (options: Options) => ({\n\tname: \"unplugin-torpor\",\n\thooks: {\n\t\t\"astro:config:setup\": async (astro: any): Promise<void> => {\n\t\t\tastro.config.vite.plugins ||= [];\n\t\t\tastro.config.vite.plugins.push(unplugin.vite(options));\n\t\t},\n\t},\n});\n"],"mappings":";;AAGA,IAAA,iBAAgB,aAAsB;CACrC,MAAM;CACN,OAAO,EACN,sBAAsB,OAAO,UAA8B;EAC1D,MAAM,OAAO,KAAK,YAAY,CAAC;EAC/B,MAAM,OAAO,KAAK,QAAQ,KAAK,SAAS,KAAK,OAAO,CAAC;CACtD,EACD;AACD"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Options from "./types.mjs";
|
|
2
2
|
import { Plugin } from "esbuild";
|
|
3
|
-
|
|
4
3
|
//#region src/esbuild.d.ts
|
|
5
4
|
declare const plugin: (options?: Options) => Plugin;
|
|
6
5
|
//#endregion
|
|
7
6
|
export { plugin as default };
|
|
8
|
-
//# sourceMappingURL=esbuild.d.
|
|
7
|
+
//# sourceMappingURL=esbuild.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"esbuild.d.mts","names":[],"sources":["../src/esbuild.ts"],"mappings":";;;cAKM,SAAS,UAAU,YAAY"}
|
package/dist/esbuild.mjs
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { unpluginFactory } from "./index.mjs";
|
|
2
|
+
import { createEsbuildPlugin } from "unplugin";
|
|
3
|
+
//#region src/esbuild.ts
|
|
4
|
+
const plugin = createEsbuildPlugin(unpluginFactory);
|
|
5
|
+
//#endregion
|
|
6
|
+
export { plugin as default };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=esbuild.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"esbuild.mjs","names":[],"sources":["../src/esbuild.ts"],"sourcesContent":["import type { Plugin } from \"esbuild\";\nimport { createEsbuildPlugin } from \"unplugin\";\nimport { unpluginFactory } from \".\";\nimport type Options from \"./types\";\n\nconst plugin: (options?: Options) => Plugin = createEsbuildPlugin(unpluginFactory);\n\nexport default plugin;\n"],"mappings":";;;AAKA,MAAM,SAAwC,oBAAoB,eAAe"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Options from "./types.mjs";
|
|
2
2
|
import { UnpluginFactory, UnpluginInstance } from "unplugin";
|
|
3
|
-
|
|
4
3
|
//#region src/index.d.ts
|
|
5
4
|
declare const unpluginFactory: UnpluginFactory<Options | undefined>;
|
|
6
5
|
declare const unplugin: UnpluginInstance<Options | undefined, boolean>;
|
|
7
6
|
//#endregion
|
|
8
7
|
export { unplugin as default, unplugin, unpluginFactory };
|
|
9
|
-
//# sourceMappingURL=index.d.
|
|
8
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;cAQa,iBAAiB,gBAAgB;cA2GjC,UAAU,iBAAiB"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { build, parse } from "@torpor/view/compile";
|
|
2
2
|
import { createUnplugin } from "unplugin";
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { transformWithOxc } from "vite";
|
|
5
4
|
//#region src/index.ts
|
|
6
5
|
const styles = /* @__PURE__ */ new Map();
|
|
7
6
|
const unpluginFactory = (options) => ({
|
|
@@ -56,11 +55,10 @@ function transform(template, id, options) {
|
|
|
56
55
|
transformed = `import '${style.hash}.css';\n` + transformed;
|
|
57
56
|
styles.set(style.hash + ".css", style.style);
|
|
58
57
|
}
|
|
59
|
-
return
|
|
58
|
+
return transformWithOxc(transformed, id.replace(/\.torp.*$/, ".ts"));
|
|
60
59
|
}
|
|
61
|
-
const unplugin = /*
|
|
62
|
-
var src_default = unplugin;
|
|
63
|
-
|
|
60
|
+
const unplugin = /* #__PURE__ */ createUnplugin(unpluginFactory);
|
|
64
61
|
//#endregion
|
|
65
|
-
export { unplugin as
|
|
66
|
-
|
|
62
|
+
export { unplugin as default, unplugin, unpluginFactory };
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { type Template, build, parse } from \"@torpor/view/compile\";\nimport { type UnpluginFactory, type UnpluginInstance } from \"unplugin\";\nimport { createUnplugin } from \"unplugin\";\nimport { transformWithOxc } from \"vite\";\nimport type Options from \"./types\";\n\nconst styles = new Map<string, string>();\n\nexport const unpluginFactory: UnpluginFactory<Options | undefined> = (options) => ({\n\tname: \"unplugin-torpor\",\n\tresolveId(id /*, importer, options*/) {\n\t\tif (styles.has(id)) {\n\t\t\treturn id;\n\t\t}\n\t\treturn undefined;\n\t},\n\tload(id) {\n\t\tif (styles.has(id)) {\n\t\t\treturn styles.get(id);\n\t\t}\n\t\treturn undefined;\n\t},\n\ttransformInclude(id) {\n\t\t// Check for *.torp files\n\t\treturn /\\.torp\\?*/.test(id);\n\t},\n\t// @ts-ignore\n\ttransform(code, id, viteOptions) {\n\t\t// We may be in dev mode\n\t\tif (viteOptions && viteOptions.dev !== undefined) {\n\t\t\toptions ??= {};\n\t\t\toptions.dev = viteOptions.dev;\n\t\t}\n\n\t\t// Vite can override user server options\n\t\tif (viteOptions && viteOptions.ssr !== undefined) {\n\t\t\toptions ??= {};\n\t\t\toptions.server = viteOptions.ssr;\n\t\t}\n\n\t\t// But when testing we always generate for the server\n\t\tif (options?.test) {\n\t\t\toptions.server = true;\n\t\t}\n\n\t\t// Try to parse the code\n\t\tlet parsed = parse(code);\n\t\tif (parsed.ok && parsed.template) {\n\t\t\t// Transform for server or client\n\t\t\treturn transform(parsed.template, id, options);\n\t\t} else {\n\t\t\t// Show an error component\n\t\t\tlet name = id\n\t\t\t\t.split(/[\\\\/]/)\n\t\t\t\t.at(-1)\n\t\t\t\t.replace(/\\.torp$/, \"\")!;\n\t\t\tlet errorMessages = parsed.errors.map(\n\t\t\t\t(e) => `${e.startLine + 1},${e.startChar}: ${e.message}`,\n\t\t\t);\n\t\t\tconsole.log(`\\nERRORS: ${id}\\n======\\n${errorMessages.join(\"\\n\")}`);\n\t\t\tlet errorCode = `\nexport default function Error() {\n\t@render {\n\t\t<div style=\"background-color: #222; color: #f44\"; font-size: 15px; line-height: 1.5;\">\n\t\t\t<p style=\"margin: 0; padding: 0;\">\n\t\t\t\t<strong>Error${parsed.errors.length === 1 ? \"\" : \"s\"} in ${name}:</strong>\n\t\t\t</p>\n\t\t\t<ul style=\"margin: 0; padding: 0 20px\">\n\t\t\t\t${errorMessages.map((e) => `<li>${e}</li>`).join(\"\\n\")}\n\t\t\t</ul>\n\t\t</div>\n\t}\n}`;\n\t\t\tlet errorParsed = parse(errorCode);\n\t\t\tif (errorParsed.ok && errorParsed.template) {\n\t\t\t\treturn transform(errorParsed.template, id, options);\n\t\t\t}\n\t\t\t// This should never be reached, but just in case...\n\t\t\tthrow new Error(`Parse failed for ${id}, ${errorMessages.join(\"\\n\")}`);\n\t\t}\n\t},\n});\n\nfunction transform(template: Template, id: string, options?: Options) {\n\tconst built = build(template, options);\n\tlet transformed = built.code;\n\n\tif (built.styles) {\n\t\tfor (let style of built.styles) {\n\t\t\t// Add a dynamic import for the component's CSS with a name from\n\t\t\t// the hash and add the styles to a map. Then resolveId will\n\t\t\t// pass the CSS id onto load, which will load the the actual CSS\n\t\t\t// from the map\n\t\t\ttransformed = `import '${style.hash}.css';\\n` + transformed;\n\t\t\tstyles.set(style.hash + \".css\", style.style);\n\t\t}\n\t}\n\n\t//printTransformed(transformed);\n\n\t// TODO: Compile typescript only if script lang=\"ts\" or config.lang=\"ts\"\n\treturn transformWithOxc(transformed, id.replace(/\\.torp.*$/, \".ts\"));\n}\n\n/*\nfunction printTransformed(transformed: string) {\n\tconsole.log(\n\t\ttransformed\n\t\t\t.split(\"\\n\")\n\t\t\t.map((l, i) => `${(i + 1).toString().padEnd(3)} ${l}`)\n\t\t\t.join(\"\\n\"),\n\t);\n}\n*/\n\nexport const unplugin: UnpluginInstance<Options | undefined, boolean> =\n\t/* #__PURE__ */ createUnplugin(unpluginFactory);\n\nexport default unplugin;\n"],"mappings":";;;;AAMA,MAAM,yBAAS,IAAI,IAAoB;AAEvC,MAAa,mBAAyD,aAAa;CAClF,MAAM;CACN,UAAU,IAA4B;EACrC,IAAI,OAAO,IAAI,EAAE,GAChB,OAAO;CAGT;CACA,KAAK,IAAI;EACR,IAAI,OAAO,IAAI,EAAE,GAChB,OAAO,OAAO,IAAI,EAAE;CAGtB;CACA,iBAAiB,IAAI;EAEpB,OAAO,YAAY,KAAK,EAAE;CAC3B;CAEA,UAAU,MAAM,IAAI,aAAa;EAEhC,IAAI,eAAe,YAAY,QAAQ,KAAA,GAAW;GACjD,YAAY,CAAC;GACb,QAAQ,MAAM,YAAY;EAC3B;EAGA,IAAI,eAAe,YAAY,QAAQ,KAAA,GAAW;GACjD,YAAY,CAAC;GACb,QAAQ,SAAS,YAAY;EAC9B;EAGA,IAAI,SAAS,MACZ,QAAQ,SAAS;EAIlB,IAAI,SAAS,MAAM,IAAI;EACvB,IAAI,OAAO,MAAM,OAAO,UAEvB,OAAO,UAAU,OAAO,UAAU,IAAI,OAAO;OACvC;GAEN,IAAI,OAAO,GACT,MAAM,OAAO,CAAC,CACd,GAAG,EAAE,CAAC,CACN,QAAQ,WAAW,EAAE;GACvB,IAAI,gBAAgB,OAAO,OAAO,KAChC,MAAM,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,UAAU,IAAI,EAAE,SAChD;GACA,QAAQ,IAAI,aAAa,GAAG,YAAY,cAAc,KAAK,IAAI,GAAG;GAclE,IAAI,cAAc,MAAM;;;;;mBARR,OAAO,OAAO,WAAW,IAAI,KAAK,IAAI,MAAM,KAAK;;;MAG9D,cAAc,KAAK,MAAM,OAAO,EAAE,MAAM,CAAC,CAAC,KAAK,IAAI,EAAE;;;;EAKvB;GACjC,IAAI,YAAY,MAAM,YAAY,UACjC,OAAO,UAAU,YAAY,UAAU,IAAI,OAAO;GAGnD,MAAM,IAAI,MAAM,oBAAoB,GAAG,IAAI,cAAc,KAAK,IAAI,GAAG;EACtE;CACD;AACD;AAEA,SAAS,UAAU,UAAoB,IAAY,SAAmB;CACrE,MAAM,QAAQ,MAAM,UAAU,OAAO;CACrC,IAAI,cAAc,MAAM;CAExB,IAAI,MAAM,QACT,KAAK,IAAI,SAAS,MAAM,QAAQ;EAK/B,cAAc,WAAW,MAAM,KAAK,YAAY;EAChD,OAAO,IAAI,MAAM,OAAO,QAAQ,MAAM,KAAK;CAC5C;CAMD,OAAO,iBAAiB,aAAa,GAAG,QAAQ,aAAa,KAAK,CAAC;AACpE;AAaA,MAAa,WACI,+BAAe,eAAe"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Options from "./types.mjs";
|
|
2
2
|
import { NuxtModule } from "@nuxt/schema";
|
|
3
|
-
|
|
4
3
|
//#region src/nuxt.d.ts
|
|
5
4
|
interface ModuleOptions extends Options {}
|
|
6
5
|
declare const plugin: NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
7
6
|
//#endregion
|
|
8
7
|
export { ModuleOptions, plugin as default };
|
|
9
|
-
//# sourceMappingURL=nuxt.d.
|
|
8
|
+
//# sourceMappingURL=nuxt.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nuxt.d.mts","names":[],"sources":["../src/nuxt.ts"],"mappings":";;;UAOiB,sBAAsB;cAEjC,QAAQ,WAAW,eAAe"}
|
package/dist/nuxt.mjs
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import plugin$1 from "./vite.mjs";
|
|
2
|
+
import plugin$2 from "./webpack.mjs";
|
|
3
|
+
import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from "@nuxt/kit";
|
|
4
|
+
import "@nuxt/schema";
|
|
5
|
+
//#region src/nuxt.ts
|
|
6
|
+
const plugin = defineNuxtModule({
|
|
7
|
+
meta: {
|
|
8
|
+
name: "nuxt-unplugin-torpor",
|
|
9
|
+
configKey: "unpluginStarter"
|
|
10
|
+
},
|
|
11
|
+
defaults: {},
|
|
12
|
+
setup(options, _nuxt) {
|
|
13
|
+
addVitePlugin(() => plugin$1(options));
|
|
14
|
+
addWebpackPlugin(() => plugin$2(options));
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
//#endregion
|
|
18
|
+
export { plugin as default };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=nuxt.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nuxt.mjs","names":["vite","webpack"],"sources":["../src/nuxt.ts"],"sourcesContent":["import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from \"@nuxt/kit\";\nimport \"@nuxt/schema\";\nimport type { NuxtModule } from \"@nuxt/schema\";\nimport type Options from \"./types\";\nimport vite from \"./vite\";\nimport webpack from \"./webpack\";\n\nexport interface ModuleOptions extends Options {}\n\nconst plugin: NuxtModule<ModuleOptions, ModuleOptions, false> = defineNuxtModule<ModuleOptions>({\n\tmeta: {\n\t\tname: \"nuxt-unplugin-torpor\",\n\t\tconfigKey: \"unpluginStarter\",\n\t},\n\tdefaults: {\n\t\t// ...default options\n\t},\n\tsetup(options, _nuxt) {\n\t\taddVitePlugin(() => vite(options));\n\t\taddWebpackPlugin(() => webpack(options));\n\n\t\t// ...\n\t},\n});\n\nexport default plugin;\n"],"mappings":";;;;;AASA,MAAM,SAA0D,iBAAgC;CAC/F,MAAM;EACL,MAAM;EACN,WAAW;CACZ;CACA,UAAU,CAEV;CACA,MAAM,SAAS,OAAO;EACrB,oBAAoBA,SAAK,OAAO,CAAC;EACjC,uBAAuBC,SAAQ,OAAO,CAAC;CAGxC;AACD,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Options from "./types.mjs";
|
|
2
2
|
import { Plugin } from "rollup";
|
|
3
|
-
|
|
4
3
|
//#region src/rollup.d.ts
|
|
5
4
|
declare const plugin: (options?: Options) => Plugin<any> | Plugin<any>[];
|
|
6
5
|
//#endregion
|
|
7
6
|
export { plugin as default };
|
|
8
|
-
//# sourceMappingURL=rollup.d.
|
|
7
|
+
//# sourceMappingURL=rollup.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rollup.d.mts","names":[],"sources":["../src/rollup.ts"],"mappings":";;;cAKM,SAAS,UAAU,YAAY,cAAc"}
|
package/dist/rollup.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rollup.mjs","names":[],"sources":["../src/rollup.ts"],"sourcesContent":["import type { Plugin } from \"rollup\";\nimport { createRollupPlugin } from \"unplugin\";\nimport { unpluginFactory } from \".\";\nimport type Options from \"./types\";\n\nconst plugin: (options?: Options) => Plugin<any> | Plugin<any>[] =\n\tcreateRollupPlugin(unpluginFactory);\n\nexport default plugin;\n"],"mappings":";;;AAKA,MAAM,SACL,mBAAmB,eAAe"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Options from "./types.mjs";
|
|
2
2
|
import { RspackPluginInstance } from "unplugin";
|
|
3
|
-
|
|
4
3
|
//#region src/rspack.d.ts
|
|
5
4
|
declare const plugin: (options?: Options) => RspackPluginInstance;
|
|
6
5
|
//#endregion
|
|
7
6
|
export { plugin as default };
|
|
8
|
-
//# sourceMappingURL=rspack.d.
|
|
7
|
+
//# sourceMappingURL=rspack.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rspack.d.mts","names":[],"sources":["../src/rspack.ts"],"mappings":";;;cAIM,SAAS,UAAU,YAAY"}
|
package/dist/rspack.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rspack.mjs","names":[],"sources":["../src/rspack.ts"],"sourcesContent":["import { type RspackPluginInstance, createRspackPlugin } from \"unplugin\";\nimport { unpluginFactory } from \".\";\nimport type Options from \"./types\";\n\nconst plugin: (options?: Options) => RspackPluginInstance = createRspackPlugin(unpluginFactory);\n\nexport default plugin;\n"],"mappings":";;;AAIA,MAAM,SAAsD,mBAAmB,eAAe"}
|
package/dist/types.d.mts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
interface Options {
|
|
3
|
+
/**
|
|
4
|
+
* Whether to generate server components which will render HTML
|
|
5
|
+
*/
|
|
6
|
+
server?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Whether the plugin is running in a dev environment
|
|
9
|
+
*/
|
|
10
|
+
dev?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Whether the plugin is running in a test context
|
|
13
|
+
*/
|
|
14
|
+
test?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Whether to preserve all whitespace text nodes from templates. Defaults to
|
|
17
|
+
* false (whitespace is trimmed Svelte 5-style). See BuildOptions.
|
|
18
|
+
*/
|
|
19
|
+
preserveWhitespace?: boolean;
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { Options as default };
|
|
23
|
+
//# sourceMappingURL=types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../src/types.ts"],"mappings":";UAAyB;;;;EAIxB;;;;EAIA;;;;EAIA;;;;;EAKA"}
|
package/dist/types.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Options from "./types.mjs";
|
|
2
2
|
import { Plugin } from "vite";
|
|
3
|
-
|
|
4
3
|
//#region src/vite.d.ts
|
|
5
4
|
declare const plugin: (options?: Options) => Plugin<any> | Plugin<any>[];
|
|
6
5
|
//#endregion
|
|
7
6
|
export { plugin as default };
|
|
8
|
-
//# sourceMappingURL=vite.d.
|
|
7
|
+
//# sourceMappingURL=vite.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite.d.mts","names":[],"sources":["../src/vite.ts"],"mappings":";;;cAKM,SAAS,UAAU,YAAY,cAAc"}
|
package/dist/vite.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite.mjs","names":[],"sources":["../src/vite.ts"],"sourcesContent":["import { createVitePlugin } from \"unplugin\";\nimport type { Plugin } from \"vite\";\nimport { unpluginFactory } from \".\";\nimport type Options from \"./types\";\n\nconst plugin: (options?: Options) => Plugin<any> | Plugin<any>[] =\n\tcreateVitePlugin(unpluginFactory);\n\nexport default plugin;\n"],"mappings":";;;AAKA,MAAM,SACL,iBAAiB,eAAe"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Options from "./types.mjs";
|
|
2
2
|
import { WebpackPluginInstance } from "unplugin";
|
|
3
|
-
|
|
4
3
|
//#region src/webpack.d.ts
|
|
5
4
|
declare const plugin: (options?: Options) => WebpackPluginInstance;
|
|
6
5
|
//#endregion
|
|
7
6
|
export { plugin as default };
|
|
8
|
-
//# sourceMappingURL=webpack.d.
|
|
7
|
+
//# sourceMappingURL=webpack.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webpack.d.mts","names":[],"sources":["../src/webpack.ts"],"mappings":";;;cAIM,SAAS,UAAU,YAAY"}
|
package/dist/webpack.mjs
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { unpluginFactory } from "./index.mjs";
|
|
2
|
+
import { createWebpackPlugin } from "unplugin";
|
|
3
|
+
//#region src/webpack.ts
|
|
4
|
+
const plugin = createWebpackPlugin(unpluginFactory);
|
|
5
|
+
//#endregion
|
|
6
|
+
export { plugin as default };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=webpack.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webpack.mjs","names":[],"sources":["../src/webpack.ts"],"sourcesContent":["import { type WebpackPluginInstance, createWebpackPlugin } from \"unplugin\";\nimport { unpluginFactory } from \".\";\nimport type Options from \"./types\";\n\nconst plugin: (options?: Options) => WebpackPluginInstance = createWebpackPlugin(unpluginFactory);\n\nexport default plugin;\n"],"mappings":";;;AAIA,MAAM,SAAuD,oBAAoB,eAAe"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@torpor/unplugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Unplugin package to compile Torpor components for Vite, Rollup, and other bundlers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"torpor",
|
|
@@ -9,40 +9,40 @@
|
|
|
9
9
|
"type": "module",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
|
-
"types": "./dist/index.d.
|
|
13
|
-
"import": "./dist/index.
|
|
12
|
+
"types": "./dist/index.d.mts",
|
|
13
|
+
"import": "./dist/index.mjs"
|
|
14
14
|
},
|
|
15
15
|
"./astro": {
|
|
16
|
-
"types": "./dist/astro.d.
|
|
17
|
-
"import": "./dist/astro.
|
|
16
|
+
"types": "./dist/astro.d.mts",
|
|
17
|
+
"import": "./dist/astro.mjs"
|
|
18
18
|
},
|
|
19
19
|
"./rspack": {
|
|
20
|
-
"types": "./dist/rspack.d.
|
|
21
|
-
"import": "./dist/rspack.
|
|
20
|
+
"types": "./dist/rspack.d.mts",
|
|
21
|
+
"import": "./dist/rspack.mjs"
|
|
22
22
|
},
|
|
23
23
|
"./vite": {
|
|
24
|
-
"types": "./dist/vite.d.
|
|
25
|
-
"import": "./dist/vite.
|
|
24
|
+
"types": "./dist/vite.d.mts",
|
|
25
|
+
"import": "./dist/vite.mjs"
|
|
26
26
|
},
|
|
27
27
|
"./webpack": {
|
|
28
|
-
"types": "./dist/webpack.d.
|
|
29
|
-
"import": "./dist/webpack.
|
|
28
|
+
"types": "./dist/webpack.d.mts",
|
|
29
|
+
"import": "./dist/webpack.mjs"
|
|
30
30
|
},
|
|
31
31
|
"./rollup": {
|
|
32
|
-
"types": "./dist/rollup.d.
|
|
33
|
-
"import": "./dist/rollup.
|
|
32
|
+
"types": "./dist/rollup.d.mts",
|
|
33
|
+
"import": "./dist/rollup.mjs"
|
|
34
34
|
},
|
|
35
35
|
"./esbuild": {
|
|
36
|
-
"types": "./dist/esbuild.d.
|
|
37
|
-
"import": "./dist/esbuild.
|
|
36
|
+
"types": "./dist/esbuild.d.mts",
|
|
37
|
+
"import": "./dist/esbuild.mjs"
|
|
38
38
|
},
|
|
39
39
|
"./nuxt": {
|
|
40
|
-
"types": "./dist/nuxt.d.
|
|
41
|
-
"import": "./dist/nuxt.
|
|
40
|
+
"types": "./dist/nuxt.d.mts",
|
|
41
|
+
"import": "./dist/nuxt.mjs"
|
|
42
42
|
},
|
|
43
43
|
"./types": {
|
|
44
|
-
"types": "./dist/types.d.
|
|
45
|
-
"import": "./dist/types.
|
|
44
|
+
"types": "./dist/types.d.mts",
|
|
45
|
+
"import": "./dist/types.mjs"
|
|
46
46
|
},
|
|
47
47
|
"./*": "./*"
|
|
48
48
|
},
|
|
@@ -89,36 +89,32 @@
|
|
|
89
89
|
}
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
|
-
"unplugin": "^
|
|
93
|
-
"@torpor/view": "^0.
|
|
92
|
+
"unplugin": "^3.3.0",
|
|
93
|
+
"@torpor/view": "^1.0.1"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
|
-
"@antfu/eslint-config": "^
|
|
97
|
-
"@nuxt/kit": "^4.
|
|
98
|
-
"@nuxt/schema": "^4.
|
|
99
|
-
"@
|
|
100
|
-
"@
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"eslint": "^9.38.0",
|
|
96
|
+
"@antfu/eslint-config": "^9.2.0",
|
|
97
|
+
"@nuxt/kit": "^4.5.1",
|
|
98
|
+
"@nuxt/schema": "^4.5.1",
|
|
99
|
+
"@types/node": "^26.1.2",
|
|
100
|
+
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
101
|
+
"bumpp": "^12.1.1",
|
|
102
|
+
"chalk": "^6.0.0",
|
|
103
|
+
"eslint": "^10.8.0",
|
|
105
104
|
"esno": "^4.8.0",
|
|
106
105
|
"fast-glob": "^3.3.3",
|
|
107
|
-
"nodemon": "^3.1.
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
"
|
|
112
|
-
"
|
|
113
|
-
"
|
|
114
|
-
"vite": "^7.1.12",
|
|
115
|
-
"vitest": "^4.0.4",
|
|
116
|
-
"webpack": "^5.102.1"
|
|
106
|
+
"nodemon": "^3.1.14",
|
|
107
|
+
"rimraf": "^6.1.3",
|
|
108
|
+
"rollup": "^4.62.4",
|
|
109
|
+
"typescript": "^7.0.2",
|
|
110
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@0.2.7",
|
|
111
|
+
"vite-plus": "0.2.7",
|
|
112
|
+
"webpack": "^5.109.2"
|
|
117
113
|
},
|
|
118
114
|
"scripts": {
|
|
119
|
-
"build": "tsgo --noEmit && tsdown",
|
|
120
|
-
"build:watch": "tsdown --watch src",
|
|
121
115
|
"check": "tsgo --noEmit && pnpm dlx oxlint --type-aware",
|
|
116
|
+
"build": "tsgo --noEmit && vp pack",
|
|
117
|
+
"build:watch": "vp pack --watch src",
|
|
122
118
|
"lint": "eslint .",
|
|
123
119
|
"play": "npm -C playground run dev",
|
|
124
120
|
"release": "bumpp && npm publish",
|
package/dist/astro.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"astro.d.ts","names":[],"sources":["../src/astro.ts"],"sourcesContent":[],"mappings":";;;cAGA,oBAAyB;;EAFA,KAEzB,EAAA;0CAG4C"}
|
package/dist/astro.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"astro.js","names":["unplugin"],"sources":["../src/astro.ts"],"sourcesContent":["import unplugin from \".\";\nimport type Options from \"./types\";\n\nexport default (options: Options) => ({\n\tname: \"unplugin-torpor\",\n\thooks: {\n\t\t\"astro:config:setup\": async (astro: any): Promise<void> => {\n\t\t\tastro.config.vite.plugins ||= [];\n\t\t\tastro.config.vite.plugins.push(unplugin.vite(options));\n\t\t},\n\t},\n});\n"],"mappings":";;;AAGA,qBAAgB,aAAsB;CACrC,MAAM;CACN,OAAO,EACN,sBAAsB,OAAO,UAA8B;AAC1D,QAAM,OAAO,KAAK,YAAY,EAAE;AAChC,QAAM,OAAO,KAAK,QAAQ,KAAKA,YAAS,KAAK,QAAQ,CAAC;IAEvD;CACD"}
|
package/dist/esbuild.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"esbuild.d.ts","names":["plugin: (options?: Options) => Plugin"],"sources":["../src/esbuild.ts"],"sourcesContent":[],"mappings":";;;;cAKMA,mBAAmB,YAAY"}
|
package/dist/esbuild.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { r as unpluginFactory } from "./src-DwW80l3g.js";
|
|
2
|
-
import { createEsbuildPlugin } from "unplugin";
|
|
3
|
-
|
|
4
|
-
//#region src/esbuild.ts
|
|
5
|
-
const plugin = createEsbuildPlugin(unpluginFactory);
|
|
6
|
-
var esbuild_default = plugin;
|
|
7
|
-
|
|
8
|
-
//#endregion
|
|
9
|
-
export { esbuild_default as default };
|
|
10
|
-
//# sourceMappingURL=esbuild.js.map
|
package/dist/esbuild.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"esbuild.js","names":["plugin: (options?: Options) => Plugin"],"sources":["../src/esbuild.ts"],"sourcesContent":["import type { Plugin } from \"esbuild\";\nimport { createEsbuildPlugin } from \"unplugin\";\nimport { unpluginFactory } from \".\";\nimport type Options from \"./types\";\n\nconst plugin: (options?: Options) => Plugin = createEsbuildPlugin(unpluginFactory);\n\nexport default plugin;\n"],"mappings":";;;;AAKA,MAAMA,SAAwC,oBAAoB,gBAAgB;AAElF,sBAAe"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["unpluginFactory: UnpluginFactory<Options | undefined>","unplugin: UnpluginInstance<Options | undefined, boolean>"],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;cAQaA,iBAAiB,gBAAgB;cA6GjCC,UAAU,iBAAiB"}
|
package/dist/index.js
DELETED
package/dist/nuxt.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nuxt.d.ts","names":["plugin: NuxtModule<ModuleOptions, ModuleOptions, false>"],"sources":["../src/nuxt.ts"],"sourcesContent":[],"mappings":";;;;UAOiB,aAAA,SAAsB;AAAvC,cAEMA,MAFW,EAEH,UAFyB,CAEd,aAFc,EAEC,aAFD,EAAA,KAAA,CAAA"}
|
package/dist/nuxt.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import "./src-DwW80l3g.js";
|
|
2
|
-
import { t as vite_default } from "./vite-CORCTD4q.js";
|
|
3
|
-
import { t as webpack_default } from "./webpack-C7qBCJQK.js";
|
|
4
|
-
import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from "@nuxt/kit";
|
|
5
|
-
import "@nuxt/schema";
|
|
6
|
-
|
|
7
|
-
//#region src/nuxt.ts
|
|
8
|
-
const plugin = defineNuxtModule({
|
|
9
|
-
meta: {
|
|
10
|
-
name: "nuxt-unplugin-torpor",
|
|
11
|
-
configKey: "unpluginStarter"
|
|
12
|
-
},
|
|
13
|
-
defaults: {},
|
|
14
|
-
setup(options, _nuxt) {
|
|
15
|
-
addVitePlugin(() => vite_default(options));
|
|
16
|
-
addWebpackPlugin(() => webpack_default(options));
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
var nuxt_default = plugin;
|
|
20
|
-
|
|
21
|
-
//#endregion
|
|
22
|
-
export { nuxt_default as default };
|
|
23
|
-
//# sourceMappingURL=nuxt.js.map
|
package/dist/nuxt.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nuxt.js","names":["plugin: NuxtModule<ModuleOptions, ModuleOptions, false>","vite","webpack"],"sources":["../src/nuxt.ts"],"sourcesContent":["import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from \"@nuxt/kit\";\nimport \"@nuxt/schema\";\nimport type { NuxtModule } from \"@nuxt/schema\";\nimport type Options from \"./types\";\nimport vite from \"./vite\";\nimport webpack from \"./webpack\";\n\nexport interface ModuleOptions extends Options {}\n\nconst plugin: NuxtModule<ModuleOptions, ModuleOptions, false> = defineNuxtModule<ModuleOptions>({\n\tmeta: {\n\t\tname: \"nuxt-unplugin-torpor\",\n\t\tconfigKey: \"unpluginStarter\",\n\t},\n\tdefaults: {\n\t\t// ...default options\n\t},\n\tsetup(options, _nuxt) {\n\t\taddVitePlugin(() => vite(options));\n\t\taddWebpackPlugin(() => webpack(options));\n\n\t\t// ...\n\t},\n});\n\nexport default plugin;\n"],"mappings":";;;;;;;AASA,MAAMA,SAA0D,iBAAgC;CAC/F,MAAM;EACL,MAAM;EACN,WAAW;EACX;CACD,UAAU,EAET;CACD,MAAM,SAAS,OAAO;AACrB,sBAAoBC,aAAK,QAAQ,CAAC;AAClC,yBAAuBC,gBAAQ,QAAQ,CAAC;;CAIzC,CAAC;AAEF,mBAAe"}
|
package/dist/rollup.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rollup.d.ts","names":["plugin: (options?: Options) => Plugin<any> | Plugin<any>[]"],"sources":["../src/rollup.ts"],"sourcesContent":[],"mappings":";;;;cAKMA,mBAAmB,YAAY,cAAc"}
|
package/dist/rollup.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { r as unpluginFactory } from "./src-DwW80l3g.js";
|
|
2
|
-
import { createRollupPlugin } from "unplugin";
|
|
3
|
-
|
|
4
|
-
//#region src/rollup.ts
|
|
5
|
-
const plugin = createRollupPlugin(unpluginFactory);
|
|
6
|
-
var rollup_default = plugin;
|
|
7
|
-
|
|
8
|
-
//#endregion
|
|
9
|
-
export { rollup_default as default };
|
|
10
|
-
//# sourceMappingURL=rollup.js.map
|
package/dist/rollup.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rollup.js","names":["plugin: (options?: Options) => Plugin<any> | Plugin<any>[]"],"sources":["../src/rollup.ts"],"sourcesContent":["import type { Plugin } from \"rollup\";\nimport { createRollupPlugin } from \"unplugin\";\nimport { unpluginFactory } from \".\";\nimport type Options from \"./types\";\n\nconst plugin: (options?: Options) => Plugin<any> | Plugin<any>[] =\n\tcreateRollupPlugin(unpluginFactory);\n\nexport default plugin;\n"],"mappings":";;;;AAKA,MAAMA,SACL,mBAAmB,gBAAgB;AAEpC,qBAAe"}
|
package/dist/rspack.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rspack.d.ts","names":["plugin: (options?: Options) => RspackPluginInstance"],"sources":["../src/rspack.ts"],"sourcesContent":[],"mappings":";;;;cAIMA,mBAAmB,YAAY"}
|
package/dist/rspack.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { r as unpluginFactory } from "./src-DwW80l3g.js";
|
|
2
|
-
import { createRspackPlugin } from "unplugin";
|
|
3
|
-
|
|
4
|
-
//#region src/rspack.ts
|
|
5
|
-
const plugin = createRspackPlugin(unpluginFactory);
|
|
6
|
-
var rspack_default = plugin;
|
|
7
|
-
|
|
8
|
-
//#endregion
|
|
9
|
-
export { rspack_default as default };
|
|
10
|
-
//# sourceMappingURL=rspack.js.map
|
package/dist/rspack.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rspack.js","names":["plugin: (options?: Options) => RspackPluginInstance"],"sources":["../src/rspack.ts"],"sourcesContent":["import { type RspackPluginInstance, createRspackPlugin } from \"unplugin\";\nimport { unpluginFactory } from \".\";\nimport type Options from \"./types\";\n\nconst plugin: (options?: Options) => RspackPluginInstance = createRspackPlugin(unpluginFactory);\n\nexport default plugin;\n"],"mappings":";;;;AAIA,MAAMA,SAAsD,mBAAmB,gBAAgB;AAE/F,qBAAe"}
|
package/dist/src-DwW80l3g.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"src-DwW80l3g.js","names":["unpluginFactory: UnpluginFactory<Options | undefined>","unplugin: UnpluginInstance<Options | undefined, boolean>"],"sources":["../src/index.ts"],"sourcesContent":["import { type Template, build, parse } from \"@torpor/view/compile\";\nimport { type UnpluginFactory, type UnpluginInstance } from \"unplugin\";\nimport { createUnplugin } from \"unplugin\";\nimport { transformWithEsbuild } from \"vite\";\nimport type Options from \"./types\";\n\nconst styles = new Map<string, string>();\n\nexport const unpluginFactory: UnpluginFactory<Options | undefined> = (options) => ({\n\tname: \"unplugin-torpor\",\n\tresolveId(id /*, importer, options*/) {\n\t\tif (styles.has(id)) {\n\t\t\treturn id;\n\t\t}\n\t\treturn undefined;\n\t},\n\tload(id) {\n\t\tif (styles.has(id)) {\n\t\t\treturn styles.get(id);\n\t\t}\n\t\treturn undefined;\n\t},\n\ttransformInclude(id) {\n\t\t// Check for *.torp files\n\t\treturn /\\.torp\\?*/.test(id);\n\t},\n\t// @ts-ignore\n\ttransform(code, id, viteOptions) {\n\t\t// We may be in dev mode\n\t\tif (viteOptions && viteOptions.dev !== undefined) {\n\t\t\toptions ??= {};\n\t\t\toptions.dev = viteOptions.dev;\n\t\t}\n\n\t\t// Vite can override user server options\n\t\tif (viteOptions && viteOptions.ssr !== undefined) {\n\t\t\toptions ??= {};\n\t\t\toptions.server = viteOptions.ssr;\n\t\t}\n\n\t\t// But when testing we always generate for the server\n\t\tif (options?.test) {\n\t\t\toptions.server = true;\n\t\t}\n\n\t\t// Try to parse the code\n\t\tlet parsed = parse(code);\n\t\tif (parsed.ok && parsed.template) {\n\t\t\t// Transform for server or client\n\t\t\treturn transform(parsed.template, id, options);\n\t\t} else {\n\t\t\t// Show an error component\n\t\t\tlet name = id\n\t\t\t\t.split(/[\\\\/]/)\n\t\t\t\t.at(-1)\n\t\t\t\t.replace(/\\.torp$/, \"\")!;\n\t\t\tlet errorMessages = parsed.errors.map(\n\t\t\t\t(e) => `${e.startLine + 1},${e.startChar}: ${e.message}`,\n\t\t\t);\n\t\t\tconsole.log(`\\nERRORS: ${id}\\n======\\n${errorMessages.join(\"\\n\")}`);\n\t\t\tlet errorCode = `\nexport default function Error() {\n\t@render {\n\t\t<div style=\"background-color: #222; color: #f44\"; font-size: 15px; line-height: 1.5;\">\n\t\t\t<p style=\"margin: 0; padding: 0;\">\n\t\t\t\t<strong>Error${parsed.errors.length === 1 ? \"\" : \"s\"} in ${name}:</strong>\n\t\t\t</p>\n\t\t\t<ul style=\"margin: 0; padding: 0 20px\">\n\t\t\t\t${errorMessages.map((e) => `<li>${e}</li>`).join(\"\\n\")}\n\t\t\t</ul>\n\t\t</div>\n\t}\n}`;\n\t\t\tlet errorParsed = parse(errorCode);\n\t\t\tif (errorParsed.ok && errorParsed.template) {\n\t\t\t\treturn transform(errorParsed.template, id, options);\n\t\t\t}\n\t\t\t// This should never be reached, but just in case...\n\t\t\tthrow new Error(`Parse failed for ${id}, ${errorMessages.join(\"\\n\")}`);\n\t\t}\n\t},\n});\n\nfunction transform(template: Template, id: string, options?: Options) {\n\tconst built = build(template, options);\n\tlet transformed = built.code;\n\n\tif (built.styles) {\n\t\tfor (let style of built.styles) {\n\t\t\t// Add a dynamic import for the component's CSS with a name from\n\t\t\t// the hash and add the styles to a map. Then resolveId will\n\t\t\t// pass the CSS id onto load, which will load the the actual CSS\n\t\t\t// from the map\n\t\t\ttransformed = `import '${style.hash}.css';\\n` + transformed;\n\t\t\tstyles.set(style.hash + \".css\", style.style);\n\t\t}\n\t}\n\n\t//printTransformed(transformed);\n\n\t// TODO: Compile typescript only if script lang=\"ts\" or config.lang=\"ts\"\n\treturn transformWithEsbuild(transformed, id, {\n\t\tloader: \"ts\",\n\t});\n}\n\n/*\nfunction printTransformed(transformed: string) {\n\tconsole.log(\n\t\ttransformed\n\t\t\t.split(\"\\n\")\n\t\t\t.map((l, i) => `${(i + 1).toString().padEnd(3)} ${l}`)\n\t\t\t.join(\"\\n\"),\n\t);\n}\n*/\n\nexport const unplugin: UnpluginInstance<Options | undefined, boolean> =\n\t/* #__PURE__ */ createUnplugin(unpluginFactory);\n\nexport default unplugin;\n"],"mappings":";;;;;AAMA,MAAM,yBAAS,IAAI,KAAqB;AAExC,MAAaA,mBAAyD,aAAa;CAClF,MAAM;CACN,UAAU,IAA4B;AACrC,MAAI,OAAO,IAAI,GAAG,CACjB,QAAO;;CAIT,KAAK,IAAI;AACR,MAAI,OAAO,IAAI,GAAG,CACjB,QAAO,OAAO,IAAI,GAAG;;CAIvB,iBAAiB,IAAI;AAEpB,SAAO,YAAY,KAAK,GAAG;;CAG5B,UAAU,MAAM,IAAI,aAAa;AAEhC,MAAI,eAAe,YAAY,QAAQ,QAAW;AACjD,eAAY,EAAE;AACd,WAAQ,MAAM,YAAY;;AAI3B,MAAI,eAAe,YAAY,QAAQ,QAAW;AACjD,eAAY,EAAE;AACd,WAAQ,SAAS,YAAY;;AAI9B,MAAI,SAAS,KACZ,SAAQ,SAAS;EAIlB,IAAI,SAAS,MAAM,KAAK;AACxB,MAAI,OAAO,MAAM,OAAO,SAEvB,QAAO,UAAU,OAAO,UAAU,IAAI,QAAQ;OACxC;GAEN,IAAI,OAAO,GACT,MAAM,QAAQ,CACd,GAAG,GAAG,CACN,QAAQ,WAAW,GAAG;GACxB,IAAI,gBAAgB,OAAO,OAAO,KAChC,MAAM,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,UAAU,IAAI,EAAE,UAC/C;AACD,WAAQ,IAAI,aAAa,GAAG,YAAY,cAAc,KAAK,KAAK,GAAG;GAcnE,IAAI,cAAc,MAbF;;;;;mBAKA,OAAO,OAAO,WAAW,IAAI,KAAK,IAAI,MAAM,KAAK;;;MAG9D,cAAc,KAAK,MAAM,OAAO,EAAE,OAAO,CAAC,KAAK,KAAK,CAAC;;;;GAKtB;AAClC,OAAI,YAAY,MAAM,YAAY,SACjC,QAAO,UAAU,YAAY,UAAU,IAAI,QAAQ;AAGpD,SAAM,IAAI,MAAM,oBAAoB,GAAG,IAAI,cAAc,KAAK,KAAK,GAAG;;;CAGxE;AAED,SAAS,UAAU,UAAoB,IAAY,SAAmB;CACrE,MAAM,QAAQ,MAAM,UAAU,QAAQ;CACtC,IAAI,cAAc,MAAM;AAExB,KAAI,MAAM,OACT,MAAK,IAAI,SAAS,MAAM,QAAQ;AAK/B,gBAAc,WAAW,MAAM,KAAK,YAAY;AAChD,SAAO,IAAI,MAAM,OAAO,QAAQ,MAAM,MAAM;;AAO9C,QAAO,qBAAqB,aAAa,IAAI,EAC5C,QAAQ,MACR,CAAC;;AAcH,MAAaC,WACI,+BAAe,gBAAgB;AAEhD,kBAAe"}
|
package/dist/types-ZsfXj8_y.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
//#region src/types.d.ts
|
|
2
|
-
interface Options {
|
|
3
|
-
/**
|
|
4
|
-
* Whether to generate server components which will render HTML
|
|
5
|
-
*/
|
|
6
|
-
server?: boolean;
|
|
7
|
-
/**
|
|
8
|
-
* Whether the plugin is running in a dev environment
|
|
9
|
-
*/
|
|
10
|
-
dev?: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Whether the plugin is running in a test context
|
|
13
|
-
*/
|
|
14
|
-
test?: boolean;
|
|
15
|
-
}
|
|
16
|
-
//#endregion
|
|
17
|
-
export { Options as t };
|
|
18
|
-
//# sourceMappingURL=types-ZsfXj8_y.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types-ZsfXj8_y.d.ts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";UAAyB,OAAA"}
|
package/dist/types.d.ts
DELETED
package/dist/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
package/dist/vite-CORCTD4q.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { r as unpluginFactory } from "./src-DwW80l3g.js";
|
|
2
|
-
import { createVitePlugin } from "unplugin";
|
|
3
|
-
|
|
4
|
-
//#region src/vite.ts
|
|
5
|
-
const plugin = createVitePlugin(unpluginFactory);
|
|
6
|
-
var vite_default = plugin;
|
|
7
|
-
|
|
8
|
-
//#endregion
|
|
9
|
-
export { vite_default as t };
|
|
10
|
-
//# sourceMappingURL=vite-CORCTD4q.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite-CORCTD4q.js","names":["plugin: (options?: Options) => Plugin<any> | Plugin<any>[]"],"sources":["../src/vite.ts"],"sourcesContent":["import { createVitePlugin } from \"unplugin\";\nimport type { Plugin } from \"vite\";\nimport { unpluginFactory } from \".\";\nimport type Options from \"./types\";\n\nconst plugin: (options?: Options) => Plugin<any> | Plugin<any>[] =\n\tcreateVitePlugin(unpluginFactory);\n\nexport default plugin;\n"],"mappings":";;;;AAKA,MAAMA,SACL,iBAAiB,gBAAgB;AAElC,mBAAe"}
|
package/dist/vite.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite.d.ts","names":["plugin: (options?: Options) => Plugin<any> | Plugin<any>[]"],"sources":["../src/vite.ts"],"sourcesContent":[],"mappings":";;;;cAKMA,mBAAmB,YAAY,cAAc"}
|
package/dist/vite.js
DELETED
package/dist/webpack-C7qBCJQK.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { r as unpluginFactory } from "./src-DwW80l3g.js";
|
|
2
|
-
import { createWebpackPlugin } from "unplugin";
|
|
3
|
-
|
|
4
|
-
//#region src/webpack.ts
|
|
5
|
-
const plugin = createWebpackPlugin(unpluginFactory);
|
|
6
|
-
var webpack_default = plugin;
|
|
7
|
-
|
|
8
|
-
//#endregion
|
|
9
|
-
export { webpack_default as t };
|
|
10
|
-
//# sourceMappingURL=webpack-C7qBCJQK.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webpack-C7qBCJQK.js","names":["plugin: (options?: Options) => WebpackPluginInstance"],"sources":["../src/webpack.ts"],"sourcesContent":["import { type WebpackPluginInstance, createWebpackPlugin } from \"unplugin\";\nimport { unpluginFactory } from \".\";\nimport type Options from \"./types\";\n\nconst plugin: (options?: Options) => WebpackPluginInstance = createWebpackPlugin(unpluginFactory);\n\nexport default plugin;\n"],"mappings":";;;;AAIA,MAAMA,SAAuD,oBAAoB,gBAAgB;AAEjG,sBAAe"}
|
package/dist/webpack.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webpack.d.ts","names":["plugin: (options?: Options) => WebpackPluginInstance"],"sources":["../src/webpack.ts"],"sourcesContent":[],"mappings":";;;;cAIMA,mBAAmB,YAAY"}
|
package/dist/webpack.js
DELETED