@taserjs/plugin 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +15 -0
- package/README.md +21 -0
- package/dist/esbuild.d.ts +7 -0
- package/dist/esbuild.d.ts.map +1 -0
- package/dist/esbuild.js +8 -0
- package/dist/esbuild.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +337 -0
- package/dist/index.js.map +1 -0
- package/dist/next.d.ts +18 -0
- package/dist/next.d.ts.map +1 -0
- package/dist/next.js +90 -0
- package/dist/next.js.map +1 -0
- package/dist/nitro.d.ts +17 -0
- package/dist/nitro.d.ts.map +1 -0
- package/dist/nitro.js +149 -0
- package/dist/nitro.js.map +1 -0
- package/dist/rolldown.d.ts +6 -0
- package/dist/rolldown.d.ts.map +1 -0
- package/dist/rolldown.js +7 -0
- package/dist/rolldown.js.map +1 -0
- package/dist/rollup.d.ts +7 -0
- package/dist/rollup.d.ts.map +1 -0
- package/dist/rollup.js +8 -0
- package/dist/rollup.js.map +1 -0
- package/dist/rspack.d.ts +7 -0
- package/dist/rspack.d.ts.map +1 -0
- package/dist/rspack.js +8 -0
- package/dist/rspack.js.map +1 -0
- package/dist/vite.d.ts +7 -0
- package/dist/vite.d.ts.map +1 -0
- package/dist/vite.js +8 -0
- package/dist/vite.js.map +1 -0
- package/dist/webpack.d.ts +7 -0
- package/dist/webpack.d.ts.map +1 -0
- package/dist/webpack.js +8 -0
- package/dist/webpack.js.map +1 -0
- package/package.json +155 -0
- package/src/esbuild.ts +5 -0
- package/src/index.ts +538 -0
- package/src/next.ts +121 -0
- package/src/nitro.ts +189 -0
- package/src/rolldown.ts +5 -0
- package/src/rollup.ts +5 -0
- package/src/rspack.ts +5 -0
- package/src/vite.ts +20 -0
- package/src/webpack.ts +5 -0
package/dist/nitro.js
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import taserPlugin, { buildHostFallbackCode, getHostServer, normalizeImportPath } from "./index.js";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { resolve } from "pathe";
|
|
4
|
+
import { generateManifest, loadConfig, resolveOutputDir, resolveRoutesDir, resolveServerDir, scanRoutes } from "@taserjs/cli";
|
|
5
|
+
import { watch } from "chokidar";
|
|
6
|
+
//#region src/nitro.ts
|
|
7
|
+
function buildNitroRoutingVirtualSource() {
|
|
8
|
+
return [
|
|
9
|
+
"export const findRouteRules = () => ({});",
|
|
10
|
+
"export const findRoute = () => undefined;",
|
|
11
|
+
"export const globalMiddleware = [];",
|
|
12
|
+
"export const findRoutedMiddleware = () => [];"
|
|
13
|
+
].join("\n");
|
|
14
|
+
}
|
|
15
|
+
function buildNitroStandaloneAppSource(routesGenPath, hostServer) {
|
|
16
|
+
const normalizedPath = normalizeImportPath(routesGenPath);
|
|
17
|
+
const fallback = hostServer ? buildHostFallbackCode(normalizeImportPath(hostServer.path), hostServer.type, "taserApp") : null;
|
|
18
|
+
return `// @ts-nocheck
|
|
19
|
+
import { app as taserApp } from "${normalizedPath}";
|
|
20
|
+
import { FastResponse } from "srvx";
|
|
21
|
+
${fallback ? fallback.imports : ""}
|
|
22
|
+
|
|
23
|
+
globalThis.Response = FastResponse;
|
|
24
|
+
|
|
25
|
+
${fallback ? fallback.setup : ""}
|
|
26
|
+
|
|
27
|
+
export const handler = (req, ...args) => taserApp.fetch(req, ...args);
|
|
28
|
+
|
|
29
|
+
export function createNitroApp() {
|
|
30
|
+
return {
|
|
31
|
+
fetch: handler,
|
|
32
|
+
captureError: (error) => console.error(error),
|
|
33
|
+
hooks: undefined,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function initNitroPlugins(app) {
|
|
38
|
+
return app;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const app = taserApp;
|
|
42
|
+
export default app;
|
|
43
|
+
`;
|
|
44
|
+
}
|
|
45
|
+
function buildNitroMiddlewareHandlerSource(routesGenPath, hostServer) {
|
|
46
|
+
const normalizedPath = normalizeImportPath(routesGenPath);
|
|
47
|
+
const fallback = hostServer ? buildHostFallbackCode(normalizeImportPath(hostServer.path), hostServer.type, "taserApp") : null;
|
|
48
|
+
return `// @ts-nocheck
|
|
49
|
+
import { app as taserApp } from "${normalizedPath}";
|
|
50
|
+
import { toWebRequest } from "h3";
|
|
51
|
+
${fallback ? fallback.imports : ""}
|
|
52
|
+
|
|
53
|
+
${fallback ? fallback.setup : ""}
|
|
54
|
+
|
|
55
|
+
export default defineEventHandler((event) => {
|
|
56
|
+
return taserApp.fetch(toWebRequest(event));
|
|
57
|
+
});
|
|
58
|
+
`;
|
|
59
|
+
}
|
|
60
|
+
function setupTaserNitro(nitro, options = {}) {
|
|
61
|
+
const state = nitro.options;
|
|
62
|
+
if (state._taserHookRegistered) return;
|
|
63
|
+
state._taserHookRegistered = true;
|
|
64
|
+
nitro.hooks.hookOnce("build:before", async () => {
|
|
65
|
+
await applyTaserNitro(nitro, options);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
async function applyTaserNitro(nitro, options) {
|
|
69
|
+
const cwd = resolve(nitro.options.rootDir || options.cwd || process.cwd());
|
|
70
|
+
const config = await loadConfig(cwd, options.config);
|
|
71
|
+
const routesDir = resolveRoutesDir(config, cwd);
|
|
72
|
+
const serverDir = resolveServerDir(config, cwd);
|
|
73
|
+
const outputDir = resolveOutputDir(config, cwd);
|
|
74
|
+
const routesGenPath = resolve(outputDir, "routes.gen.ts");
|
|
75
|
+
const executeGeneration = (scaffold = Boolean(nitro.options.dev)) => {
|
|
76
|
+
if (existsSync(routesDir)) {
|
|
77
|
+
const scanResult = scanRoutes({
|
|
78
|
+
routesDir,
|
|
79
|
+
cwd,
|
|
80
|
+
scaffold,
|
|
81
|
+
formatting: config.formatting
|
|
82
|
+
});
|
|
83
|
+
generateManifest(scanResult, config, cwd);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
executeGeneration();
|
|
87
|
+
nitro.options.virtual = nitro.options.virtual || {};
|
|
88
|
+
if (options.standalone === true) {
|
|
89
|
+
nitro.options.virtual["#nitro/virtual/app"] = () => {
|
|
90
|
+
const currentHost = getHostServer(config, cwd, options);
|
|
91
|
+
return buildNitroStandaloneAppSource(routesGenPath, currentHost);
|
|
92
|
+
};
|
|
93
|
+
nitro.options.virtual["#nitro/virtual/routing"] = () => buildNitroRoutingVirtualSource();
|
|
94
|
+
} else {
|
|
95
|
+
const VIRTUAL_NITRO_HANDLER_ID = "#taserjs/virtual/nitro-handler";
|
|
96
|
+
nitro.options.virtual[VIRTUAL_NITRO_HANDLER_ID] = () => {
|
|
97
|
+
const currentHost = getHostServer(config, cwd, options);
|
|
98
|
+
return buildNitroMiddlewareHandlerSource(routesGenPath, currentHost);
|
|
99
|
+
};
|
|
100
|
+
nitro.options.handlers = nitro.options.handlers || [];
|
|
101
|
+
nitro.options.handlers.unshift({
|
|
102
|
+
route: "/**",
|
|
103
|
+
lazy: false,
|
|
104
|
+
handler: VIRTUAL_NITRO_HANDLER_ID
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
let watcher;
|
|
108
|
+
if (nitro.options.dev && existsSync(routesDir)) {
|
|
109
|
+
const watchDirs = [routesDir];
|
|
110
|
+
if (existsSync(serverDir) && !watchDirs.includes(serverDir)) watchDirs.push(serverDir);
|
|
111
|
+
watcher = watch(watchDirs, {
|
|
112
|
+
ignoreInitial: true,
|
|
113
|
+
ignored: [
|
|
114
|
+
/(^|[/\\])\../,
|
|
115
|
+
/(^|[/\\])-/,
|
|
116
|
+
/node_modules/,
|
|
117
|
+
/\.taserjs/
|
|
118
|
+
]
|
|
119
|
+
});
|
|
120
|
+
let timer = null;
|
|
121
|
+
watcher.on("all", () => {
|
|
122
|
+
if (timer) clearTimeout(timer);
|
|
123
|
+
timer = setTimeout(() => {
|
|
124
|
+
executeGeneration();
|
|
125
|
+
}, 50);
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
nitro.hooks.hook("close", async () => {
|
|
129
|
+
await watcher?.close();
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Taser Nitro module.
|
|
134
|
+
*
|
|
135
|
+
* Can be used as a Nitro module (`modules: [taser()]`) in `nitro.config.ts`,
|
|
136
|
+
* or chained as a rollup plugin.
|
|
137
|
+
*/
|
|
138
|
+
function taser(options = {}) {
|
|
139
|
+
return {
|
|
140
|
+
...taserPlugin.rollup(options),
|
|
141
|
+
name: "taserjs:plugin",
|
|
142
|
+
__taserOptions: options,
|
|
143
|
+
setup: (nitro) => setupTaserNitro(nitro, options)
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
//#endregion
|
|
147
|
+
export { applyTaserNitro, buildNitroMiddlewareHandlerSource, buildNitroRoutingVirtualSource, buildNitroStandaloneAppSource, taser as default, taser, setupTaserNitro };
|
|
148
|
+
|
|
149
|
+
//# sourceMappingURL=nitro.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nitro.js","names":[],"sources":["../src/nitro.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport { resolve } from \"pathe\";\nimport {\n generateManifest,\n loadConfig,\n resolveOutputDir,\n resolveRoutesDir,\n resolveServerDir,\n scanRoutes,\n type ResolvedTaserConfig,\n} from \"@taserjs/cli\";\nimport { watch, type FSWatcher } from \"chokidar\";\nimport {\n buildHostFallbackCode,\n getHostServer,\n normalizeImportPath,\n taserPlugin,\n type HostServerInfo,\n type TaserPluginOptions,\n} from \"./index.js\";\n\nexport function buildNitroRoutingVirtualSource(): string {\n return [\n \"export const findRouteRules = () => ({});\",\n \"export const findRoute = () => undefined;\",\n \"export const globalMiddleware = [];\",\n \"export const findRoutedMiddleware = () => [];\",\n ].join(\"\\n\");\n}\n\nexport function buildNitroStandaloneAppSource(\n routesGenPath: string,\n hostServer?: HostServerInfo | null,\n): string {\n const normalizedPath = normalizeImportPath(routesGenPath);\n const fallback = hostServer\n ? buildHostFallbackCode(normalizeImportPath(hostServer.path), hostServer.type, \"taserApp\")\n : null;\n\n return `// @ts-nocheck\nimport { app as taserApp } from \"${normalizedPath}\";\nimport { FastResponse } from \"srvx\";\n${fallback ? fallback.imports : \"\"}\n\nglobalThis.Response = FastResponse;\n\n${fallback ? fallback.setup : \"\"}\n\nexport const handler = (req, ...args) => taserApp.fetch(req, ...args);\n\nexport function createNitroApp() {\n return {\n fetch: handler,\n captureError: (error) => console.error(error),\n hooks: undefined,\n };\n}\n\nexport function initNitroPlugins(app) {\n return app;\n}\n\nexport const app = taserApp;\nexport default app;\n`;\n}\n\nexport function buildNitroMiddlewareHandlerSource(\n routesGenPath: string,\n hostServer?: HostServerInfo | null,\n): string {\n const normalizedPath = normalizeImportPath(routesGenPath);\n const fallback = hostServer\n ? buildHostFallbackCode(normalizeImportPath(hostServer.path), hostServer.type, \"taserApp\")\n : null;\n\n return `// @ts-nocheck\nimport { app as taserApp } from \"${normalizedPath}\";\nimport { toWebRequest } from \"h3\";\n${fallback ? fallback.imports : \"\"}\n\n${fallback ? fallback.setup : \"\"}\n\nexport default defineEventHandler((event) => {\n return taserApp.fetch(toWebRequest(event));\n});\n`;\n}\n\nexport function setupTaserNitro(nitro: any, options: TaserPluginOptions = {}): void {\n const state = nitro.options as unknown as Record<string, unknown>;\n if (state._taserHookRegistered) {\n return;\n }\n state._taserHookRegistered = true;\n\n nitro.hooks.hookOnce(\"build:before\", async () => {\n await applyTaserNitro(nitro, options);\n });\n}\n\nexport async function applyTaserNitro(nitro: any, options: TaserPluginOptions): Promise<void> {\n const cwd = resolve(nitro.options.rootDir || options.cwd || process.cwd());\n const config: ResolvedTaserConfig = await loadConfig(cwd, options.config);\n const routesDir = resolveRoutesDir(config, cwd);\n const serverDir = resolveServerDir(config, cwd);\n const outputDir = resolveOutputDir(config, cwd);\n const routesGenPath = resolve(outputDir, \"routes.gen.ts\");\n\n const executeGeneration = (scaffold = Boolean(nitro.options.dev)) => {\n if (existsSync(routesDir)) {\n const scanResult = scanRoutes({\n routesDir,\n cwd,\n scaffold,\n formatting: config.formatting,\n });\n generateManifest(scanResult, config, cwd);\n }\n };\n\n executeGeneration();\n\n nitro.options.virtual = nitro.options.virtual || {};\n const isStandalone = options.standalone === true;\n\n if (isStandalone) {\n nitro.options.virtual[\"#nitro/virtual/app\"] = () => {\n const currentHost = getHostServer(config, cwd, options);\n return buildNitroStandaloneAppSource(routesGenPath, currentHost);\n };\n nitro.options.virtual[\"#nitro/virtual/routing\"] = () => buildNitroRoutingVirtualSource();\n } else {\n const VIRTUAL_NITRO_HANDLER_ID = \"#taserjs/virtual/nitro-handler\";\n nitro.options.virtual[VIRTUAL_NITRO_HANDLER_ID] = () => {\n const currentHost = getHostServer(config, cwd, options);\n return buildNitroMiddlewareHandlerSource(routesGenPath, currentHost);\n };\n\n nitro.options.handlers = nitro.options.handlers || [];\n nitro.options.handlers.unshift({\n route: \"/**\",\n lazy: false,\n handler: VIRTUAL_NITRO_HANDLER_ID,\n });\n }\n\n let watcher: FSWatcher | undefined;\n if (nitro.options.dev && existsSync(routesDir)) {\n const watchDirs = [routesDir];\n if (existsSync(serverDir) && !watchDirs.includes(serverDir)) {\n watchDirs.push(serverDir);\n }\n watcher = watch(watchDirs, {\n ignoreInitial: true,\n ignored: [/(^|[/\\\\])\\../, /(^|[/\\\\])-/, /node_modules/, /\\.taserjs/],\n });\n\n let timer: NodeJS.Timeout | null = null;\n watcher.on(\"all\", () => {\n if (timer) clearTimeout(timer);\n timer = setTimeout(() => {\n executeGeneration();\n }, 50);\n });\n }\n\n nitro.hooks.hook(\"close\", async () => {\n await watcher?.close();\n });\n}\n\n/**\n * Taser Nitro module.\n *\n * Can be used as a Nitro module (`modules: [taser()]`) in `nitro.config.ts`,\n * or chained as a rollup plugin.\n */\nexport function taser(options: TaserPluginOptions = {}) {\n const rollupPlugin = taserPlugin.rollup(options);\n return {\n ...rollupPlugin,\n name: \"taserjs:plugin\",\n __taserOptions: options,\n setup: (nitro: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8B,CAAC,GAAG;CAEtD,OAAO;EACL,GAFmB,YAAY,OAAO,OAExB;EACd,MAAM;EACN,gBAAgB;EAChB,QAAQ,UAAe,gBAAgB,OAAO,OAAO;CACvD;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rolldown.d.ts","names":[],"sources":["../src/rolldown.ts"],"mappings":";;qBAEa,cAAuC,YAAY"}
|
package/dist/rolldown.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rolldown.js","names":[],"sources":["../src/rolldown.ts"],"sourcesContent":["import { taserPlugin, type TaserPluginOptions } from \"./index.js\";\n\nexport const taser = taserPlugin.rolldown as typeof taserPlugin.rollup;\nexport default taser;\nexport type { TaserPluginOptions };\n"],"mappings":";;AAEA,MAAa,QAAQ,YAAY"}
|
package/dist/rollup.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TaserPluginOptions } from "./index.js";
|
|
2
|
+
//#region src/rollup.d.ts
|
|
3
|
+
export declare const taser: (options?: TaserPluginOptions | undefined) => any;
|
|
4
|
+
declare const _default: (options?: TaserPluginOptions | undefined) => any;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { type TaserPluginOptions, _default as default };
|
|
7
|
+
//# sourceMappingURL=rollup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rollup.d.ts","names":[],"sources":["../src/rollup.ts"],"mappings":";;qBAEa,QAAK,UAAA"}
|
package/dist/rollup.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rollup.js","names":[],"sources":["../src/rollup.ts"],"sourcesContent":["import { taserPlugin, type TaserPluginOptions } from \"./index.js\";\n\nexport const taser = taserPlugin.rollup;\nexport default taserPlugin.rollup;\nexport type { TaserPluginOptions };\n"],"mappings":";;AAEA,MAAa,QAAQ,YAAY;AACjC,IAAA,iBAAe,YAAY"}
|
package/dist/rspack.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TaserPluginOptions } from "./index.js";
|
|
2
|
+
//#region src/rspack.d.ts
|
|
3
|
+
export declare const taser: (options?: TaserPluginOptions | undefined) => RspackPluginInstance;
|
|
4
|
+
declare const _default: (options?: TaserPluginOptions | undefined) => RspackPluginInstance;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { type TaserPluginOptions, _default as default };
|
|
7
|
+
//# sourceMappingURL=rspack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rspack.d.ts","names":[],"sources":["../src/rspack.ts"],"mappings":";;qBAEa,QAAK,UAAA,mCAAA"}
|
package/dist/rspack.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rspack.js","names":[],"sources":["../src/rspack.ts"],"sourcesContent":["import { taserPlugin, type TaserPluginOptions } from \"./index.js\";\n\nexport const taser = taserPlugin.rspack;\nexport default taserPlugin.rspack;\nexport type { TaserPluginOptions };\n"],"mappings":";;AAEA,MAAa,QAAQ,YAAY;AACjC,IAAA,iBAAe,YAAY"}
|
package/dist/vite.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { HostServerInfo, TaserPluginOptions, detectHostServer, emitServeShim, mountHostFallback, resolveHostFetchHandler } from "./index.js";
|
|
2
|
+
//#region src/vite.d.ts
|
|
3
|
+
export declare const taser: (options?: TaserPluginOptions | undefined) => import("unplugin").VitePlugin<any> | import("unplugin").VitePlugin<any>[];
|
|
4
|
+
declare const _default: (options?: TaserPluginOptions | undefined) => import("unplugin").VitePlugin<any> | import("unplugin").VitePlugin<any>[];
|
|
5
|
+
//#endregion
|
|
6
|
+
export { type HostServerInfo, type TaserPluginOptions, _default as default, detectHostServer, emitServeShim, mountHostFallback, resolveHostFetchHandler };
|
|
7
|
+
//# sourceMappingURL=vite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite.d.ts","names":[],"sources":["../src/vite.ts"],"mappings":";;qBAUa,QAAK,UAAA,sDAAA,qCAAA"}
|
package/dist/vite.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import taserPlugin, { detectHostServer, emitServeShim, mountHostFallback, resolveHostFetchHandler } from "./index.js";
|
|
2
|
+
//#region src/vite.ts
|
|
3
|
+
const taser = taserPlugin.vite;
|
|
4
|
+
var vite_default = taserPlugin.vite;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { vite_default as default, detectHostServer, emitServeShim, mountHostFallback, resolveHostFetchHandler, taser };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=vite.js.map
|
package/dist/vite.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite.js","names":[],"sources":["../src/vite.ts"],"sourcesContent":["import {\n detectHostServer,\n emitServeShim,\n mountHostFallback,\n resolveHostFetchHandler,\n taserPlugin,\n type HostServerInfo,\n type TaserPluginOptions,\n} from \"./index.js\";\n\nexport const taser = taserPlugin.vite;\nexport default taserPlugin.vite;\nexport {\n detectHostServer,\n emitServeShim,\n mountHostFallback,\n resolveHostFetchHandler,\n type HostServerInfo,\n type TaserPluginOptions,\n};\n"],"mappings":";;AAUA,MAAa,QAAQ,YAAY;AACjC,IAAA,eAAe,YAAY"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TaserPluginOptions } from "./index.js";
|
|
2
|
+
//#region src/webpack.d.ts
|
|
3
|
+
export declare const taser: (options?: TaserPluginOptions | undefined) => WebpackPluginInstance;
|
|
4
|
+
declare const _default: (options?: TaserPluginOptions | undefined) => WebpackPluginInstance;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { type TaserPluginOptions, _default as default };
|
|
7
|
+
//# sourceMappingURL=webpack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webpack.d.ts","names":[],"sources":["../src/webpack.ts"],"mappings":";;qBAEa,QAAK,UAAA,mCAAA"}
|
package/dist/webpack.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webpack.js","names":[],"sources":["../src/webpack.ts"],"sourcesContent":["import { taserPlugin, type TaserPluginOptions } from \"./index.js\";\n\nexport const taser = taserPlugin.webpack;\nexport default taserPlugin.webpack;\nexport type { TaserPluginOptions };\n"],"mappings":";;AAEA,MAAa,QAAQ,YAAY;AACjC,IAAA,kBAAe,YAAY"}
|
package/package.json
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@taserjs/plugin",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Universal bundler plugin for Taser.js",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"bundler",
|
|
7
|
+
"file-based-routing",
|
|
8
|
+
"nextjs",
|
|
9
|
+
"nitro",
|
|
10
|
+
"rest-api",
|
|
11
|
+
"tanstack-start",
|
|
12
|
+
"taserjs",
|
|
13
|
+
"type-safe-api",
|
|
14
|
+
"typescript",
|
|
15
|
+
"vite-plugin"
|
|
16
|
+
],
|
|
17
|
+
"license": "ISC",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/taserjs/taserjs.git",
|
|
21
|
+
"directory": "packages/plugin"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"src"
|
|
26
|
+
],
|
|
27
|
+
"type": "module",
|
|
28
|
+
"sideEffects": false,
|
|
29
|
+
"main": "./dist/index.js",
|
|
30
|
+
"module": "./dist/index.js",
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"import": {
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"default": "./dist/index.js"
|
|
37
|
+
},
|
|
38
|
+
"default": {
|
|
39
|
+
"types": "./dist/index.d.ts",
|
|
40
|
+
"default": "./dist/index.js"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"./vite": {
|
|
44
|
+
"import": {
|
|
45
|
+
"types": "./dist/vite.d.ts",
|
|
46
|
+
"default": "./dist/vite.js"
|
|
47
|
+
},
|
|
48
|
+
"default": {
|
|
49
|
+
"types": "./dist/vite.d.ts",
|
|
50
|
+
"default": "./dist/vite.js"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"./rollup": {
|
|
54
|
+
"import": {
|
|
55
|
+
"types": "./dist/rollup.d.ts",
|
|
56
|
+
"default": "./dist/rollup.js"
|
|
57
|
+
},
|
|
58
|
+
"default": {
|
|
59
|
+
"types": "./dist/rollup.d.ts",
|
|
60
|
+
"default": "./dist/rollup.js"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"./rolldown": {
|
|
64
|
+
"import": {
|
|
65
|
+
"types": "./dist/rolldown.d.ts",
|
|
66
|
+
"default": "./dist/rolldown.js"
|
|
67
|
+
},
|
|
68
|
+
"default": {
|
|
69
|
+
"types": "./dist/rolldown.d.ts",
|
|
70
|
+
"default": "./dist/rolldown.js"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"./webpack": {
|
|
74
|
+
"import": {
|
|
75
|
+
"types": "./dist/webpack.d.ts",
|
|
76
|
+
"default": "./dist/webpack.js"
|
|
77
|
+
},
|
|
78
|
+
"default": {
|
|
79
|
+
"types": "./dist/webpack.d.ts",
|
|
80
|
+
"default": "./dist/webpack.js"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"./rspack": {
|
|
84
|
+
"import": {
|
|
85
|
+
"types": "./dist/rspack.d.ts",
|
|
86
|
+
"default": "./dist/rspack.js"
|
|
87
|
+
},
|
|
88
|
+
"default": {
|
|
89
|
+
"types": "./dist/rspack.d.ts",
|
|
90
|
+
"default": "./dist/rspack.js"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"./esbuild": {
|
|
94
|
+
"import": {
|
|
95
|
+
"types": "./dist/esbuild.d.ts",
|
|
96
|
+
"default": "./dist/esbuild.js"
|
|
97
|
+
},
|
|
98
|
+
"default": {
|
|
99
|
+
"types": "./dist/esbuild.d.ts",
|
|
100
|
+
"default": "./dist/esbuild.js"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"./nitro": {
|
|
104
|
+
"import": {
|
|
105
|
+
"types": "./dist/nitro.d.ts",
|
|
106
|
+
"default": "./dist/nitro.js"
|
|
107
|
+
},
|
|
108
|
+
"default": {
|
|
109
|
+
"types": "./dist/nitro.d.ts",
|
|
110
|
+
"default": "./dist/nitro.js"
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"./next": {
|
|
114
|
+
"import": {
|
|
115
|
+
"types": "./dist/next.d.ts",
|
|
116
|
+
"default": "./dist/next.js"
|
|
117
|
+
},
|
|
118
|
+
"default": {
|
|
119
|
+
"types": "./dist/next.d.ts",
|
|
120
|
+
"default": "./dist/next.js"
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
"./package.json": "./package.json"
|
|
124
|
+
},
|
|
125
|
+
"publishConfig": {
|
|
126
|
+
"access": "public",
|
|
127
|
+
"registry": "https://registry.npmjs.org"
|
|
128
|
+
},
|
|
129
|
+
"dependencies": {
|
|
130
|
+
"chokidar": "^5.0.0",
|
|
131
|
+
"pathe": "^2.0.3",
|
|
132
|
+
"srvx": "^1.0.4",
|
|
133
|
+
"unplugin": "^2.3.11",
|
|
134
|
+
"@taserjs/cli": "^0.2.0"
|
|
135
|
+
},
|
|
136
|
+
"devDependencies": {
|
|
137
|
+
"publint": "^0.3.22",
|
|
138
|
+
"rimraf": "^6.0.1",
|
|
139
|
+
"tsdown": "^0.23.0",
|
|
140
|
+
"typescript": "^5.9.3",
|
|
141
|
+
"vite": "^8.2.2",
|
|
142
|
+
"vitest": "^4.1.10",
|
|
143
|
+
"create-taserjs": "0.2.0"
|
|
144
|
+
},
|
|
145
|
+
"engines": {
|
|
146
|
+
"node": ">=20.19"
|
|
147
|
+
},
|
|
148
|
+
"scripts": {
|
|
149
|
+
"clean": "rimraf dist",
|
|
150
|
+
"build": "tsdown",
|
|
151
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
152
|
+
"test": "vitest run",
|
|
153
|
+
"lint": "oxlint ."
|
|
154
|
+
}
|
|
155
|
+
}
|