@unhead/bundler 3.0.0-rc.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/LICENSE +21 -0
- package/README.md +124 -0
- package/dist/devtools/bridge.d.mts +10 -0
- package/dist/devtools/bridge.d.ts +10 -0
- package/dist/devtools/bridge.mjs +324 -0
- package/dist/devtools-ui/200.html +1 -0
- package/dist/devtools-ui/404.html +1 -0
- package/dist/devtools-ui/_nuxt/B8PEiB0p.js +1 -0
- package/dist/devtools-ui/_nuxt/B9CgE5J6.js +1 -0
- package/dist/devtools-ui/_nuxt/BJ42UJro.js +1 -0
- package/dist/devtools-ui/_nuxt/BOzzsL9j.js +1 -0
- package/dist/devtools-ui/_nuxt/CC8iqwL_.js +1 -0
- package/dist/devtools-ui/_nuxt/CLj8gQPS.js +1 -0
- package/dist/devtools-ui/_nuxt/CUZFOKWE.js +1 -0
- package/dist/devtools-ui/_nuxt/CVGS_sMg.js +1 -0
- package/dist/devtools-ui/_nuxt/CVO1_9PV.js +1 -0
- package/dist/devtools-ui/_nuxt/Cp-IABpG.js +1 -0
- package/dist/devtools-ui/_nuxt/D0r3Knsf.js +1 -0
- package/dist/devtools-ui/_nuxt/D2XNJYSt.js +1 -0
- package/dist/devtools-ui/_nuxt/D2j1X0ma.js +181 -0
- package/dist/devtools-ui/_nuxt/DNXA5IKg.js +1 -0
- package/dist/devtools-ui/_nuxt/D_TuKxep.js +1 -0
- package/dist/devtools-ui/_nuxt/Deu7B_Ux.js +1 -0
- package/dist/devtools-ui/_nuxt/DevtoolsKeyValue.CGQNexGc.css +1 -0
- package/dist/devtools-ui/_nuxt/DevtoolsTagTable.Bi_gUiSE.css +1 -0
- package/dist/devtools-ui/_nuxt/DevtoolsTip.By8OtGoF.css +1 -0
- package/dist/devtools-ui/_nuxt/Dpg3GvfJ.js +1 -0
- package/dist/devtools-ui/_nuxt/DuAJIi38.js +1 -0
- package/dist/devtools-ui/_nuxt/OCodeBlock.cuqShMa1.css +1 -0
- package/dist/devtools-ui/_nuxt/QXSvvKqL.js +1 -0
- package/dist/devtools-ui/_nuxt/UQ4k7j0M.js +1 -0
- package/dist/devtools-ui/_nuxt/aDaU-lXw.js +1 -0
- package/dist/devtools-ui/_nuxt/builds/latest.json +1 -0
- package/dist/devtools-ui/_nuxt/builds/meta/cae94e84-32db-4da4-8b0f-478d21dcc68b.json +1 -0
- package/dist/devtools-ui/_nuxt/cBFzznMP.js +1 -0
- package/dist/devtools-ui/_nuxt/entry.clcQIxBm.css +1 -0
- package/dist/devtools-ui/_nuxt/error-404.Cu92rxSa.css +1 -0
- package/dist/devtools-ui/_nuxt/error-500.B9_6I3ju.css +1 -0
- package/dist/devtools-ui/_nuxt/identity.qqB_zwgO.css +1 -0
- package/dist/devtools-ui/_nuxt/schema-validation.CRmraV8c.css +1 -0
- package/dist/devtools-ui/_nuxt/schema.CFjU2dVl.css +1 -0
- package/dist/devtools-ui/_nuxt/scripts.UkRMfT5v.css +1 -0
- package/dist/devtools-ui/_nuxt/serp.CZGidvZH.css +1 -0
- package/dist/devtools-ui/_nuxt/wDzz0qaB.js +1 -0
- package/dist/devtools-ui/index.html +1 -0
- package/dist/index.d.mts +28 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.mjs +79 -0
- package/dist/minify/esbuild.d.mts +5 -0
- package/dist/minify/esbuild.d.ts +5 -0
- package/dist/minify/esbuild.mjs +10 -0
- package/dist/minify/lightningcss.d.mts +5 -0
- package/dist/minify/lightningcss.d.ts +5 -0
- package/dist/minify/lightningcss.mjs +14 -0
- package/dist/minify/rolldown.d.mts +5 -0
- package/dist/minify/rolldown.d.ts +5 -0
- package/dist/minify/rolldown.mjs +10 -0
- package/dist/shared/bundler.BwKIGaKX.d.mts +60 -0
- package/dist/shared/bundler.BwKIGaKX.d.ts +60 -0
- package/dist/shared/bundler.DRWfqG8C.mjs +453 -0
- package/dist/vite.d.mts +6 -0
- package/dist/vite.d.ts +6 -0
- package/dist/vite.mjs +282 -0
- package/dist/webpack.d.mts +5 -0
- package/dist/webpack.d.ts +5 -0
- package/dist/webpack.mjs +31 -0
- package/package.json +111 -0
- package/vite.d.ts +1 -0
- package/webpack.d.ts +1 -0
package/dist/vite.mjs
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import MagicString from 'magic-string';
|
|
5
|
+
import { parseAndWalk } from 'oxc-walker';
|
|
6
|
+
import { defineRpcFunction } from '@vitejs/devtools-kit';
|
|
7
|
+
import { T as TreeshakeServerComposables, U as UseSeoMetaTransform, M as MinifyTransform, S as SSRStaticReplace } from './shared/bundler.DRWfqG8C.mjs';
|
|
8
|
+
import 'oxc-parser';
|
|
9
|
+
import 'ufo';
|
|
10
|
+
import 'unplugin';
|
|
11
|
+
import 'node:vm';
|
|
12
|
+
import 'unhead/utils';
|
|
13
|
+
|
|
14
|
+
const getConfigRpc = defineRpcFunction({
|
|
15
|
+
name: "unhead:get-config",
|
|
16
|
+
type: "static",
|
|
17
|
+
setup: (ctx) => ({
|
|
18
|
+
handler: () => ({
|
|
19
|
+
cwd: ctx.cwd,
|
|
20
|
+
mode: ctx.mode
|
|
21
|
+
})
|
|
22
|
+
})
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const HEAD_COMPOSABLES = ["useHead", "useSeoMeta", "useHeadSafe", "useScript"];
|
|
26
|
+
const FILE_RE$1 = /\.(vue|tsx?|jsx?|svelte)$/;
|
|
27
|
+
const LEADING_SLASH_RE = /^\//;
|
|
28
|
+
const UNHEAD_ICON = `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 24 24'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0%25' y1='0%25' x2='100%25' y2='100%25'%3E%3Cstop offset='0%25' stop-color='%23FBBF24'/%3E%3Cstop offset='100%25' stop-color='%23f0db4f'/%3E%3C/linearGradient%3E%3Cmask id='m'%3E%3Crect width='100%25' height='100%25' fill='white'/%3E%3Cpath d='M12 32 L1 32 L15 15 Z' fill='black'/%3E%3C/mask%3E%3C/defs%3E%3Cpath fill='none' stroke='url(%23g)' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 4v14a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4' mask='url(%23m)'/%3E%3C/svg%3E`;
|
|
29
|
+
const DEVTOOLS_UI_ROUTE = "/__unhead/";
|
|
30
|
+
function transformSourceLocations(code, id, root) {
|
|
31
|
+
if (!HEAD_COMPOSABLES.some((c) => code.includes(c)))
|
|
32
|
+
return;
|
|
33
|
+
const s = new MagicString(code);
|
|
34
|
+
let transformed = false;
|
|
35
|
+
const relativePath = id.startsWith(root) ? id.slice(root.length).replace(LEADING_SLASH_RE, "") : id;
|
|
36
|
+
parseAndWalk(code, id, {
|
|
37
|
+
parseOptions: { lang: "ts" },
|
|
38
|
+
enter(node) {
|
|
39
|
+
if (node.type !== "CallExpression")
|
|
40
|
+
return;
|
|
41
|
+
const callee = node.callee;
|
|
42
|
+
if (!callee)
|
|
43
|
+
return;
|
|
44
|
+
const name = callee.type === "Identifier" ? callee.name : callee.type === "MemberExpression" && callee.property?.type === "Identifier" ? callee.property.name : null;
|
|
45
|
+
if (!name || !HEAD_COMPOSABLES.includes(name))
|
|
46
|
+
return;
|
|
47
|
+
const args = node.arguments;
|
|
48
|
+
if (!args || args.length === 0)
|
|
49
|
+
return;
|
|
50
|
+
const lineNumber = code.slice(0, node.start).split("\n").length;
|
|
51
|
+
const sourceValue = `${relativePath}:${lineNumber}`;
|
|
52
|
+
if (args.length === 1) {
|
|
53
|
+
const argEnd = args[0].end;
|
|
54
|
+
s.appendRight(argEnd, `, { _source: ${JSON.stringify(sourceValue)} }`);
|
|
55
|
+
transformed = true;
|
|
56
|
+
} else if (args.length >= 2 && args[1].type === "ObjectExpression") {
|
|
57
|
+
const objStart = args[1].start + 1;
|
|
58
|
+
s.appendRight(objStart, ` _source: ${JSON.stringify(sourceValue)},`);
|
|
59
|
+
transformed = true;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
if (!transformed)
|
|
64
|
+
return;
|
|
65
|
+
return {
|
|
66
|
+
code: s.toString(),
|
|
67
|
+
map: s.generateMap({ includeContent: true, source: id })
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function unheadDevtools(options) {
|
|
71
|
+
let root = "";
|
|
72
|
+
let enabled = false;
|
|
73
|
+
let bridgeCode;
|
|
74
|
+
let unheadVersion = "";
|
|
75
|
+
const pkgDir = fileURLToPath(new URL("..", import.meta.url));
|
|
76
|
+
const devtoolsUiDir = fileURLToPath(new URL("./devtools-ui", import.meta.url));
|
|
77
|
+
return {
|
|
78
|
+
name: "@unhead/devtools",
|
|
79
|
+
apply: "serve",
|
|
80
|
+
configResolved(config) {
|
|
81
|
+
root = config.root;
|
|
82
|
+
enabled = config.plugins.some((p) => p.name?.startsWith("vite:devtools"));
|
|
83
|
+
if (!enabled)
|
|
84
|
+
return;
|
|
85
|
+
if (options?._ctx) {
|
|
86
|
+
options._ctx.addRuntimePlugin({
|
|
87
|
+
import: { name: "devtoolsPlugin", source: "@unhead/bundler", as: "__unhead_devtoolsPlugin" },
|
|
88
|
+
client: "window.__unhead_devtools__=_h",
|
|
89
|
+
server: "_h.use(__unhead_devtoolsPlugin())"
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
try {
|
|
93
|
+
const unheadPkg = resolve(pkgDir, "node_modules/unhead/package.json");
|
|
94
|
+
if (existsSync(unheadPkg))
|
|
95
|
+
unheadVersion = JSON.parse(readFileSync(unheadPkg, "utf-8")).version || "";
|
|
96
|
+
} catch {
|
|
97
|
+
}
|
|
98
|
+
const bridgePath = resolve(pkgDir, "dist/devtools/bridge.mjs");
|
|
99
|
+
if (existsSync(bridgePath))
|
|
100
|
+
bridgeCode = readFileSync(bridgePath, "utf-8");
|
|
101
|
+
},
|
|
102
|
+
configureServer(server) {
|
|
103
|
+
if (!enabled)
|
|
104
|
+
return;
|
|
105
|
+
server.middlewares.use("/@unhead/bridge.mjs", async (_req, res) => {
|
|
106
|
+
const result = await server.transformRequest("/@unhead/bridge.mjs");
|
|
107
|
+
res.setHeader("Content-Type", "application/javascript");
|
|
108
|
+
res.end(result?.code || 'console.warn("[unhead devtools] bridge not built")');
|
|
109
|
+
});
|
|
110
|
+
},
|
|
111
|
+
resolveId(id) {
|
|
112
|
+
if (!enabled)
|
|
113
|
+
return;
|
|
114
|
+
if (id === "/@unhead/bridge.mjs")
|
|
115
|
+
return id;
|
|
116
|
+
},
|
|
117
|
+
load(id) {
|
|
118
|
+
if (!enabled || id !== "/@unhead/bridge.mjs")
|
|
119
|
+
return;
|
|
120
|
+
if (!bridgeCode)
|
|
121
|
+
return 'console.warn("[unhead devtools] bridge not built")';
|
|
122
|
+
let code = bridgeCode;
|
|
123
|
+
if (unheadVersion)
|
|
124
|
+
code = code.replace(/__UNHEAD_VERSION__ = ['"]'?["']/, `__UNHEAD_VERSION__ = '${unheadVersion}'`);
|
|
125
|
+
const kitClientPath = resolve(pkgDir, "node_modules/@vitejs/devtools-kit/dist/client.js");
|
|
126
|
+
if (existsSync(kitClientPath))
|
|
127
|
+
return code.replace(`'@vitejs/devtools-kit/client'`, `'${kitClientPath}'`);
|
|
128
|
+
return code;
|
|
129
|
+
},
|
|
130
|
+
transform: {
|
|
131
|
+
filter: { id: FILE_RE$1 },
|
|
132
|
+
handler(code, id) {
|
|
133
|
+
if (!enabled)
|
|
134
|
+
return;
|
|
135
|
+
return transformSourceLocations(code, id, root);
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
transformIndexHtml() {
|
|
139
|
+
if (!enabled)
|
|
140
|
+
return [];
|
|
141
|
+
return [{
|
|
142
|
+
tag: "script",
|
|
143
|
+
attrs: { type: "module" },
|
|
144
|
+
children: `import("/@unhead/bridge.mjs")`,
|
|
145
|
+
injectTo: "head"
|
|
146
|
+
}];
|
|
147
|
+
},
|
|
148
|
+
devtools: {
|
|
149
|
+
setup(ctx) {
|
|
150
|
+
if (existsSync(devtoolsUiDir)) {
|
|
151
|
+
ctx.views.hostStatic(DEVTOOLS_UI_ROUTE, devtoolsUiDir);
|
|
152
|
+
}
|
|
153
|
+
ctx.docks.register({
|
|
154
|
+
id: "unhead",
|
|
155
|
+
title: "Unhead",
|
|
156
|
+
icon: UNHEAD_ICON,
|
|
157
|
+
type: "iframe",
|
|
158
|
+
url: DEVTOOLS_UI_ROUTE
|
|
159
|
+
});
|
|
160
|
+
ctx.rpc.register(getConfigRpc);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const FILE_RE = /\.(vue|tsx?|jsx?|svelte)$/;
|
|
167
|
+
const UNHEAD_SOURCE_RE = /^(?:@unhead\/[^/]+|unhead)(?:\/[^?]*)?$/;
|
|
168
|
+
function createHeadTransformContext() {
|
|
169
|
+
const registrations = [];
|
|
170
|
+
return {
|
|
171
|
+
addRuntimePlugin(reg) {
|
|
172
|
+
registrations.push(reg);
|
|
173
|
+
},
|
|
174
|
+
getRegistrations() {
|
|
175
|
+
return registrations;
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
function CreateHeadTransform(ctx) {
|
|
180
|
+
let root = "";
|
|
181
|
+
return {
|
|
182
|
+
name: "@unhead/create-head-transform",
|
|
183
|
+
apply: "serve",
|
|
184
|
+
configResolved(config) {
|
|
185
|
+
root = config.root;
|
|
186
|
+
},
|
|
187
|
+
transform: {
|
|
188
|
+
filter: { id: FILE_RE },
|
|
189
|
+
handler(code, id) {
|
|
190
|
+
const registrations = ctx.getRegistrations();
|
|
191
|
+
if (!registrations.length)
|
|
192
|
+
return;
|
|
193
|
+
if (!code.includes("createHead"))
|
|
194
|
+
return;
|
|
195
|
+
const isServer = this.environment?.config?.consumer === "server";
|
|
196
|
+
const envRegistrations = registrations.filter((r) => isServer ? r.server : r.client);
|
|
197
|
+
if (!envRegistrations.length)
|
|
198
|
+
return;
|
|
199
|
+
const s = new MagicString(code);
|
|
200
|
+
let transformed = false;
|
|
201
|
+
const directCreateHeadNames = /* @__PURE__ */ new Set();
|
|
202
|
+
const namespaceNames = /* @__PURE__ */ new Set();
|
|
203
|
+
parseAndWalk(code, id, {
|
|
204
|
+
parseOptions: { lang: "ts" },
|
|
205
|
+
enter(node) {
|
|
206
|
+
if (node.type === "ImportDeclaration") {
|
|
207
|
+
const source = node.source?.value;
|
|
208
|
+
if (typeof source !== "string" || !UNHEAD_SOURCE_RE.test(source))
|
|
209
|
+
return;
|
|
210
|
+
for (const spec of node.specifiers || []) {
|
|
211
|
+
if (spec.type === "ImportSpecifier" && spec.imported?.name === "createHead")
|
|
212
|
+
directCreateHeadNames.add(spec.local.name);
|
|
213
|
+
else if (spec.type === "ImportNamespaceSpecifier")
|
|
214
|
+
namespaceNames.add(spec.local.name);
|
|
215
|
+
}
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
if (node.type !== "CallExpression")
|
|
219
|
+
return;
|
|
220
|
+
const callee = node.callee;
|
|
221
|
+
if (!callee)
|
|
222
|
+
return;
|
|
223
|
+
const isDirect = callee.type === "Identifier" && directCreateHeadNames.has(callee.name);
|
|
224
|
+
const isNamespaced = callee.type === "MemberExpression" && callee.object?.type === "Identifier" && namespaceNames.has(callee.object.name) && callee.property?.type === "Identifier" && callee.property.name === "createHead";
|
|
225
|
+
if (!isDirect && !isNamespaced)
|
|
226
|
+
return;
|
|
227
|
+
const statements = envRegistrations.map((r) => (isServer ? r.server : r.client).replace(/__ROOT__/g, JSON.stringify(root))).join(",");
|
|
228
|
+
s.prependLeft(node.start, `((_h)=>(${statements},_h))(`);
|
|
229
|
+
s.appendRight(node.end, `)`);
|
|
230
|
+
transformed = true;
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
if (!transformed)
|
|
234
|
+
return;
|
|
235
|
+
for (const reg of envRegistrations) {
|
|
236
|
+
s.prepend(`import { ${reg.import.name} as ${reg.import.as} } from '${reg.import.source}';
|
|
237
|
+
`);
|
|
238
|
+
}
|
|
239
|
+
return {
|
|
240
|
+
code: s.toString(),
|
|
241
|
+
map: s.generateMap({ includeContent: true, source: id })
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function Unhead(options = {}) {
|
|
249
|
+
const plugins = [];
|
|
250
|
+
const ctx = createHeadTransformContext();
|
|
251
|
+
const framework = options._framework;
|
|
252
|
+
if (options.treeshake !== false) {
|
|
253
|
+
const treeshakeOpts = typeof options.treeshake === "object" ? options.treeshake : {};
|
|
254
|
+
plugins.push(TreeshakeServerComposables.vite({ filter: options.filter, sourcemap: options.sourcemap, ...treeshakeOpts }));
|
|
255
|
+
}
|
|
256
|
+
if (options.transformSeoMeta !== false) {
|
|
257
|
+
const seoMetaOpts = typeof options.transformSeoMeta === "object" ? options.transformSeoMeta : {};
|
|
258
|
+
plugins.push(UseSeoMetaTransform.vite({ filter: options.filter, sourcemap: options.sourcemap, ...seoMetaOpts }));
|
|
259
|
+
}
|
|
260
|
+
if (options.minify !== false) {
|
|
261
|
+
const minifyOpts = typeof options.minify === "object" ? options.minify : {};
|
|
262
|
+
if (minifyOpts.js || minifyOpts.css) {
|
|
263
|
+
plugins.push(MinifyTransform.vite({ filter: options.filter, sourcemap: options.sourcemap, ...minifyOpts }));
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
if (options.validate !== false) {
|
|
267
|
+
const pluginsSource = framework ? `${framework}/plugins` : "unhead/plugins";
|
|
268
|
+
ctx.addRuntimePlugin({
|
|
269
|
+
import: { name: "ValidatePlugin", source: pluginsSource, as: "__unhead_validate" },
|
|
270
|
+
client: "_h.use(__unhead_validate({ root: __ROOT__ }))"
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
if (options.devtools !== false) {
|
|
274
|
+
const devtoolsOpts = typeof options.devtools === "object" ? options.devtools : {};
|
|
275
|
+
plugins.push(unheadDevtools({ ...devtoolsOpts, _ctx: ctx }));
|
|
276
|
+
}
|
|
277
|
+
plugins.push(SSRStaticReplace.vite({}));
|
|
278
|
+
plugins.push(CreateHeadTransform(ctx));
|
|
279
|
+
return plugins;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export { Unhead };
|
package/dist/webpack.mjs
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { T as TreeshakeServerComposables, U as UseSeoMetaTransform, M as MinifyTransform, S as SSRStaticReplace } from './shared/bundler.DRWfqG8C.mjs';
|
|
2
|
+
import 'node:url';
|
|
3
|
+
import 'magic-string';
|
|
4
|
+
import 'oxc-parser';
|
|
5
|
+
import 'oxc-walker';
|
|
6
|
+
import 'ufo';
|
|
7
|
+
import 'unplugin';
|
|
8
|
+
import 'node:vm';
|
|
9
|
+
import 'unhead/utils';
|
|
10
|
+
|
|
11
|
+
function Unhead(options = {}) {
|
|
12
|
+
const plugins = [];
|
|
13
|
+
if (options.treeshake !== false) {
|
|
14
|
+
const treeshakeOpts = typeof options.treeshake === "object" ? options.treeshake : {};
|
|
15
|
+
plugins.push(TreeshakeServerComposables.webpack({ filter: options.filter, sourcemap: options.sourcemap, ...treeshakeOpts }));
|
|
16
|
+
}
|
|
17
|
+
if (options.transformSeoMeta !== false) {
|
|
18
|
+
const seoMetaOpts = typeof options.transformSeoMeta === "object" ? options.transformSeoMeta : {};
|
|
19
|
+
plugins.push(UseSeoMetaTransform.webpack({ filter: options.filter, sourcemap: options.sourcemap, ...seoMetaOpts }));
|
|
20
|
+
}
|
|
21
|
+
if (options.minify !== false) {
|
|
22
|
+
const minifyOpts = typeof options.minify === "object" ? options.minify : {};
|
|
23
|
+
if (minifyOpts.js || minifyOpts.css) {
|
|
24
|
+
plugins.push(MinifyTransform.webpack({ filter: options.filter, sourcemap: options.sourcemap, ...minifyOpts }));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
plugins.push(SSRStaticReplace.webpack({}));
|
|
28
|
+
return plugins;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { Unhead };
|
package/package.json
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@unhead/bundler",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "3.0.0-rc.1",
|
|
5
|
+
"description": "Unhead build-time optimizations for Vite and Webpack.",
|
|
6
|
+
"author": "Harlan Wilton <harlan@harlanzw.com>",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"funding": "https://github.com/sponsors/harlan-zw",
|
|
9
|
+
"homepage": "https://unhead.unjs.io",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/unjs/unhead.git",
|
|
13
|
+
"directory": "packages/bundler"
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public",
|
|
17
|
+
"tag": "next"
|
|
18
|
+
},
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/unjs/unhead/issues"
|
|
21
|
+
},
|
|
22
|
+
"sideEffects": false,
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"default": "./dist/index.mjs"
|
|
27
|
+
},
|
|
28
|
+
"./vite": {
|
|
29
|
+
"types": "./dist/vite.d.ts",
|
|
30
|
+
"default": "./dist/vite.mjs"
|
|
31
|
+
},
|
|
32
|
+
"./webpack": {
|
|
33
|
+
"types": "./dist/webpack.d.ts",
|
|
34
|
+
"default": "./dist/webpack.mjs"
|
|
35
|
+
},
|
|
36
|
+
"./minify/rolldown": {
|
|
37
|
+
"types": "./dist/minify/rolldown.d.ts",
|
|
38
|
+
"default": "./dist/minify/rolldown.mjs"
|
|
39
|
+
},
|
|
40
|
+
"./minify/esbuild": {
|
|
41
|
+
"types": "./dist/minify/esbuild.d.ts",
|
|
42
|
+
"default": "./dist/minify/esbuild.mjs"
|
|
43
|
+
},
|
|
44
|
+
"./minify/lightningcss": {
|
|
45
|
+
"types": "./dist/minify/lightningcss.d.ts",
|
|
46
|
+
"default": "./dist/minify/lightningcss.mjs"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"main": "dist/index.mjs",
|
|
50
|
+
"module": "dist/index.mjs",
|
|
51
|
+
"types": "dist/index.d.ts",
|
|
52
|
+
"typesVersions": {
|
|
53
|
+
"*": {
|
|
54
|
+
"vite": [
|
|
55
|
+
"dist/vite"
|
|
56
|
+
],
|
|
57
|
+
"webpack": [
|
|
58
|
+
"dist/webpack"
|
|
59
|
+
],
|
|
60
|
+
"minify/rolldown": [
|
|
61
|
+
"dist/minify/rolldown"
|
|
62
|
+
],
|
|
63
|
+
"minify/esbuild": [
|
|
64
|
+
"dist/minify/esbuild"
|
|
65
|
+
],
|
|
66
|
+
"minify/lightningcss": [
|
|
67
|
+
"dist/minify/lightningcss"
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"files": [
|
|
72
|
+
"*.d.ts",
|
|
73
|
+
"dist"
|
|
74
|
+
],
|
|
75
|
+
"peerDependencies": {
|
|
76
|
+
"esbuild": ">=0.17.0",
|
|
77
|
+
"lightningcss": ">=1.20.0",
|
|
78
|
+
"rolldown": ">=1.0.0-beta.0",
|
|
79
|
+
"unhead": "^3.0.0-rc.1"
|
|
80
|
+
},
|
|
81
|
+
"peerDependenciesMeta": {
|
|
82
|
+
"esbuild": {
|
|
83
|
+
"optional": true
|
|
84
|
+
},
|
|
85
|
+
"lightningcss": {
|
|
86
|
+
"optional": true
|
|
87
|
+
},
|
|
88
|
+
"rolldown": {
|
|
89
|
+
"optional": true
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"dependencies": {
|
|
93
|
+
"@rollup/pluginutils": "^5.3.0",
|
|
94
|
+
"@vitejs/devtools-kit": "^0.1.13",
|
|
95
|
+
"magic-string": "^0.30.21",
|
|
96
|
+
"oxc-parser": "^0.124.0",
|
|
97
|
+
"oxc-walker": "^0.7.0",
|
|
98
|
+
"ufo": "^1.6.3",
|
|
99
|
+
"unplugin": "^3.0.0"
|
|
100
|
+
},
|
|
101
|
+
"devDependencies": {
|
|
102
|
+
"rollup": "^4.60.1",
|
|
103
|
+
"vite": "^8.0.8",
|
|
104
|
+
"unhead": "3.0.0-rc.1"
|
|
105
|
+
},
|
|
106
|
+
"scripts": {
|
|
107
|
+
"build": "unbuild",
|
|
108
|
+
"stub": "unbuild --stub",
|
|
109
|
+
"test:attw": "attw --pack"
|
|
110
|
+
}
|
|
111
|
+
}
|
package/vite.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/client'
|
package/webpack.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/plugins'
|