@wix/astro 1.0.18 → 1.0.19
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/build/index.js +39 -27
- package/build/index.js.map +1 -1
- package/package.json +2 -2
- package/src/directories.ts +1 -1
- package/src/index.ts +1 -1
- package/src/plugins/setupSsrContext.ts +33 -17
package/build/index.js
CHANGED
|
@@ -12286,7 +12286,7 @@ var require_lib = __commonJS({
|
|
|
12286
12286
|
init_esm_shims();
|
|
12287
12287
|
var import_chokidar = __toESM(require_chokidar(), 1);
|
|
12288
12288
|
import { join as join7 } from "node:path";
|
|
12289
|
-
import { fileURLToPath as
|
|
12289
|
+
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
12290
12290
|
import { envField, passthroughImageService } from "astro/config";
|
|
12291
12291
|
|
|
12292
12292
|
// ../../node_modules/outdent/lib-module/index.js
|
|
@@ -12471,29 +12471,41 @@ function patchGlobal() {
|
|
|
12471
12471
|
// src/plugins/setupSsrContext.ts
|
|
12472
12472
|
init_esm_shims();
|
|
12473
12473
|
import { extname, join as join2 } from "node:path";
|
|
12474
|
-
|
|
12475
|
-
|
|
12476
|
-
|
|
12477
|
-
|
|
12478
|
-
|
|
12479
|
-
|
|
12480
|
-
|
|
12481
|
-
|
|
12482
|
-
|
|
12474
|
+
import { fileURLToPath } from "node:url";
|
|
12475
|
+
var nonElevatedSetupUrl = new URL(
|
|
12476
|
+
"../build-runtime/context/non-elevated.js",
|
|
12477
|
+
import.meta.url
|
|
12478
|
+
);
|
|
12479
|
+
var elevatedSetupUrl = new URL(
|
|
12480
|
+
"../build-runtime/context/elevated.js",
|
|
12481
|
+
import.meta.url
|
|
12482
|
+
);
|
|
12483
|
+
var whitelistedFilePaths = [
|
|
12484
|
+
fileURLToPath(
|
|
12485
|
+
new URL("../build-runtime/routes/auth/login.js", import.meta.url)
|
|
12486
|
+
),
|
|
12487
|
+
fileURLToPath(
|
|
12488
|
+
new URL("../build-runtime/routes/auth/callback.js", import.meta.url)
|
|
12489
|
+
),
|
|
12490
|
+
fileURLToPath(
|
|
12491
|
+
new URL("../build-runtime/routes/auth/logout.js", import.meta.url)
|
|
12492
|
+
),
|
|
12493
|
+
fileURLToPath(
|
|
12494
|
+
new URL("../build-runtime/routes/auth/logout-callback.js", import.meta.url)
|
|
12495
|
+
)
|
|
12496
|
+
];
|
|
12497
|
+
function setupSsrContext(rootDir) {
|
|
12498
|
+
const srcDir = join2(rootDir, SRC_DIR);
|
|
12483
12499
|
return {
|
|
12484
12500
|
applyToEnvironment(environment) {
|
|
12485
12501
|
return environment.name === "ssr";
|
|
12486
12502
|
},
|
|
12487
12503
|
name: "setup-ssr-context",
|
|
12488
12504
|
transform(code, id) {
|
|
12489
|
-
|
|
12490
|
-
if (
|
|
12491
|
-
// ignore node_modules
|
|
12492
|
-
id.includes("node_modules") && // but allow injected runtime
|
|
12493
|
-
!id.includes(join2("node_modules", "@wix", "astro"))
|
|
12494
|
-
) {
|
|
12505
|
+
if (!id.startsWith(srcDir) && !whitelistedFilePaths.includes(id)) {
|
|
12495
12506
|
return null;
|
|
12496
12507
|
}
|
|
12508
|
+
const extension = extname(id);
|
|
12497
12509
|
if (extension !== ".js" && extension !== ".astro" && extension !== ".ts" && extension !== ".tsx") {
|
|
12498
12510
|
return null;
|
|
12499
12511
|
}
|
|
@@ -12741,10 +12753,10 @@ var isSymlinkSync = isTypeSync.bind(void 0, "lstatSync", "isSymbolicLink");
|
|
|
12741
12753
|
init_esm_shims();
|
|
12742
12754
|
import { promisify } from "node:util";
|
|
12743
12755
|
import { execFile as execFileCallback, execFileSync as execFileSyncOriginal } from "node:child_process";
|
|
12744
|
-
import { fileURLToPath } from "node:url";
|
|
12756
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
12745
12757
|
var execFileOriginal = promisify(execFileCallback);
|
|
12746
12758
|
function toPath(urlOrPath) {
|
|
12747
|
-
return urlOrPath instanceof URL ?
|
|
12759
|
+
return urlOrPath instanceof URL ? fileURLToPath2(urlOrPath) : urlOrPath;
|
|
12748
12760
|
}
|
|
12749
12761
|
var TEN_MEGABYTES_IN_BYTES = 10 * 1024 * 1024;
|
|
12750
12762
|
|
|
@@ -18115,11 +18127,11 @@ function isValidWebhookComponent(component) {
|
|
|
18115
18127
|
|
|
18116
18128
|
// src/utils/resolveBuildMetadata.ts
|
|
18117
18129
|
init_esm_shims();
|
|
18118
|
-
import { fileURLToPath as
|
|
18130
|
+
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
18119
18131
|
async function resolveBuildMetadata(appManifestPath, config) {
|
|
18120
|
-
const outDir =
|
|
18121
|
-
const buildClientDir =
|
|
18122
|
-
const buildServerDir =
|
|
18132
|
+
const outDir = fileURLToPath3(config.outDir);
|
|
18133
|
+
const buildClientDir = fileURLToPath3(config.build.client);
|
|
18134
|
+
const buildServerDir = fileURLToPath3(config.build.server);
|
|
18123
18135
|
const clientDir = await pathExists(buildClientDir) ? buildClientDir : outDir;
|
|
18124
18136
|
const serverDir = await pathExists(buildServerDir) ? buildServerDir : void 0;
|
|
18125
18137
|
return {
|
|
@@ -18327,8 +18339,8 @@ var createIntegration = (options = {
|
|
|
18327
18339
|
async "astro:build:done"({ logger }) {
|
|
18328
18340
|
model ??= await createProjectModel(logger);
|
|
18329
18341
|
const appManifest = generateAppManifest(model);
|
|
18330
|
-
const outDir =
|
|
18331
|
-
const rootDir =
|
|
18342
|
+
const outDir = fileURLToPath4(_config.outDir);
|
|
18343
|
+
const rootDir = fileURLToPath4(_config.root);
|
|
18332
18344
|
const appManifestPath = join7(outDir, "_wix/app-manifest.json");
|
|
18333
18345
|
await writeJson(appManifestPath, appManifest, { spaces: 2 });
|
|
18334
18346
|
await writeJson(
|
|
@@ -18351,8 +18363,8 @@ var createIntegration = (options = {
|
|
|
18351
18363
|
updateConfig
|
|
18352
18364
|
}) {
|
|
18353
18365
|
const codegenDirURL = createCodegenDir();
|
|
18354
|
-
const codegenDir =
|
|
18355
|
-
const rootDir =
|
|
18366
|
+
const codegenDir = fileURLToPath4(codegenDirURL);
|
|
18367
|
+
const rootDir = fileURLToPath4(config.root);
|
|
18356
18368
|
model ??= await createProjectModel(logger);
|
|
18357
18369
|
injectScript(
|
|
18358
18370
|
"before-hydration",
|
|
@@ -18408,7 +18420,7 @@ var createIntegration = (options = {
|
|
|
18408
18420
|
plugins: [
|
|
18409
18421
|
patchGlobal(),
|
|
18410
18422
|
patchAstroInlineScripts(),
|
|
18411
|
-
setupSsrContext()
|
|
18423
|
+
setupSsrContext(rootDir)
|
|
18412
18424
|
]
|
|
18413
18425
|
}
|
|
18414
18426
|
});
|