@timber-js/app 0.2.0-alpha.59 → 0.2.0-alpha.60
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/index.js +30 -1
- package/dist/index.js.map +1 -1
- package/dist/plugins/shims.d.ts +5 -7
- package/dist/plugins/shims.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/plugins/shims.ts +69 -11
package/dist/index.js
CHANGED
|
@@ -12500,7 +12500,8 @@ function generateManifestModule(tree) {
|
|
|
12500
12500
|
//#endregion
|
|
12501
12501
|
//#region src/plugins/shims.ts
|
|
12502
12502
|
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
12503
|
-
var
|
|
12503
|
+
var PKG_ROOT = __dirname.endsWith("plugins") ? resolve(__dirname, "..", "..") : resolve(__dirname, "..");
|
|
12504
|
+
var SHIMS_DIR = resolve(PKG_ROOT, "src", "shims");
|
|
12504
12505
|
/**
|
|
12505
12506
|
* Virtual module IDs for server-only and client-only poison pills.
|
|
12506
12507
|
*
|
|
@@ -12511,6 +12512,23 @@ var SHIMS_DIR = resolve(__dirname.endsWith("plugins") ? resolve(__dirname, "..",
|
|
|
12511
12512
|
var SERVER_ONLY_VIRTUAL = "\0timber:server-only";
|
|
12512
12513
|
var CLIENT_ONLY_VIRTUAL = "\0timber:client-only";
|
|
12513
12514
|
/**
|
|
12515
|
+
* Map from @timber-js/app/<subpath> to relative src/ file paths.
|
|
12516
|
+
*
|
|
12517
|
+
* Used by the catch-all resolveId rule to remap subpath imports to src/
|
|
12518
|
+
* in server environments. When adding a new subpath export to package.json,
|
|
12519
|
+
* add it here too. See TIM-568.
|
|
12520
|
+
*/
|
|
12521
|
+
var SUBPATH_SRC_MAP = {
|
|
12522
|
+
"cache": "cache/index.ts",
|
|
12523
|
+
"content": "content/index.ts",
|
|
12524
|
+
"cookies": "cookies/index.ts",
|
|
12525
|
+
"params": "params/index.ts",
|
|
12526
|
+
"search-params": "search-params/index.ts",
|
|
12527
|
+
"routing": "routing/index.ts",
|
|
12528
|
+
"adapters/cloudflare": "adapters/cloudflare.ts",
|
|
12529
|
+
"adapters/nitro": "adapters/nitro.ts"
|
|
12530
|
+
};
|
|
12531
|
+
/**
|
|
12514
12532
|
* Map from next/* import specifiers to shim file paths.
|
|
12515
12533
|
*
|
|
12516
12534
|
* The shim map is a separate data structure (not embedded in the plugin)
|
|
@@ -12552,6 +12570,17 @@ function timberShims(_ctx) {
|
|
|
12552
12570
|
}
|
|
12553
12571
|
if (cleanId === "@timber-js/app/server") {
|
|
12554
12572
|
if (this.environment?.name === "client") return "\0timber:server-empty";
|
|
12573
|
+
return resolve(PKG_ROOT, "src", "server", "index.ts");
|
|
12574
|
+
}
|
|
12575
|
+
if (cleanId === "@timber-js/app/client") {
|
|
12576
|
+
if (this.environment?.name === "ssr") return resolve(PKG_ROOT, "src", "client", "index.ts");
|
|
12577
|
+
return null;
|
|
12578
|
+
}
|
|
12579
|
+
if (cleanId.startsWith("@timber-js/app/") && cleanId !== "@timber-js/app/package.json") {
|
|
12580
|
+
if (this.environment?.name !== "client") {
|
|
12581
|
+
const srcPath = SUBPATH_SRC_MAP[cleanId.slice(15)];
|
|
12582
|
+
if (srcPath) return resolve(PKG_ROOT, "src", srcPath);
|
|
12583
|
+
}
|
|
12555
12584
|
}
|
|
12556
12585
|
return null;
|
|
12557
12586
|
},
|