vxrn 0.1.49 → 0.1.51
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/cjs/exports/build.js +7 -91
- package/dist/cjs/exports/build.js.map +2 -2
- package/dist/cjs/exports/build.native.js +49 -354
- package/dist/cjs/exports/build.native.js.map +2 -2
- package/dist/cjs/exports/serve.js +1 -1
- package/dist/cjs/exports/serve.js.map +1 -1
- package/dist/cjs/exports/serve.native.js +1 -1
- package/dist/cjs/exports/serve.native.js.map +1 -1
- package/dist/cjs/index.js +4 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.native.js +8 -0
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/types.native.js.map +1 -1
- package/dist/cjs/utils/getOptionsFilled.js.map +1 -1
- package/dist/cjs/utils/getOptionsFilled.native.js.map +1 -1
- package/dist/cjs/utils/getVitePath.js +2 -2
- package/dist/cjs/utils/getVitePath.js.map +2 -2
- package/dist/cjs/utils/getVitePath.native.js +8 -8
- package/dist/cjs/utils/getVitePath.native.js.map +2 -2
- package/dist/cjs/utils/readVXRNConfig.js +15 -18
- package/dist/cjs/utils/readVXRNConfig.js.map +2 -2
- package/dist/cjs/utils/readVXRNConfig.native.js +26 -28
- package/dist/cjs/utils/readVXRNConfig.native.js.map +2 -2
- package/dist/esm/exports/build.js +8 -96
- package/dist/esm/exports/build.js.map +1 -1
- package/dist/esm/exports/build.mjs +14 -130
- package/dist/esm/exports/build.native.js +50 -360
- package/dist/esm/exports/build.native.js.map +2 -2
- package/dist/esm/exports/serve.js +1 -1
- package/dist/esm/exports/serve.js.map +1 -1
- package/dist/esm/exports/serve.mjs +1 -1
- package/dist/esm/exports/serve.native.js +1 -1
- package/dist/esm/exports/serve.native.js.map +1 -1
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +4 -0
- package/dist/esm/index.native.js +4 -0
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/utils/getOptionsFilled.js.map +1 -1
- package/dist/esm/utils/getOptionsFilled.native.js.map +1 -1
- package/dist/esm/utils/getVitePath.js +2 -2
- package/dist/esm/utils/getVitePath.js.map +1 -1
- package/dist/esm/utils/getVitePath.mjs +2 -2
- package/dist/esm/utils/getVitePath.native.js +8 -8
- package/dist/esm/utils/getVitePath.native.js.map +2 -2
- package/dist/esm/utils/readVXRNConfig.js +16 -19
- package/dist/esm/utils/readVXRNConfig.js.map +1 -1
- package/dist/esm/utils/readVXRNConfig.mjs +17 -21
- package/dist/esm/utils/readVXRNConfig.native.js +27 -29
- package/dist/esm/utils/readVXRNConfig.native.js.map +2 -2
- package/package.json +8 -8
- package/src/exports/build.ts +20 -177
- package/src/exports/serve.ts +4 -0
- package/src/index.ts +5 -0
- package/src/types.ts +9 -0
- package/src/utils/getOptionsFilled.ts +0 -1
- package/src/utils/getVitePath.ts +3 -3
- package/src/utils/readVXRNConfig.ts +18 -25
- package/types/index.d.ts +4 -0
- package/types/types.d.ts +4 -0
- package/types/utils/getOptionsFilled.d.ts +2 -0
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import FSExtra from "fs-extra";
|
|
2
2
|
import { resolve as importMetaResolve } from "import-meta-resolve";
|
|
3
|
-
import
|
|
4
|
-
import { tmpdir } from "node:os";
|
|
5
|
-
import Path from "node:path";
|
|
3
|
+
import { rm } from "node:fs/promises";
|
|
6
4
|
import { mergeConfig, build as viteBuild } from "vite";
|
|
7
|
-
import FSExtra from "fs-extra";
|
|
8
5
|
import { getBaseViteConfig } from "../utils/getBaseViteConfig.mjs";
|
|
9
|
-
import { getHtml } from "../utils/getHtml.mjs";
|
|
10
6
|
import { getOptimizeDeps } from "../utils/getOptimizeDeps.mjs";
|
|
11
7
|
import { getOptionsFilled } from "../utils/getOptionsFilled.mjs";
|
|
12
|
-
|
|
8
|
+
const {
|
|
9
|
+
existsSync
|
|
10
|
+
} = FSExtra;
|
|
13
11
|
Error.stackTraceLimit = 1 / 0;
|
|
14
12
|
const resolveFile = path => {
|
|
15
13
|
try {
|
|
@@ -18,15 +16,15 @@ const resolveFile = path => {
|
|
|
18
16
|
return require.resolve(path);
|
|
19
17
|
}
|
|
20
18
|
},
|
|
21
|
-
{
|
|
22
|
-
ensureDir,
|
|
23
|
-
existsSync,
|
|
24
|
-
readFile,
|
|
25
|
-
pathExists
|
|
26
|
-
} = FSExtra,
|
|
27
19
|
build = async (optionsIn, buildOptions = {}) => {
|
|
28
20
|
const options = await getOptionsFilled(optionsIn);
|
|
29
|
-
|
|
21
|
+
existsSync("dist") && (await rm("dist", {
|
|
22
|
+
recursive: !0,
|
|
23
|
+
force: !0
|
|
24
|
+
})), existsSync("node_modules/.vite") && (await rm("node_modules/.vite", {
|
|
25
|
+
recursive: !0,
|
|
26
|
+
force: !0
|
|
27
|
+
})), process.env.NODE_ENV = "production";
|
|
30
28
|
const {
|
|
31
29
|
optimizeDeps
|
|
32
30
|
} = getOptimizeDeps("build");
|
|
@@ -37,7 +35,7 @@ const resolveFile = path => {
|
|
|
37
35
|
clearScreen: !1,
|
|
38
36
|
optimizeDeps
|
|
39
37
|
});
|
|
40
|
-
options.webConfig && (webBuildConfig = mergeConfig(webBuildConfig, options.webConfig)), buildOptions.step !== "generate" && (
|
|
38
|
+
options.webConfig && (webBuildConfig = mergeConfig(webBuildConfig, options.webConfig)), buildOptions.step !== "generate" && (await viteBuild(mergeConfig(webBuildConfig, {
|
|
41
39
|
build: {
|
|
42
40
|
ssrManifest: !0,
|
|
43
41
|
outDir: "dist/client"
|
|
@@ -46,11 +44,6 @@ const resolveFile = path => {
|
|
|
46
44
|
const {
|
|
47
45
|
output
|
|
48
46
|
} = await viteBuild(mergeConfig(webBuildConfig, {
|
|
49
|
-
// optimizeDeps: {
|
|
50
|
-
// esbuildOptions: {
|
|
51
|
-
// format: 'cjs',
|
|
52
|
-
// },
|
|
53
|
-
// },
|
|
54
47
|
ssr: {
|
|
55
48
|
noExternal: optimizeDeps.include,
|
|
56
49
|
optimizeDeps
|
|
@@ -65,115 +58,6 @@ const resolveFile = path => {
|
|
|
65
58
|
}
|
|
66
59
|
}
|
|
67
60
|
}));
|
|
68
|
-
|
|
61
|
+
options.afterBuild && (await options.afterBuild(options, output));
|
|
69
62
|
};
|
|
70
|
-
async function generateStaticPages(options, serverOutput) {
|
|
71
|
-
const toAbsolute = p => Path.resolve(options.root, p),
|
|
72
|
-
staticDir = toAbsolute("dist/static");
|
|
73
|
-
await ensureDir(staticDir);
|
|
74
|
-
const template = fs.readFileSync(toAbsolute("index.html"), "utf-8"),
|
|
75
|
-
render = (await import(`${options.root}/dist/server/entry-server.js`)).render,
|
|
76
|
-
assets = [],
|
|
77
|
-
allRoutes = [];
|
|
78
|
-
for (const output of serverOutput) {
|
|
79
|
-
let getUrl = function (_params = {}) {
|
|
80
|
-
if (name === "index") return "/";
|
|
81
|
-
if (name.startsWith("[...")) {
|
|
82
|
-
const part = name.replace("[...", "").replace("]", "");
|
|
83
|
-
return `/${_params[part]}`;
|
|
84
|
-
}
|
|
85
|
-
return `/${name.split("/").map(part => {
|
|
86
|
-
if (part[0] === "[") {
|
|
87
|
-
const found = _params[part.slice(1, part.length - 1)];
|
|
88
|
-
return found || console.warn("not found", {
|
|
89
|
-
_params,
|
|
90
|
-
part
|
|
91
|
-
}), found;
|
|
92
|
-
}
|
|
93
|
-
return part;
|
|
94
|
-
}).join("/")}`;
|
|
95
|
-
};
|
|
96
|
-
if (output.type === "asset") {
|
|
97
|
-
assets.push(output);
|
|
98
|
-
continue;
|
|
99
|
-
}
|
|
100
|
-
const id = output.facadeModuleId || "",
|
|
101
|
-
file = Path.basename(id),
|
|
102
|
-
name = file.replace(/\.[^/.]+$/, "");
|
|
103
|
-
if (!id || file[0] === "_" || file.includes("entry-server") || id.includes("+api")) continue;
|
|
104
|
-
const endpointPath = Path.join(options.root, "dist/server", output.fileName);
|
|
105
|
-
let exported;
|
|
106
|
-
try {
|
|
107
|
-
exported = await import(endpointPath);
|
|
108
|
-
} catch (err) {
|
|
109
|
-
throw console.error("Error importing page (original error)", err), new Error(`Error importing page: ${endpointPath}`, {
|
|
110
|
-
cause: err
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
const paramsList = (await exported.generateStaticParams?.()) ?? [{}];
|
|
114
|
-
for (const params of paramsList) {
|
|
115
|
-
const path = getUrl(params),
|
|
116
|
-
loaderData = (await exported.loader?.({
|
|
117
|
-
path,
|
|
118
|
-
params
|
|
119
|
-
})) ?? {};
|
|
120
|
-
allRoutes.push({
|
|
121
|
-
path,
|
|
122
|
-
params,
|
|
123
|
-
loaderData
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
const cssStringRaw = assets.filter(x => x.name?.endsWith(".css")).map(x => x.source).join(`
|
|
128
|
-
|
|
129
|
-
`),
|
|
130
|
-
tmpCssFile = Path.join(tmpdir(), "tmp.css");
|
|
131
|
-
await FSExtra.writeFile(tmpCssFile, cssStringRaw, "utf-8"), await esbuild({
|
|
132
|
-
entryPoints: [tmpCssFile],
|
|
133
|
-
target: "safari17",
|
|
134
|
-
bundle: !0,
|
|
135
|
-
minifyWhitespace: !0,
|
|
136
|
-
sourcemap: !1,
|
|
137
|
-
outfile: tmpCssFile,
|
|
138
|
-
loader: {
|
|
139
|
-
".css": "css"
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
const cssString = await FSExtra.readFile(tmpCssFile, "utf-8");
|
|
143
|
-
for (const {
|
|
144
|
-
path,
|
|
145
|
-
loaderData,
|
|
146
|
-
params
|
|
147
|
-
} of allRoutes) try {
|
|
148
|
-
const loaderProps = {
|
|
149
|
-
params
|
|
150
|
-
};
|
|
151
|
-
globalThis.__vxrnLoaderProps__ = loaderProps, console.info("render", path);
|
|
152
|
-
const {
|
|
153
|
-
appHtml,
|
|
154
|
-
headHtml
|
|
155
|
-
} = await render({
|
|
156
|
-
path
|
|
157
|
-
}),
|
|
158
|
-
slashFileName = `${path === "/" ? "/index" : path}.html`,
|
|
159
|
-
clientHtmlPath = toAbsolute(`dist/client${slashFileName}`),
|
|
160
|
-
clientHtml = existsSync(clientHtmlPath) ? await readFile(clientHtmlPath, "utf-8") : null,
|
|
161
|
-
html = getHtml({
|
|
162
|
-
template: clientHtml || template,
|
|
163
|
-
appHtml,
|
|
164
|
-
headHtml,
|
|
165
|
-
loaderData,
|
|
166
|
-
loaderProps,
|
|
167
|
-
css: cssString
|
|
168
|
-
}),
|
|
169
|
-
filePath = toAbsolute(`dist/static${slashFileName}`);
|
|
170
|
-
await ensureDir(Path.dirname(filePath)), fs.writeFileSync(toAbsolute(filePath), html);
|
|
171
|
-
} catch (err) {
|
|
172
|
-
throw assertIsError(err), console.error("og error because cause not working", err), new Error(`Error building static page: ${path} with:
|
|
173
|
-
loaderData: ${JSON.stringify(loaderData || null)}
|
|
174
|
-
params: ${JSON.stringify(params || null)}`, {
|
|
175
|
-
cause: err
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
63
|
export { build, resolveFile };
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import FSExtra from "fs-extra";
|
|
2
2
|
import { resolve as importMetaResolve } from "import-meta-resolve";
|
|
3
|
-
import
|
|
4
|
-
import { tmpdir } from "node:os";
|
|
5
|
-
import Path from "node:path";
|
|
3
|
+
import { rm } from "node:fs/promises";
|
|
6
4
|
import { mergeConfig, build as viteBuild } from "vite";
|
|
7
|
-
import FSExtra from "fs-extra";
|
|
8
5
|
import { getBaseViteConfig } from "../utils/getBaseViteConfig";
|
|
9
|
-
import { getHtml } from "../utils/getHtml";
|
|
10
6
|
import { getOptimizeDeps } from "../utils/getOptimizeDeps";
|
|
11
7
|
import { getOptionsFilled } from "../utils/getOptionsFilled";
|
|
12
|
-
import { assertIsError } from "../utils/assert";
|
|
13
8
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
14
9
|
try {
|
|
15
10
|
var info = gen[key](arg), value = info.value;
|
|
@@ -125,21 +120,7 @@ function _ts_generator(thisArg, body) {
|
|
|
125
120
|
};
|
|
126
121
|
}
|
|
127
122
|
}
|
|
128
|
-
|
|
129
|
-
var s = typeof Symbol == "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
130
|
-
if (m)
|
|
131
|
-
return m.call(o);
|
|
132
|
-
if (o && typeof o.length == "number")
|
|
133
|
-
return {
|
|
134
|
-
next: function() {
|
|
135
|
-
return o && i >= o.length && (o = void 0), {
|
|
136
|
-
value: o && o[i++],
|
|
137
|
-
done: !o
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
142
|
-
}
|
|
123
|
+
var existsSync = FSExtra.existsSync;
|
|
143
124
|
Error.stackTraceLimit = 1 / 0;
|
|
144
125
|
var resolveFile = function(path) {
|
|
145
126
|
try {
|
|
@@ -147,7 +128,7 @@ var resolveFile = function(path) {
|
|
|
147
128
|
} catch {
|
|
148
129
|
return require.resolve(path);
|
|
149
130
|
}
|
|
150
|
-
},
|
|
131
|
+
}, build = function() {
|
|
151
132
|
var _ref = _async_to_generator(function(optionsIn) {
|
|
152
133
|
var buildOptions, options, optimizeDeps, webBuildConfig, output, _arguments = arguments;
|
|
153
134
|
return _ts_generator(this, function(_state) {
|
|
@@ -158,7 +139,37 @@ var resolveFile = function(path) {
|
|
|
158
139
|
getOptionsFilled(optionsIn)
|
|
159
140
|
];
|
|
160
141
|
case 1:
|
|
161
|
-
return options = _state.sent(),
|
|
142
|
+
return options = _state.sent(), // lets always clean dist folder for now to be sure were correct
|
|
143
|
+
existsSync("dist") ? [
|
|
144
|
+
4,
|
|
145
|
+
rm("dist", {
|
|
146
|
+
recursive: !0,
|
|
147
|
+
force: !0
|
|
148
|
+
})
|
|
149
|
+
] : [
|
|
150
|
+
3,
|
|
151
|
+
3
|
|
152
|
+
];
|
|
153
|
+
case 2:
|
|
154
|
+
_state.sent(), _state.label = 3;
|
|
155
|
+
case 3:
|
|
156
|
+
return (
|
|
157
|
+
// lets always clean dist folder for now to be sure were correct
|
|
158
|
+
existsSync("node_modules/.vite") ? [
|
|
159
|
+
4,
|
|
160
|
+
rm("node_modules/.vite", {
|
|
161
|
+
recursive: !0,
|
|
162
|
+
force: !0
|
|
163
|
+
})
|
|
164
|
+
] : [
|
|
165
|
+
3,
|
|
166
|
+
5
|
|
167
|
+
]
|
|
168
|
+
);
|
|
169
|
+
case 4:
|
|
170
|
+
_state.sent(), _state.label = 5;
|
|
171
|
+
case 5:
|
|
172
|
+
return process.env.NODE_ENV = "production", optimizeDeps = getOptimizeDeps("build").optimizeDeps, webBuildConfig = mergeConfig(getBaseViteConfig({
|
|
162
173
|
mode: "production"
|
|
163
174
|
}), {
|
|
164
175
|
root: options.root,
|
|
@@ -166,8 +177,8 @@ var resolveFile = function(path) {
|
|
|
166
177
|
optimizeDeps
|
|
167
178
|
}), options.webConfig && (webBuildConfig = mergeConfig(webBuildConfig, options.webConfig)), buildOptions.step === "generate" ? [
|
|
168
179
|
3,
|
|
169
|
-
|
|
170
|
-
] :
|
|
180
|
+
7
|
|
181
|
+
] : [
|
|
171
182
|
4,
|
|
172
183
|
viteBuild(mergeConfig(webBuildConfig, {
|
|
173
184
|
build: {
|
|
@@ -175,18 +186,13 @@ var resolveFile = function(path) {
|
|
|
175
186
|
outDir: "dist/client"
|
|
176
187
|
}
|
|
177
188
|
}))
|
|
178
|
-
]
|
|
179
|
-
case
|
|
180
|
-
_state.sent(), _state.label =
|
|
181
|
-
case
|
|
189
|
+
];
|
|
190
|
+
case 6:
|
|
191
|
+
_state.sent(), _state.label = 7;
|
|
192
|
+
case 7:
|
|
182
193
|
return console.info("build server"), [
|
|
183
194
|
4,
|
|
184
195
|
viteBuild(mergeConfig(webBuildConfig, {
|
|
185
|
-
// optimizeDeps: {
|
|
186
|
-
// esbuildOptions: {
|
|
187
|
-
// format: 'cjs',
|
|
188
|
-
// },
|
|
189
|
-
// },
|
|
190
196
|
ssr: {
|
|
191
197
|
noExternal: optimizeDeps.include,
|
|
192
198
|
optimizeDeps
|
|
@@ -202,343 +208,27 @@ var resolveFile = function(path) {
|
|
|
202
208
|
}
|
|
203
209
|
}))
|
|
204
210
|
];
|
|
205
|
-
case
|
|
206
|
-
return output = _state.sent().output,
|
|
207
|
-
4,
|
|
208
|
-
generateStaticPages(options, output)
|
|
209
|
-
];
|
|
210
|
-
case 5:
|
|
211
|
-
return _state.sent(), [
|
|
212
|
-
2
|
|
213
|
-
];
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
});
|
|
217
|
-
return function(optionsIn) {
|
|
218
|
-
return _ref.apply(this, arguments);
|
|
219
|
-
};
|
|
220
|
-
}();
|
|
221
|
-
function generateStaticPages(options, serverOutput) {
|
|
222
|
-
return _generateStaticPages.apply(this, arguments);
|
|
223
|
-
}
|
|
224
|
-
function _generateStaticPages() {
|
|
225
|
-
return _generateStaticPages = _async_to_generator(function(options, serverOutput) {
|
|
226
|
-
var toAbsolute, staticDir, template, render, assets, allRoutes, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _loop, _iterator, _step, err, cssStringRaw, tmpCssFile, cssString, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, _step_value, path, loaderData, params, loaderProps, _ref, appHtml, headHtml, slashFileName, clientHtmlPath, clientHtml, _tmp, html, filePath, err1, err;
|
|
227
|
-
return _ts_generator(this, function(_state) {
|
|
228
|
-
switch (_state.label) {
|
|
229
|
-
case 0:
|
|
230
|
-
return toAbsolute = function(p) {
|
|
231
|
-
return Path.resolve(options.root, p);
|
|
232
|
-
}, staticDir = toAbsolute("dist/static"), [
|
|
233
|
-
4,
|
|
234
|
-
ensureDir(staticDir)
|
|
235
|
-
];
|
|
236
|
-
case 1:
|
|
237
|
-
return _state.sent(), template = fs.readFileSync(toAbsolute("index.html"), "utf-8"), [
|
|
211
|
+
case 8:
|
|
212
|
+
return output = _state.sent().output, options.afterBuild ? [
|
|
238
213
|
4,
|
|
239
|
-
|
|
240
|
-
];
|
|
241
|
-
case 2:
|
|
242
|
-
render = _state.sent().render, assets = [], allRoutes = [], _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0, _state.label = 3;
|
|
243
|
-
case 3:
|
|
244
|
-
_state.trys.push([
|
|
245
|
-
3,
|
|
246
|
-
8,
|
|
247
|
-
9,
|
|
248
|
-
10
|
|
249
|
-
]), _loop = function() {
|
|
250
|
-
var output, getUrl, _exported_generateStaticParams, id, file, name, endpointPath, exported, err12, _ref2, paramsList, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step12, params2, _exported_loader, path2, _ref1, loaderData2, err2;
|
|
251
|
-
return _ts_generator(this, function(_state2) {
|
|
252
|
-
switch (_state2.label) {
|
|
253
|
-
case 0:
|
|
254
|
-
if (output = _step.value, getUrl = function() {
|
|
255
|
-
var _params = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
256
|
-
if (name === "index")
|
|
257
|
-
return "/";
|
|
258
|
-
if (name.startsWith("[...")) {
|
|
259
|
-
var part = name.replace("[...", "").replace("]", "");
|
|
260
|
-
return "/".concat(_params[part]);
|
|
261
|
-
}
|
|
262
|
-
return "/".concat(name.split("/").map(function(part2) {
|
|
263
|
-
if (part2[0] === "[") {
|
|
264
|
-
var found = _params[part2.slice(1, part2.length - 1)];
|
|
265
|
-
return found || console.warn("not found", {
|
|
266
|
-
_params,
|
|
267
|
-
part: part2
|
|
268
|
-
}), found;
|
|
269
|
-
}
|
|
270
|
-
return part2;
|
|
271
|
-
}).join("/"));
|
|
272
|
-
}, output.type === "asset")
|
|
273
|
-
return assets.push(output), [
|
|
274
|
-
2,
|
|
275
|
-
"continue"
|
|
276
|
-
];
|
|
277
|
-
if (id = output.facadeModuleId || "", file = Path.basename(id), name = file.replace(/\.[^/.]+$/, ""), !id || file[0] === "_" || file.includes("entry-server"))
|
|
278
|
-
return [
|
|
279
|
-
2,
|
|
280
|
-
"continue"
|
|
281
|
-
];
|
|
282
|
-
if (id.includes("+api"))
|
|
283
|
-
return [
|
|
284
|
-
2,
|
|
285
|
-
"continue"
|
|
286
|
-
];
|
|
287
|
-
endpointPath = Path.join(options.root, "dist/server", output.fileName), exported = void 0, _state2.label = 1;
|
|
288
|
-
case 1:
|
|
289
|
-
return _state2.trys.push([
|
|
290
|
-
1,
|
|
291
|
-
3,
|
|
292
|
-
,
|
|
293
|
-
4
|
|
294
|
-
]), [
|
|
295
|
-
4,
|
|
296
|
-
import(endpointPath)
|
|
297
|
-
];
|
|
298
|
-
case 2:
|
|
299
|
-
return exported = _state2.sent(), [
|
|
300
|
-
3,
|
|
301
|
-
4
|
|
302
|
-
];
|
|
303
|
-
case 3:
|
|
304
|
-
throw err12 = _state2.sent(), console.error("Error importing page (original error)", err12), new Error("Error importing page: ".concat(endpointPath), {
|
|
305
|
-
cause: err12
|
|
306
|
-
});
|
|
307
|
-
case 4:
|
|
308
|
-
return [
|
|
309
|
-
4,
|
|
310
|
-
(_exported_generateStaticParams = exported.generateStaticParams) === null || _exported_generateStaticParams === void 0 ? void 0 : _exported_generateStaticParams.call(exported)
|
|
311
|
-
];
|
|
312
|
-
case 5:
|
|
313
|
-
paramsList = (_ref2 = _state2.sent()) !== null && _ref2 !== void 0 ? _ref2 : [
|
|
314
|
-
{}
|
|
315
|
-
], _iteratorNormalCompletion2 = !0, _didIteratorError2 = !1, _iteratorError2 = void 0, _state2.label = 6;
|
|
316
|
-
case 6:
|
|
317
|
-
_state2.trys.push([
|
|
318
|
-
6,
|
|
319
|
-
11,
|
|
320
|
-
12,
|
|
321
|
-
13
|
|
322
|
-
]), _iterator2 = paramsList[Symbol.iterator](), _state2.label = 7;
|
|
323
|
-
case 7:
|
|
324
|
-
return (_iteratorNormalCompletion2 = (_step12 = _iterator2.next()).done) ? [
|
|
325
|
-
3,
|
|
326
|
-
10
|
|
327
|
-
] : (params2 = _step12.value, path2 = getUrl(params2), [
|
|
328
|
-
4,
|
|
329
|
-
(_exported_loader = exported.loader) === null || _exported_loader === void 0 ? void 0 : _exported_loader.call(exported, {
|
|
330
|
-
path: path2,
|
|
331
|
-
params: params2
|
|
332
|
-
})
|
|
333
|
-
]);
|
|
334
|
-
case 8:
|
|
335
|
-
loaderData2 = (_ref1 = _state2.sent()) !== null && _ref1 !== void 0 ? _ref1 : {}, allRoutes.push({
|
|
336
|
-
path: path2,
|
|
337
|
-
params: params2,
|
|
338
|
-
loaderData: loaderData2
|
|
339
|
-
}), _state2.label = 9;
|
|
340
|
-
case 9:
|
|
341
|
-
return _iteratorNormalCompletion2 = !0, [
|
|
342
|
-
3,
|
|
343
|
-
7
|
|
344
|
-
];
|
|
345
|
-
case 10:
|
|
346
|
-
return [
|
|
347
|
-
3,
|
|
348
|
-
13
|
|
349
|
-
];
|
|
350
|
-
case 11:
|
|
351
|
-
return err2 = _state2.sent(), _didIteratorError2 = !0, _iteratorError2 = err2, [
|
|
352
|
-
3,
|
|
353
|
-
13
|
|
354
|
-
];
|
|
355
|
-
case 12:
|
|
356
|
-
try {
|
|
357
|
-
!_iteratorNormalCompletion2 && _iterator2.return != null && _iterator2.return();
|
|
358
|
-
} finally {
|
|
359
|
-
if (_didIteratorError2)
|
|
360
|
-
throw _iteratorError2;
|
|
361
|
-
}
|
|
362
|
-
return [
|
|
363
|
-
7
|
|
364
|
-
];
|
|
365
|
-
case 13:
|
|
366
|
-
return [
|
|
367
|
-
2
|
|
368
|
-
];
|
|
369
|
-
}
|
|
370
|
-
});
|
|
371
|
-
}, _iterator = serverOutput[Symbol.iterator](), _state.label = 4;
|
|
372
|
-
case 4:
|
|
373
|
-
return (_iteratorNormalCompletion = (_step = _iterator.next()).done) ? [
|
|
374
|
-
3,
|
|
375
|
-
7
|
|
214
|
+
options.afterBuild(options, output)
|
|
376
215
|
] : [
|
|
377
|
-
5,
|
|
378
|
-
_ts_values(_loop())
|
|
379
|
-
];
|
|
380
|
-
case 5:
|
|
381
|
-
_state.sent(), _state.label = 6;
|
|
382
|
-
case 6:
|
|
383
|
-
return _iteratorNormalCompletion = !0, [
|
|
384
|
-
3,
|
|
385
|
-
4
|
|
386
|
-
];
|
|
387
|
-
case 7:
|
|
388
|
-
return [
|
|
389
|
-
3,
|
|
390
|
-
10
|
|
391
|
-
];
|
|
392
|
-
case 8:
|
|
393
|
-
return err = _state.sent(), _didIteratorError = !0, _iteratorError = err, [
|
|
394
216
|
3,
|
|
395
217
|
10
|
|
396
218
|
];
|
|
397
219
|
case 9:
|
|
398
|
-
|
|
399
|
-
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
|
400
|
-
} finally {
|
|
401
|
-
if (_didIteratorError)
|
|
402
|
-
throw _iteratorError;
|
|
403
|
-
}
|
|
404
|
-
return [
|
|
405
|
-
7
|
|
406
|
-
];
|
|
220
|
+
_state.sent(), _state.label = 10;
|
|
407
221
|
case 10:
|
|
408
|
-
return cssStringRaw = assets.filter(function(x) {
|
|
409
|
-
var _x_name;
|
|
410
|
-
return (_x_name = x.name) === null || _x_name === void 0 ? void 0 : _x_name.endsWith(".css");
|
|
411
|
-
}).map(function(x) {
|
|
412
|
-
return x.source;
|
|
413
|
-
}).join(`
|
|
414
|
-
|
|
415
|
-
`), tmpCssFile = Path.join(tmpdir(), "tmp.css"), [
|
|
416
|
-
4,
|
|
417
|
-
FSExtra.writeFile(tmpCssFile, cssStringRaw, "utf-8")
|
|
418
|
-
];
|
|
419
|
-
case 11:
|
|
420
|
-
return _state.sent(), [
|
|
421
|
-
4,
|
|
422
|
-
esbuild({
|
|
423
|
-
entryPoints: [
|
|
424
|
-
tmpCssFile
|
|
425
|
-
],
|
|
426
|
-
target: "safari17",
|
|
427
|
-
bundle: !0,
|
|
428
|
-
minifyWhitespace: !0,
|
|
429
|
-
sourcemap: !1,
|
|
430
|
-
outfile: tmpCssFile,
|
|
431
|
-
loader: {
|
|
432
|
-
".css": "css"
|
|
433
|
-
}
|
|
434
|
-
})
|
|
435
|
-
];
|
|
436
|
-
case 12:
|
|
437
|
-
return _state.sent(), [
|
|
438
|
-
4,
|
|
439
|
-
FSExtra.readFile(tmpCssFile, "utf-8")
|
|
440
|
-
];
|
|
441
|
-
case 13:
|
|
442
|
-
cssString = _state.sent(), _iteratorNormalCompletion1 = !0, _didIteratorError1 = !1, _iteratorError1 = void 0, _state.label = 14;
|
|
443
|
-
case 14:
|
|
444
|
-
_state.trys.push([
|
|
445
|
-
14,
|
|
446
|
-
25,
|
|
447
|
-
26,
|
|
448
|
-
27
|
|
449
|
-
]), _iterator1 = allRoutes[Symbol.iterator](), _state.label = 15;
|
|
450
|
-
case 15:
|
|
451
|
-
if (_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done)
|
|
452
|
-
return [
|
|
453
|
-
3,
|
|
454
|
-
24
|
|
455
|
-
];
|
|
456
|
-
_step_value = _step1.value, path = _step_value.path, loaderData = _step_value.loaderData, params = _step_value.params, _state.label = 16;
|
|
457
|
-
case 16:
|
|
458
|
-
return _state.trys.push([
|
|
459
|
-
16,
|
|
460
|
-
22,
|
|
461
|
-
,
|
|
462
|
-
23
|
|
463
|
-
]), loaderProps = {
|
|
464
|
-
params
|
|
465
|
-
}, globalThis.__vxrnLoaderProps__ = loaderProps, console.info("render", path), [
|
|
466
|
-
4,
|
|
467
|
-
render({
|
|
468
|
-
path
|
|
469
|
-
})
|
|
470
|
-
];
|
|
471
|
-
case 17:
|
|
472
|
-
return _ref = _state.sent(), appHtml = _ref.appHtml, headHtml = _ref.headHtml, slashFileName = "".concat(path === "/" ? "/index" : path, ".html"), clientHtmlPath = toAbsolute("dist/client".concat(slashFileName)), existsSync(clientHtmlPath) ? [
|
|
473
|
-
4,
|
|
474
|
-
readFile(clientHtmlPath, "utf-8")
|
|
475
|
-
] : [
|
|
476
|
-
3,
|
|
477
|
-
19
|
|
478
|
-
];
|
|
479
|
-
case 18:
|
|
480
|
-
return _tmp = _state.sent(), [
|
|
481
|
-
3,
|
|
482
|
-
20
|
|
483
|
-
];
|
|
484
|
-
case 19:
|
|
485
|
-
_tmp = null, _state.label = 20;
|
|
486
|
-
case 20:
|
|
487
|
-
return clientHtml = _tmp, html = getHtml({
|
|
488
|
-
template: clientHtml || template,
|
|
489
|
-
appHtml,
|
|
490
|
-
headHtml,
|
|
491
|
-
loaderData,
|
|
492
|
-
loaderProps,
|
|
493
|
-
css: cssString
|
|
494
|
-
}), filePath = toAbsolute("dist/static".concat(slashFileName)), [
|
|
495
|
-
4,
|
|
496
|
-
ensureDir(Path.dirname(filePath))
|
|
497
|
-
];
|
|
498
|
-
case 21:
|
|
499
|
-
return _state.sent(), fs.writeFileSync(toAbsolute(filePath), html), [
|
|
500
|
-
3,
|
|
501
|
-
23
|
|
502
|
-
];
|
|
503
|
-
case 22:
|
|
504
|
-
throw err1 = _state.sent(), assertIsError(err1), console.error("og error because cause not working", err1), new Error("Error building static page: ".concat(path, ` with:
|
|
505
|
-
loaderData: `).concat(JSON.stringify(loaderData || null), `
|
|
506
|
-
params: `).concat(JSON.stringify(params || null)), {
|
|
507
|
-
cause: err1
|
|
508
|
-
});
|
|
509
|
-
case 23:
|
|
510
|
-
return _iteratorNormalCompletion1 = !0, [
|
|
511
|
-
3,
|
|
512
|
-
15
|
|
513
|
-
];
|
|
514
|
-
case 24:
|
|
515
|
-
return [
|
|
516
|
-
3,
|
|
517
|
-
27
|
|
518
|
-
];
|
|
519
|
-
case 25:
|
|
520
|
-
return err = _state.sent(), _didIteratorError1 = !0, _iteratorError1 = err, [
|
|
521
|
-
3,
|
|
522
|
-
27
|
|
523
|
-
];
|
|
524
|
-
case 26:
|
|
525
|
-
try {
|
|
526
|
-
!_iteratorNormalCompletion1 && _iterator1.return != null && _iterator1.return();
|
|
527
|
-
} finally {
|
|
528
|
-
if (_didIteratorError1)
|
|
529
|
-
throw _iteratorError1;
|
|
530
|
-
}
|
|
531
|
-
return [
|
|
532
|
-
7
|
|
533
|
-
];
|
|
534
|
-
case 27:
|
|
535
222
|
return [
|
|
536
223
|
2
|
|
537
224
|
];
|
|
538
225
|
}
|
|
539
226
|
});
|
|
540
|
-
})
|
|
541
|
-
|
|
227
|
+
});
|
|
228
|
+
return function(optionsIn) {
|
|
229
|
+
return _ref.apply(this, arguments);
|
|
230
|
+
};
|
|
231
|
+
}();
|
|
542
232
|
export {
|
|
543
233
|
build,
|
|
544
234
|
resolveFile
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/exports/Users/n8/vxrn/packages/vxrn/src/exports/build.ts"],
|
|
4
|
-
"mappings": "AAAA,
|
|
5
|
-
"names": ["
|
|
4
|
+
"mappings": "AAAA,OAAOA,aAAa;AACpB,SAASC,WAAWC,yBAAyB;AAC7C,SAASC,UAAU;AAEnB,SAASC,aAAaC,SAASC,iBAAkC;AAEjE,SAASC,yBAAyB;AAClC,SAASC,uBAAuB;AAChC,SAASC,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEjC,IAAQC,aAAeV,QAAfU;AAERC,MAAMC,kBAAkBC;AAEjB,IAAMC,cAAc,SAACC,MAAAA;AAC1B,MAAI;AACF,WAAOb,kBAAkBa,MAAM,YAAYC,GAAG,EAAEC,QAAQ,WAAW,EAAA;EACrE,QAAQ;AACN,WAAOC,QAAQjB,QAAQc,IAAAA;EACzB;AACF,GAIaV,QAAAA,WAAAA;aAAQ,oBAAA,SAAOc,WAAAA;QAAuBC,cAC3CC,SAeEC,cAEJC,gBA2BIC;;;;AA7CyCJ,gCAAAA,WAAAA,SAAAA,KAAAA,WAAAA,CAAAA,MAAAA,SAAAA,WAAAA,CAAAA,IAA6B,CAAC,GAC/D;;YAAMX,iBAAiBU,SAAAA;;;iBAAjCE,UAAU,OAAA,KAAA;UAGZX,WAAW,MAAA,IACb;;YAAMP,GAAG,QAAQ;cAAEsB,WAAW;cAAMC,OAAO;YAAK,CAAA;cAD9ChB;;;;;AACF,iBAAA,KAAA;;;;YAIEA,WAAW,oBAAA,IACb;;cAAMP,GAAG,sBAAsB;gBAAEsB,WAAW;gBAAMC,OAAO;cAAK,CAAA;gBAD5DhB;;;;;;AACF,iBAAA,KAAA;;iBAIFiB,QAAQC,IAAIC,WAAW,cAEfP,eAAiBd,gBAAgB,OAAA,EAAjCc,cAEJC,iBAAiBnB,YACnBG,kBAAkB;YAChBuB,MAAM;UACR,CAAA,GACA;YACEC,MAAMV,QAAQU;YACdC,aAAa;YACbV;UACF,CAAA,GAGED,QAAQY,cACVV,iBAAiBnB,YAAYmB,gBAAgBF,QAAQY,SAAS,IAG5Db,aAAac,SAAS,aAAtBd;;;cACF;;YAAMd,UACJF,YAAYmB,gBAAgB;cAC1BlB,OAAO;gBACL8B,aAAa;gBACbC,QAAQ;cACV;YACF,CAAA,CAAA;;;AANF,iBAAA,KAAA;;AAUFC,yBAAQC,KAAM,cAAA,GACM;;YAAMhC,UACxBF,YAAYmB,gBAAgB;cAC1BgB,KAAK;gBACHC,YAAYlB,aAAamB;gBACzBnB;cACF;cAEAjB,OAAO;;gBAELqC,cAAc;gBACdH,KAAK;gBACLH,QAAQ;gBACRO,eAAe;kBACbC,UAAQ,CAAA;gBACV;cACF;YACF,CAAA,CAAA;;;iBAhBMpB,SAAY,OAAA,KAAA,EAAZA,QAmBJH,QAAQwB,aACV;;YAAMxB,QAAQwB,WAAWxB,SAASG,MAAAA;cADhCH;;;;;AACF,iBAAA,KAAA;;;;;;;EAEJ,CAAA;kBAnE4BF,WAAAA;;;;",
|
|
5
|
+
"names": ["FSExtra", "resolve", "importMetaResolve", "rm", "mergeConfig", "build", "viteBuild", "getBaseViteConfig", "getOptimizeDeps", "getOptionsFilled", "existsSync", "Error", "stackTraceLimit", "Infinity", "resolveFile", "path", "url", "replace", "require", "optionsIn", "buildOptions", "options", "optimizeDeps", "webBuildConfig", "output", "recursive", "force", "process", "env", "NODE_ENV", "mode", "root", "clearScreen", "webConfig", "step", "ssrManifest", "outDir", "console", "info", "ssr", "noExternal", "include", "cssCodeSplit", "rollupOptions", "external", "afterBuild"]
|
|
6
6
|
}
|