@torpor/unplugin 0.2.0 → 0.2.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 +1 -1
- package/dist/astro.js +1 -1
- package/dist/esbuild.d.ts +1 -1
- package/dist/esbuild.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/nuxt.d.ts +1 -1
- package/dist/nuxt.js +3 -3
- package/dist/rollup.d.ts +1 -1
- package/dist/rollup.js +1 -1
- package/dist/rspack.d.ts +1 -1
- package/dist/rspack.js +1 -1
- package/dist/{src-BEQhZnec.js → src-DwW80l3g.js} +8 -5
- package/dist/src-DwW80l3g.js.map +1 -0
- package/dist/{types-CEv9Jsab.d.ts → types-ZsfXj8_y.d.ts} +6 -2
- package/dist/{types-CEv9Jsab.d.ts.map → types-ZsfXj8_y.d.ts.map} +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/{vite-CJB5UoCn.js → vite-CORCTD4q.js} +3 -3
- package/dist/{vite-CJB5UoCn.js.map → vite-CORCTD4q.js.map} +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +2 -2
- package/dist/{webpack-AW8ePRX2.js → webpack-C7qBCJQK.js} +3 -3
- package/dist/{webpack-AW8ePRX2.js.map → webpack-C7qBCJQK.js.map} +1 -1
- package/dist/webpack.d.ts +1 -1
- package/dist/webpack.js +2 -2
- package/package.json +15 -15
- package/dist/src-BEQhZnec.js.map +0 -1
package/dist/astro.d.ts
CHANGED
package/dist/astro.js
CHANGED
package/dist/esbuild.d.ts
CHANGED
package/dist/esbuild.js
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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;
|
|
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
CHANGED
package/dist/nuxt.d.ts
CHANGED
package/dist/nuxt.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./src-
|
|
2
|
-
import { vite_default } from "./vite-
|
|
3
|
-
import { webpack_default } from "./webpack-
|
|
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
4
|
import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from "@nuxt/kit";
|
|
5
5
|
import "@nuxt/schema";
|
|
6
6
|
|
package/dist/rollup.d.ts
CHANGED
package/dist/rollup.js
CHANGED
package/dist/rspack.d.ts
CHANGED
package/dist/rspack.js
CHANGED
|
@@ -16,6 +16,10 @@ const unpluginFactory = (options) => ({
|
|
|
16
16
|
return /\.torp\?*/.test(id);
|
|
17
17
|
},
|
|
18
18
|
transform(code, id, viteOptions) {
|
|
19
|
+
if (viteOptions && viteOptions.dev !== void 0) {
|
|
20
|
+
options ??= {};
|
|
21
|
+
options.dev = viteOptions.dev;
|
|
22
|
+
}
|
|
19
23
|
if (viteOptions && viteOptions.ssr !== void 0) {
|
|
20
24
|
options ??= {};
|
|
21
25
|
options.server = viteOptions.ssr;
|
|
@@ -27,7 +31,7 @@ const unpluginFactory = (options) => ({
|
|
|
27
31
|
let name = id.split(/[\\/]/).at(-1).replace(/\.torp$/, "");
|
|
28
32
|
let errorMessages = parsed.errors.map((e) => `${e.startLine + 1},${e.startChar}: ${e.message}`);
|
|
29
33
|
console.log(`\nERRORS: ${id}\n======\n${errorMessages.join("\n")}`);
|
|
30
|
-
let
|
|
34
|
+
let errorParsed = parse(`
|
|
31
35
|
export default function Error() {
|
|
32
36
|
@render {
|
|
33
37
|
<div style="background-color: #222; color: #f44"; font-size: 15px; line-height: 1.5;">
|
|
@@ -39,8 +43,7 @@ export default function Error() {
|
|
|
39
43
|
</ul>
|
|
40
44
|
</div>
|
|
41
45
|
}
|
|
42
|
-
}
|
|
43
|
-
let errorParsed = parse(errorCode);
|
|
46
|
+
}`);
|
|
44
47
|
if (errorParsed.ok && errorParsed.template) return transform(errorParsed.template, id, options);
|
|
45
48
|
throw new Error(`Parse failed for ${id}, ${errorMessages.join("\n")}`);
|
|
46
49
|
}
|
|
@@ -59,5 +62,5 @@ const unplugin = /* @__PURE__ */ createUnplugin(unpluginFactory);
|
|
|
59
62
|
var src_default = unplugin;
|
|
60
63
|
|
|
61
64
|
//#endregion
|
|
62
|
-
export {
|
|
63
|
-
//# sourceMappingURL=src-
|
|
65
|
+
export { unplugin as n, unpluginFactory as r, src_default as t };
|
|
66
|
+
//# sourceMappingURL=src-DwW80l3g.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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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10
|
+
dev?: boolean;
|
|
11
|
+
/**
|
|
8
12
|
* Whether the plugin is running in a test context
|
|
9
13
|
*/
|
|
10
14
|
test?: boolean;
|
|
11
15
|
}
|
|
12
16
|
//#endregion
|
|
13
|
-
export { Options };
|
|
14
|
-
//# sourceMappingURL=types-
|
|
17
|
+
export { Options as t };
|
|
18
|
+
//# sourceMappingURL=types-ZsfXj8_y.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types-
|
|
1
|
+
{"version":3,"file":"types-ZsfXj8_y.d.ts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";UAAyB,OAAA"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Options } from "./types-
|
|
1
|
+
import { t as Options } from "./types-ZsfXj8_y.js";
|
|
2
2
|
export { Options as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { unpluginFactory } from "./src-
|
|
1
|
+
import { r as unpluginFactory } from "./src-DwW80l3g.js";
|
|
2
2
|
import { createVitePlugin } from "unplugin";
|
|
3
3
|
|
|
4
4
|
//#region src/vite.ts
|
|
@@ -6,5 +6,5 @@ const plugin = createVitePlugin(unpluginFactory);
|
|
|
6
6
|
var vite_default = plugin;
|
|
7
7
|
|
|
8
8
|
//#endregion
|
|
9
|
-
export { vite_default };
|
|
10
|
-
//# sourceMappingURL=vite-
|
|
9
|
+
export { vite_default as t };
|
|
10
|
+
//# sourceMappingURL=vite-CORCTD4q.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-
|
|
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
CHANGED
package/dist/vite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { unpluginFactory } from "./src-
|
|
1
|
+
import { r as unpluginFactory } from "./src-DwW80l3g.js";
|
|
2
2
|
import { createWebpackPlugin } from "unplugin";
|
|
3
3
|
|
|
4
4
|
//#region src/webpack.ts
|
|
@@ -6,5 +6,5 @@ const plugin = createWebpackPlugin(unpluginFactory);
|
|
|
6
6
|
var webpack_default = plugin;
|
|
7
7
|
|
|
8
8
|
//#endregion
|
|
9
|
-
export { webpack_default };
|
|
10
|
-
//# sourceMappingURL=webpack-
|
|
9
|
+
export { webpack_default as t };
|
|
10
|
+
//# sourceMappingURL=webpack-C7qBCJQK.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack-
|
|
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
CHANGED
package/dist/webpack.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@torpor/unplugin",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Unplugin package to compile Torpor components for Vite, Rollup, and other bundlers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"torpor",
|
|
@@ -90,30 +90,30 @@
|
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
92
|
"unplugin": "^2.3.10",
|
|
93
|
-
"@torpor/view": "^0.
|
|
93
|
+
"@torpor/view": "^0.4.0"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
|
-
"@antfu/eslint-config": "^
|
|
97
|
-
"@nuxt/kit": "^4.
|
|
98
|
-
"@nuxt/schema": "^4.
|
|
96
|
+
"@antfu/eslint-config": "^6.1.0",
|
|
97
|
+
"@nuxt/kit": "^4.2.0",
|
|
98
|
+
"@nuxt/schema": "^4.2.0",
|
|
99
99
|
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
|
|
100
|
-
"@types/node": "^24.
|
|
101
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
102
|
-
"bumpp": "^10.
|
|
100
|
+
"@types/node": "^24.9.2",
|
|
101
|
+
"@typescript/native-preview": "7.0.0-dev.20251027.1",
|
|
102
|
+
"bumpp": "^10.3.1",
|
|
103
103
|
"chalk": "^5.6.2",
|
|
104
|
-
"eslint": "^9.
|
|
104
|
+
"eslint": "^9.38.0",
|
|
105
105
|
"esno": "^4.8.0",
|
|
106
106
|
"fast-glob": "^3.3.3",
|
|
107
107
|
"nodemon": "^3.1.10",
|
|
108
|
-
"oxlint-tsgolint": "^0.
|
|
108
|
+
"oxlint-tsgolint": "^0.3.0",
|
|
109
109
|
"prettier": "^3.6.2",
|
|
110
110
|
"rimraf": "^6.0.1",
|
|
111
|
-
"rollup": "^4.52.
|
|
112
|
-
"tsdown": "^0.15.
|
|
111
|
+
"rollup": "^4.52.5",
|
|
112
|
+
"tsdown": "^0.15.11",
|
|
113
113
|
"typescript": "^5.9.3",
|
|
114
|
-
"vite": "^7.1.
|
|
115
|
-
"vitest": "^
|
|
116
|
-
"webpack": "^5.102.
|
|
114
|
+
"vite": "^7.1.12",
|
|
115
|
+
"vitest": "^4.0.4",
|
|
116
|
+
"webpack": "^5.102.1"
|
|
117
117
|
},
|
|
118
118
|
"scripts": {
|
|
119
119
|
"build": "tsgo --noEmit && tsdown",
|
package/dist/src-BEQhZnec.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"src-BEQhZnec.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// 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<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