@teyik0/furin 0.9.0-alpha.2 → 0.9.0-alpha.4
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/build/index.js +46 -58
- package/dist/cli/index.js +46 -58
- package/dist/client/chunks/{client-d9v49jwz.js → client-p0jqzfvc.js} +65 -2
- package/dist/client/dev-error-overlay.ts +18 -0
- package/dist/client/link.js +1 -1
- package/dist/client/query.d.ts +13 -0
- package/dist/client.d.ts +1 -1
- package/dist/client.js +3 -1
- package/dist/furin.js +9 -16
- package/dist/plugin/client-plugin.d.ts +1 -1
- package/dist/plugin/index.js +5 -4
- package/dist/server/dev/graph.d.ts +0 -1
- package/dist/server/internal.js +4 -7
- package/dist/server/router/hmr.d.ts +0 -1
- package/dist/server/router/source-version.d.ts +0 -1
- package/dist/server/static-export.js +4 -7
- package/dist/server/sync/index.js +1 -1
- package/dist/sync-client.js +1 -1
- package/package.json +2 -2
- package/src/build/hydrate.ts +2 -0
- package/src/client/dev-error-overlay.ts +18 -0
- package/src/client/query-store.ts +2 -1
- package/src/client/query.tsx +87 -0
- package/src/client.ts +1 -1
- package/src/plugin/client-plugin.ts +13 -8
- package/src/plugin/route-registry.ts +4 -21
- package/src/server/dev/graph.ts +2 -7
- package/src/server/dev/runtime.ts +1 -2
- package/src/server/dev-page-plugin.ts +5 -2
- package/src/server/router/hmr.ts +1 -5
- package/src/server/router/source-version.ts +3 -6
package/dist/build/index.js
CHANGED
|
@@ -1741,7 +1741,7 @@ import { writeFileSync as writeFileSync2 } from "fs";
|
|
|
1741
1741
|
import { join as join6 } from "path";
|
|
1742
1742
|
|
|
1743
1743
|
// src/plugin/route-registry.ts
|
|
1744
|
-
import {
|
|
1744
|
+
import { join as join5, resolve as resolve2 } from "path";
|
|
1745
1745
|
|
|
1746
1746
|
// src/plugin/route-modules.ts
|
|
1747
1747
|
import { existsSync as existsSync5, readFileSync, realpathSync, statSync } from "fs";
|
|
@@ -2231,7 +2231,6 @@ var ROUTES_REGISTRY_SPECIFIER = "furin/routes?registry";
|
|
|
2231
2231
|
var COMPOSABLE_ROUTES_REGISTRY_SPECIFIER = "furin/routes?registry=composable";
|
|
2232
2232
|
var ROUTES_REGISTRY_FILTER = /^furin\/routes\?registry(?:=composable)?$/;
|
|
2233
2233
|
var ROUTE_FILE_FILTER = /^furin-route-file:.+$/;
|
|
2234
|
-
var ROUTE_FILES_NAMESPACE = "furin-route-files";
|
|
2235
2234
|
var ROUTES_REGISTRY_FILE_FILTER = /[\\/]\.furin-routes-registry(?:-composable)?\.ts\?furin-virtual$/;
|
|
2236
2235
|
var CLIENT_ROUTES_NAMESPACE = "furin-routes-client";
|
|
2237
2236
|
var CLIENT_ROUTES_FILTER = /^(?:@teyik0\/furin|furin)\/routes$/;
|
|
@@ -2363,7 +2362,6 @@ function serverProxySource(instance, includeRootCatchAll) {
|
|
|
2363
2362
|
}
|
|
2364
2363
|
function createRoutesPlugin(options) {
|
|
2365
2364
|
const routeFilesBySpecifier = new Map;
|
|
2366
|
-
const routeFilesByResolvedPath = new Map;
|
|
2367
2365
|
const registryVirtualPath = join5(resolve2(primaryInstance(options.instances).pagesDir), ".furin-routes-registry.ts?furin-virtual");
|
|
2368
2366
|
const composableRegistryVirtualPath = join5(resolve2(primaryInstance(options.instances).pagesDir), ".furin-routes-registry-composable.ts?furin-virtual");
|
|
2369
2367
|
const instancesBySpecifier = new Map(options.instances.flatMap((instance) => [
|
|
@@ -2415,20 +2413,7 @@ function createRoutesPlugin(options) {
|
|
|
2415
2413
|
if (!routeFile) {
|
|
2416
2414
|
throw new Error(`[furin] Unknown route module: ${path}`);
|
|
2417
2415
|
}
|
|
2418
|
-
|
|
2419
|
-
routeFilesByResolvedPath.set(resolvedPath, routeFile);
|
|
2420
|
-
return { namespace: ROUTE_FILES_NAMESPACE, path: resolvedPath };
|
|
2421
|
-
});
|
|
2422
|
-
build.onLoad({ filter: VIRTUAL_ROUTES_FILTER, namespace: ROUTE_FILES_NAMESPACE }, async ({ path }) => {
|
|
2423
|
-
const routeFile = routeFilesByResolvedPath.get(path);
|
|
2424
|
-
if (!routeFile) {
|
|
2425
|
-
throw new Error(`[furin] Unknown route module: ${path}`);
|
|
2426
|
-
}
|
|
2427
|
-
return {
|
|
2428
|
-
contents: await Bun.file(routeFile.sourcePath).text(),
|
|
2429
|
-
loader: detectLoaderFromPath(routeFile.sourcePath),
|
|
2430
|
-
resolveDir: dirname5(routeFile.sourcePath)
|
|
2431
|
-
};
|
|
2416
|
+
return { path: routeFile.sourcePath };
|
|
2432
2417
|
});
|
|
2433
2418
|
for (const { instance, namespace, includeRootCatchAll } of instancesBySpecifier.values()) {
|
|
2434
2419
|
build.onLoad({ filter: VIRTUAL_ROUTES_FILTER, namespace }, () => ({
|
|
@@ -5335,7 +5320,7 @@ function pruneOrphanedCode(module, forced, retained) {
|
|
|
5335
5320
|
|
|
5336
5321
|
// src/plugin/transform-client-module.ts
|
|
5337
5322
|
import { realpathSync as realpathSync2 } from "fs";
|
|
5338
|
-
import { dirname as
|
|
5323
|
+
import { dirname as dirname5 } from "path";
|
|
5339
5324
|
var FURIN_CLIENT_MODULES = new Set(["@teyik0/furin/client", "furin/client"]);
|
|
5340
5325
|
var SERVER_LOAD = '() => Promise.reject(new Error("[furin] clientModule() can only be loaded in the browser."))';
|
|
5341
5326
|
function clientModuleKey(modulePath) {
|
|
@@ -5390,7 +5375,7 @@ function rewriteClientModules(module, environment) {
|
|
|
5390
5375
|
}
|
|
5391
5376
|
let key;
|
|
5392
5377
|
try {
|
|
5393
|
-
key = JSON.stringify(clientModuleKey(Bun.resolveSync(specifier,
|
|
5378
|
+
key = JSON.stringify(clientModuleKey(Bun.resolveSync(specifier, dirname5(filename))));
|
|
5394
5379
|
} catch (error) {
|
|
5395
5380
|
throw new Error(`[furin] Cannot resolve clientModule import ${JSON.stringify(specifier)} in ${filename}`, { cause: error });
|
|
5396
5381
|
}
|
|
@@ -5857,7 +5842,7 @@ function assertInstalledRscVersions() {
|
|
|
5857
5842
|
}
|
|
5858
5843
|
|
|
5859
5844
|
// src/rsc/build/client-references.ts
|
|
5860
|
-
import { dirname as
|
|
5845
|
+
import { dirname as dirname7 } from "path";
|
|
5861
5846
|
|
|
5862
5847
|
// ../../node_modules/.bun/cjs-module-lexer@2.3.0/node_modules/cjs-module-lexer/dist/lexer.mjs
|
|
5863
5848
|
var A;
|
|
@@ -6042,9 +6027,9 @@ function initSync() {
|
|
|
6042
6027
|
import { readFileSync as readFileSync2 } from "fs";
|
|
6043
6028
|
|
|
6044
6029
|
// src/rsc/build/paths.ts
|
|
6045
|
-
import { dirname as
|
|
6030
|
+
import { dirname as dirname6, join as join7 } from "path";
|
|
6046
6031
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
6047
|
-
var SOURCE_DIR =
|
|
6032
|
+
var SOURCE_DIR = dirname6(fileURLToPath3(import.meta.resolve("@teyik0/furin/rsc")));
|
|
6048
6033
|
var CLIENT_REFERENCE_RUNTIME_PATH = join7(SOURCE_DIR, "rsc/client-references.ts");
|
|
6049
6034
|
var BUNDLED_CLIENT_CODEC_PATH = join7(SOURCE_DIR, "rsc/bundled-client-codec.ts");
|
|
6050
6035
|
|
|
@@ -6167,7 +6152,7 @@ function clientReferencesPlugin(references) {
|
|
|
6167
6152
|
contents: isCommonJsModule(source, sourcePath) ? source : `${source}
|
|
6168
6153
|
${clientRegistration(sourcePath, path, prefix, references)}`,
|
|
6169
6154
|
loader: detectLoaderFromPath(sourcePath),
|
|
6170
|
-
resolveDir:
|
|
6155
|
+
resolveDir: dirname7(sourcePath)
|
|
6171
6156
|
};
|
|
6172
6157
|
});
|
|
6173
6158
|
build.onLoad({ filter: SCRIPTS }, async ({ path }) => {
|
|
@@ -6184,7 +6169,7 @@ registerClientModule(${JSON.stringify(clientModuleId(path))}, implementation);`
|
|
|
6184
6169
|
export * from ${JSON.stringify(path + IMPLEMENTATION)};
|
|
6185
6170
|
${names.length > 0 ? `export { ${names.map((name) => JSON.stringify(name)).join(", ")} } from ${JSON.stringify(path + IMPLEMENTATION)};` : ""}`,
|
|
6186
6171
|
loader: "js",
|
|
6187
|
-
resolveDir:
|
|
6172
|
+
resolveDir: dirname7(path)
|
|
6188
6173
|
};
|
|
6189
6174
|
});
|
|
6190
6175
|
}
|
|
@@ -6223,7 +6208,7 @@ async function exportedNames(source, path, visited) {
|
|
|
6223
6208
|
}
|
|
6224
6209
|
}
|
|
6225
6210
|
for (const specifier of reexports) {
|
|
6226
|
-
const dependency = Bun.resolveSync(specifier,
|
|
6211
|
+
const dependency = Bun.resolveSync(specifier, dirname7(path));
|
|
6227
6212
|
const exported = await exportedNames(await Bun.file(dependency).text(), dependency, visited);
|
|
6228
6213
|
for (const name of exported) {
|
|
6229
6214
|
if (name !== "default") {
|
|
@@ -6439,20 +6424,20 @@ function exportStaticFromBundle(path, cwd, options) {
|
|
|
6439
6424
|
// src/adapter/runtime-build.ts
|
|
6440
6425
|
import { existsSync as existsSync10, realpathSync as realpathSync4, writeFileSync as writeFileSync6 } from "fs";
|
|
6441
6426
|
import { createRequire } from "module";
|
|
6442
|
-
import { dirname as
|
|
6427
|
+
import { dirname as dirname11, isAbsolute as isAbsolute5, join as join12, relative as relative5, resolve as resolve7 } from "path";
|
|
6443
6428
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
6444
6429
|
|
|
6445
6430
|
// src/build/client.ts
|
|
6446
6431
|
import { existsSync as existsSync9, mkdirSync as mkdirSync3 } from "fs";
|
|
6447
|
-
import { basename as basename4, dirname as
|
|
6432
|
+
import { basename as basename4, dirname as dirname10, join as join11, sep as sep2 } from "path";
|
|
6448
6433
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
6449
6434
|
|
|
6450
6435
|
// src/plugin/client-plugin.ts
|
|
6451
|
-
import { dirname as
|
|
6436
|
+
import { dirname as dirname9, isAbsolute as isAbsolute4, resolve as resolve4 } from "path";
|
|
6452
6437
|
|
|
6453
6438
|
// src/plugin/hmr-dependencies.ts
|
|
6454
6439
|
import { readFileSync as readFileSync4 } from "fs";
|
|
6455
|
-
import { dirname as
|
|
6440
|
+
import { dirname as dirname8, isAbsolute as isAbsolute3, resolve as resolve3 } from "path";
|
|
6456
6441
|
function hmrDependencySignature(imports, filename) {
|
|
6457
6442
|
const routePath = resolve3(filename);
|
|
6458
6443
|
const visited = new Set;
|
|
@@ -6461,7 +6446,7 @@ function hmrDependencySignature(imports, filename) {
|
|
|
6461
6446
|
if (specifier === "furin" || specifier.startsWith("furin/") || specifier === "@teyik0/furin" || specifier.startsWith("@teyik0/furin/")) {
|
|
6462
6447
|
return true;
|
|
6463
6448
|
}
|
|
6464
|
-
const path = Bun.resolveSync(specifier,
|
|
6449
|
+
const path = Bun.resolveSync(specifier, dirname8(importer));
|
|
6465
6450
|
if (path === routePath) {
|
|
6466
6451
|
return false;
|
|
6467
6452
|
}
|
|
@@ -7325,11 +7310,12 @@ function stripServerCode(path, source) {
|
|
|
7325
7310
|
var ELYSIA_FILTER = /^elysia$/;
|
|
7326
7311
|
var BUN_BUILTIN_FILTER = /^bun:/;
|
|
7327
7312
|
var ANY_FILTER = /.*/;
|
|
7328
|
-
var
|
|
7313
|
+
var elysiaStub = (typeModule) => `export * as t from ${JSON.stringify(typeModule)};
|
|
7329
7314
|
export class NotFoundError extends Error { constructor(m) { super(m); this.name = "NotFoundError"; } }
|
|
7330
7315
|
export class ValidationError extends Error { constructor(m) { super(m); this.name = "ValidationError"; } }
|
|
7331
7316
|
export default {};
|
|
7332
7317
|
`;
|
|
7318
|
+
var ELYSIA_STUB_PREFIX = "elysia-stub:";
|
|
7333
7319
|
function trackHydrationTopology(filePath, source, topologyPaths) {
|
|
7334
7320
|
const normalizedPath = filePath.replaceAll("\\", "/");
|
|
7335
7321
|
if (!(normalizedPath.includes("/.furin/") && normalizedPath.endsWith("/_hydrate.tsx"))) {
|
|
@@ -7338,7 +7324,7 @@ function trackHydrationTopology(filePath, source, topologyPaths) {
|
|
|
7338
7324
|
const transpiler = new Bun.Transpiler({ loader: "tsx" });
|
|
7339
7325
|
for (const imported of transpiler.scanImports(source)) {
|
|
7340
7326
|
if (isAbsolute4(imported.path) || imported.path.startsWith(".")) {
|
|
7341
|
-
topologyPaths.add(resolve4(
|
|
7327
|
+
topologyPaths.add(resolve4(dirname9(filePath), imported.path.split("?")[0]));
|
|
7342
7328
|
}
|
|
7343
7329
|
}
|
|
7344
7330
|
}
|
|
@@ -7367,16 +7353,16 @@ function createClientStripPlugin({ mode }) {
|
|
|
7367
7353
|
environmentGuardPlugin("client").setup(build);
|
|
7368
7354
|
const topologyPaths = new Set;
|
|
7369
7355
|
const loadedSources = new Map;
|
|
7370
|
-
build.onResolve({ filter: ELYSIA_FILTER }, () => ({
|
|
7356
|
+
build.onResolve({ filter: ELYSIA_FILTER }, (args) => ({
|
|
7371
7357
|
namespace: "furin-stubs",
|
|
7372
|
-
path: "elysia
|
|
7358
|
+
path: ELYSIA_STUB_PREFIX + Bun.resolveSync("elysia/type", args.resolveDir)
|
|
7373
7359
|
}));
|
|
7374
7360
|
build.onResolve({ filter: BUN_BUILTIN_FILTER }, () => ({
|
|
7375
7361
|
namespace: "furin-stubs",
|
|
7376
7362
|
path: "bun-builtin-stub"
|
|
7377
7363
|
}));
|
|
7378
7364
|
build.onLoad({ filter: ANY_FILTER, namespace: "furin-stubs" }, (args) => ({
|
|
7379
|
-
contents: args.path
|
|
7365
|
+
contents: args.path.startsWith(ELYSIA_STUB_PREFIX) ? elysiaStub(args.path.slice(ELYSIA_STUB_PREFIX.length)) : "",
|
|
7380
7366
|
loader: "js"
|
|
7381
7367
|
}));
|
|
7382
7368
|
build.onLoad({ filter: SCRIPT_FILE_FILTER }, async (args) => {
|
|
@@ -8030,6 +8016,7 @@ if (__deferred && __deferred._chunks) {
|
|
|
8030
8016
|
// with the server (stale deploy) or the server returned something we
|
|
8031
8017
|
// don't know how to hydrate. Bail loudly; the page stays static.
|
|
8032
8018
|
log.error({ action: "hydrate_no_match", pathname });
|
|
8019
|
+
if (import.meta.hot) throw new Error(\`[furin] No client route matches \${pathname}; the page stays static.\`);
|
|
8033
8020
|
return;
|
|
8034
8021
|
}
|
|
8035
8022
|
app = createElement(DocumentProvider, { value: documentState }, app);
|
|
@@ -8096,6 +8083,7 @@ if (__deferred && __deferred._chunks) {
|
|
|
8096
8083
|
log.info({ action: "hydrate_complete", pathname });
|
|
8097
8084
|
})().catch((err: unknown) => {
|
|
8098
8085
|
log.error({ action: "hydrate_failed", pathname, error: String(err) });
|
|
8086
|
+
if (import.meta.hot) console.error("[furin] Hydration failed:", err);
|
|
8099
8087
|
window.dispatchEvent(
|
|
8100
8088
|
new CustomEvent("furin:client-error", { detail: { error: err, phase: "hydrate" } })
|
|
8101
8089
|
);
|
|
@@ -8160,7 +8148,7 @@ function writeClientPreloadManifest(metafile, outputPaths, entryChunkPath, route
|
|
|
8160
8148
|
}
|
|
8161
8149
|
|
|
8162
8150
|
// src/build/client.ts
|
|
8163
|
-
var CLIENT_DIST_DIR = `${join11(
|
|
8151
|
+
var CLIENT_DIST_DIR = `${join11(dirname10(dirname10(fileURLToPath6(import.meta.resolve("@teyik0/furin")))), "dist")}${sep2}`;
|
|
8164
8152
|
async function buildClient(routes, {
|
|
8165
8153
|
outDir,
|
|
8166
8154
|
rootLayout,
|
|
@@ -8263,7 +8251,7 @@ async function buildClient(routes, {
|
|
|
8263
8251
|
}
|
|
8264
8252
|
|
|
8265
8253
|
// src/adapter/runtime-build.ts
|
|
8266
|
-
var _pkgRoot2 =
|
|
8254
|
+
var _pkgRoot2 = dirname11(dirname11(fileURLToPath7(import.meta.resolve("@teyik0/furin"))));
|
|
8267
8255
|
var _pkgSrcDir2 = existsSync10(join12(_pkgRoot2, "src", "furin.ts")) ? join12(_pkgRoot2, "src") : join12(_pkgRoot2, "dist");
|
|
8268
8256
|
var _ext2 = ".ts";
|
|
8269
8257
|
function frameworkSourceModule(path) {
|
|
@@ -8325,7 +8313,7 @@ function nearestFingerprintFile(directory, names, boundary) {
|
|
|
8325
8313
|
return path;
|
|
8326
8314
|
}
|
|
8327
8315
|
}
|
|
8328
|
-
const parent =
|
|
8316
|
+
const parent = dirname11(current);
|
|
8329
8317
|
current = parent === current || current === boundary ? undefined : parent;
|
|
8330
8318
|
}
|
|
8331
8319
|
return;
|
|
@@ -8380,7 +8368,7 @@ async function createBuildFingerprint(entryChunk, cssChunks, routes, root, serve
|
|
|
8380
8368
|
}
|
|
8381
8369
|
const relativePath = toPosixPath(relative5(rootBoundary, path));
|
|
8382
8370
|
const manifestBoundary = relativePath === ".." || relativePath.startsWith("../") || isAbsolute5(relativePath) ? undefined : rootBoundary;
|
|
8383
|
-
const manifest = nearestFingerprintFile(
|
|
8371
|
+
const manifest = nearestFingerprintFile(dirname11(path), ["package.json"], manifestBoundary);
|
|
8384
8372
|
if (manifest) {
|
|
8385
8373
|
fingerprintPaths.add(manifest);
|
|
8386
8374
|
await visit(manifest);
|
|
@@ -8389,7 +8377,7 @@ async function createBuildFingerprint(entryChunk, cssChunks, routes, root, serve
|
|
|
8389
8377
|
await Promise.all(transpiler.scanImports(content).flatMap(({ path: specifier, kind }) => {
|
|
8390
8378
|
let dependency;
|
|
8391
8379
|
try {
|
|
8392
|
-
dependency = kind === "require-call" || kind === "require-resolve" ? createRequire(path).resolve(specifier) : Bun.resolveSync(specifier,
|
|
8380
|
+
dependency = kind === "require-call" || kind === "require-resolve" ? createRequire(path).resolve(specifier) : Bun.resolveSync(specifier, dirname11(path));
|
|
8393
8381
|
} catch {
|
|
8394
8382
|
return [];
|
|
8395
8383
|
}
|
|
@@ -8473,7 +8461,7 @@ function pprRuntimePlugin(apps) {
|
|
|
8473
8461
|
return;
|
|
8474
8462
|
}
|
|
8475
8463
|
build.onResolve({ filter: PPR_ROUTE_IMPORT_RE }, ({ path, importer }) => {
|
|
8476
|
-
const absolute = resolve7(
|
|
8464
|
+
const absolute = resolve7(dirname11(importer.split("?")[0]), path);
|
|
8477
8465
|
if (absolute !== pprPath && `${absolute}.ts` !== pprPath) {
|
|
8478
8466
|
return;
|
|
8479
8467
|
}
|
|
@@ -8499,7 +8487,7 @@ function mixedRuntimePlugin(apps) {
|
|
|
8499
8487
|
return;
|
|
8500
8488
|
}
|
|
8501
8489
|
build.onResolve({ filter: MIXED_CACHE_IMPORT_RE }, ({ path, importer }) => {
|
|
8502
|
-
const absolute = resolve7(
|
|
8490
|
+
const absolute = resolve7(dirname11(importer.split("?")[0]), path);
|
|
8503
8491
|
if (absolute !== mixedPath && `${absolute}.ts` !== mixedPath) {
|
|
8504
8492
|
return;
|
|
8505
8493
|
}
|
|
@@ -8529,7 +8517,7 @@ async function buildRuntimeApp(app, projectRoot, targetDir, serverEntry, options
|
|
|
8529
8517
|
basePath: prefix,
|
|
8530
8518
|
clientDirName,
|
|
8531
8519
|
clientLogging: options.clientLogging ?? false,
|
|
8532
|
-
metafilePath: options.analyze ? join12(
|
|
8520
|
+
metafilePath: options.analyze ? join12(dirname11(targetDir), "analysis", `${targetName}-${clientDirName}.json`) : undefined,
|
|
8533
8521
|
optimizeImports: options.optimizeImports,
|
|
8534
8522
|
outDir: targetDir,
|
|
8535
8523
|
pages: { pagesDir: app.pagesDir, style: app.style },
|
|
@@ -8572,16 +8560,16 @@ ${entryChunk}`, cssChunks, routes, root, serverEntry, modulePaths, projectRoot);
|
|
|
8572
8560
|
}
|
|
8573
8561
|
|
|
8574
8562
|
// src/adapter/server-bundle.ts
|
|
8575
|
-
import { dirname as
|
|
8563
|
+
import { dirname as dirname14, relative as relative8 } from "path";
|
|
8576
8564
|
|
|
8577
8565
|
// src/build/elysia-aot.ts
|
|
8578
8566
|
import { fork } from "child_process";
|
|
8579
8567
|
import { existsSync as existsSync11, realpathSync as realpathSync5 } from "fs";
|
|
8580
|
-
import { dirname as
|
|
8568
|
+
import { dirname as dirname12, join as join13, relative as relative6, resolve as resolve8 } from "path";
|
|
8581
8569
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
8582
8570
|
var AOT_NAMESPACE = "furin-elysia-aot";
|
|
8583
|
-
var ELYSIA_RESOLVE_DIR =
|
|
8584
|
-
var AOT_PROCESS_PATH = join13(
|
|
8571
|
+
var ELYSIA_RESOLVE_DIR = dirname12(Bun.resolveSync("elysia", import.meta.dir));
|
|
8572
|
+
var AOT_PROCESS_PATH = join13(dirname12(dirname12(fileURLToPath8(import.meta.resolve("@teyik0/furin")))), "src/build/elysia-aot-worker.ts");
|
|
8585
8573
|
var SOURCE_FILTER = /\.[cm]?[jt]sx?$/;
|
|
8586
8574
|
var ELYSIA_IMPORT_FILTER = /^elysia(?:\/(?!compiled$|type$).*)?$/;
|
|
8587
8575
|
var ELYSIA_VIRTUAL_IMPORT_FILTER = /^elysia\/(?:compiled|type)$/;
|
|
@@ -8775,7 +8763,7 @@ function elysiaAot(entry, expected) {
|
|
|
8775
8763
|
}
|
|
8776
8764
|
|
|
8777
8765
|
// src/build/production-instrumentation.ts
|
|
8778
|
-
import { dirname as
|
|
8766
|
+
import { dirname as dirname13, relative as relative7, resolve as resolve9 } from "path";
|
|
8779
8767
|
var INSTRUMENTATION_IMPORT = /(?:^|[/\\])devtools[/\\]instrumentation(?:\.ts|\.js)?$/;
|
|
8780
8768
|
var DEV_PAGE_PLUGIN_IMPORT = /(?:^|[/\\])server[/\\]dev-page-plugin(?:\.ts|\.js)?$/;
|
|
8781
8769
|
var DEV_RUNTIME_IMPORT = /(?:^|[/\\])server[/\\]dev[/\\](?:browser-events|diagnostics|graph|plugin|runtime)(?:\.ts|\.js)?$/;
|
|
@@ -8802,7 +8790,7 @@ function productionInstrumentationPlugin() {
|
|
|
8802
8790
|
name: "furin-production-instrumentation",
|
|
8803
8791
|
setup(build) {
|
|
8804
8792
|
build.onResolve({ filter: PRODUCTION_BOUNDARY_IMPORT }, (args) => {
|
|
8805
|
-
const importPath = resolve9(
|
|
8793
|
+
const importPath = resolve9(dirname13(args.importer), args.path);
|
|
8806
8794
|
if (!isFurinRuntimePath(importPath)) {
|
|
8807
8795
|
return;
|
|
8808
8796
|
}
|
|
@@ -8838,7 +8826,7 @@ var PRERENDER_SNAPSHOT_RE = /^\.\/furin-prerender\.json$/;
|
|
|
8838
8826
|
var ELYSIA_STATIC_IMPORT_RE = /^@elysia\/static$/;
|
|
8839
8827
|
var MATCH_ALL_RE = /.*/;
|
|
8840
8828
|
var STATIC_STUB_NAMESPACE = "furin-platform-assets-stub";
|
|
8841
|
-
var FURIN_RUNTIME_ROOT2 =
|
|
8829
|
+
var FURIN_RUNTIME_ROOT2 = dirname14(import.meta.dir);
|
|
8842
8830
|
function isFurinRuntimeImporter(importer) {
|
|
8843
8831
|
if (importer === "") {
|
|
8844
8832
|
return false;
|
|
@@ -9271,7 +9259,7 @@ export declare const prefix: string;
|
|
|
9271
9259
|
|
|
9272
9260
|
// src/adapter/static.ts
|
|
9273
9261
|
import { cpSync as cpSync2, existsSync as existsSync15, rmSync as rmSync6, writeFileSync as writeFileSync9 } from "fs";
|
|
9274
|
-
import { dirname as
|
|
9262
|
+
import { dirname as dirname15, isAbsolute as isAbsolute6, join as join17, parse as parse3, relative as relative12, resolve as resolve11, sep as sep3, win32 } from "path";
|
|
9275
9263
|
var TRAILING_SLASHES_RE = /\/+$/;
|
|
9276
9264
|
var STATIC_RENDER_ORIGIN = "http://localhost";
|
|
9277
9265
|
function pathToOutputFile(urlPath, outDir, fileName) {
|
|
@@ -9396,7 +9384,7 @@ async function collectStaticOutputs(exported, outDir, basePath, onSSR, skippedRo
|
|
|
9396
9384
|
return outputs;
|
|
9397
9385
|
}
|
|
9398
9386
|
function writeStaticOutput(output) {
|
|
9399
|
-
ensureDir(
|
|
9387
|
+
ensureDir(dirname15(output.htmlFile));
|
|
9400
9388
|
writeFileSync9(output.htmlFile, output.html);
|
|
9401
9389
|
if (output.data !== null) {
|
|
9402
9390
|
writeFileSync9(output.dataFile, output.data);
|
|
@@ -9595,7 +9583,7 @@ import {
|
|
|
9595
9583
|
symlinkSync,
|
|
9596
9584
|
writeFileSync as writeFileSync10
|
|
9597
9585
|
} from "fs";
|
|
9598
|
-
import { basename as basename6, dirname as
|
|
9586
|
+
import { basename as basename6, dirname as dirname16, join as join18, relative as relative13 } from "path";
|
|
9599
9587
|
import { fileURLToPath as fileURLToPath9, pathToFileURL as pathToFileURL3 } from "url";
|
|
9600
9588
|
|
|
9601
9589
|
// src/adapter/vercel/data.ts
|
|
@@ -9640,7 +9628,7 @@ function assertRegions(regions) {
|
|
|
9640
9628
|
}
|
|
9641
9629
|
}
|
|
9642
9630
|
function frameworkVersion() {
|
|
9643
|
-
const packageRoot =
|
|
9631
|
+
const packageRoot = dirname16(dirname16(fileURLToPath9(import.meta.resolve("@teyik0/furin"))));
|
|
9644
9632
|
const packageJson = JSON.parse(readFileSync8(join18(packageRoot, "package.json"), "utf8"));
|
|
9645
9633
|
return packageJson.version;
|
|
9646
9634
|
}
|
|
@@ -9781,8 +9769,8 @@ async function addPrerenderFallback(job, response, functionsDir) {
|
|
|
9781
9769
|
const { spec } = job;
|
|
9782
9770
|
const fallback = `${basename6(spec.functionName)}.prerender-fallback.html`;
|
|
9783
9771
|
const location = response.headers.get("location") ?? undefined;
|
|
9784
|
-
const fallbackPath = join18(
|
|
9785
|
-
ensureDir(
|
|
9772
|
+
const fallbackPath = join18(dirname16(join18(functionsDir, spec.functionName)), fallback);
|
|
9773
|
+
ensureDir(dirname16(fallbackPath));
|
|
9786
9774
|
writeFileSync10(fallbackPath, await response.text());
|
|
9787
9775
|
spec.config.fallback = fallback;
|
|
9788
9776
|
spec.config.initialHeaders = {
|
|
@@ -9856,8 +9844,8 @@ async function buildBootstrap(serverFunctionDir) {
|
|
|
9856
9844
|
}
|
|
9857
9845
|
function createFunctionAlias(functionsDir, serverFunctionDir, functionName) {
|
|
9858
9846
|
const aliasPath = join18(functionsDir, `${functionName}.func`);
|
|
9859
|
-
ensureDir(
|
|
9860
|
-
const target = relative13(
|
|
9847
|
+
ensureDir(dirname16(aliasPath));
|
|
9848
|
+
const target = relative13(dirname16(aliasPath), serverFunctionDir);
|
|
9861
9849
|
symlinkSync(target, aliasPath, process.platform === "win32" ? "junction" : "dir");
|
|
9862
9850
|
}
|
|
9863
9851
|
function copyStaticAssets(output, staticDir) {
|