rwsdk 1.0.0-alpha.20 → 1.0.0-alpha.20-test.20250929150023
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/lib/constants.mjs +1 -2
- package/dist/lib/e2e/browser.d.mts +1 -1
- package/dist/lib/e2e/browser.mjs +3 -4
- package/dist/lib/e2e/dev.mjs +1 -1
- package/dist/lib/e2e/environment.d.mts +1 -5
- package/dist/lib/e2e/environment.mjs +5 -61
- package/dist/lib/e2e/index.d.mts +5 -5
- package/dist/lib/e2e/index.mjs +5 -5
- package/dist/lib/e2e/release.mjs +4 -4
- package/dist/lib/e2e/setup.d.mts +1 -1
- package/dist/lib/e2e/tarball.d.mts +1 -1
- package/dist/lib/e2e/tarball.mjs +3 -3
- package/dist/lib/e2e/testHarness.d.mts +1 -1
- package/dist/lib/e2e/testHarness.mjs +7 -8
- package/dist/lib/getShortName.mjs +1 -2
- package/dist/lib/getShortName.test.mjs +2 -2
- package/dist/lib/getSrcPaths.js +2 -2
- package/dist/lib/hasPkgScript.test.mjs +2 -2
- package/dist/lib/jsonUtils.test.mjs +2 -2
- package/dist/lib/normalizeModulePath.test.mjs +2 -2
- package/dist/lib/setupEnvFiles.mjs +2 -2
- package/dist/lib/smokeTests/artifacts.mjs +2 -2
- package/dist/lib/smokeTests/browser.d.mts +1 -1
- package/dist/lib/smokeTests/browser.mjs +6 -7
- package/dist/lib/smokeTests/cleanup.mjs +6 -9
- package/dist/lib/smokeTests/codeUpdates.mjs +5 -5
- package/dist/lib/smokeTests/development.mjs +2 -2
- package/dist/lib/smokeTests/environment.d.mts +2 -3
- package/dist/lib/smokeTests/environment.mjs +17 -3
- package/dist/lib/smokeTests/release.d.mts +2 -2
- package/dist/lib/smokeTests/release.mjs +3 -3
- package/dist/lib/smokeTests/reporting.mjs +2 -2
- package/dist/lib/smokeTests/runSmokeTests.mjs +4 -4
- package/dist/lib/smokeTests/utils.mjs +3 -3
- package/dist/lib/testUtils/stubEnvVars.mjs +1 -1
- package/dist/runtime/client/client.d.ts +2 -2
- package/dist/runtime/client/client.js +2 -2
- package/dist/runtime/client/navigation.test.js +1 -1
- package/dist/runtime/client/types.d.ts +1 -1
- package/dist/runtime/entries/client.d.ts +2 -2
- package/dist/runtime/entries/client.js +2 -2
- package/dist/runtime/entries/router.d.ts +1 -1
- package/dist/runtime/entries/router.js +1 -1
- package/dist/runtime/entries/worker.d.ts +5 -5
- package/dist/runtime/entries/worker.js +5 -5
- package/dist/runtime/imports/worker.js +1 -1
- package/dist/runtime/lib/auth/session.js +1 -1
- package/dist/runtime/lib/db/DOWorkerDialect.d.ts +1 -1
- package/dist/runtime/lib/db/DOWorkerDialect.js +1 -1
- package/dist/runtime/lib/db/SqliteDurableObject.js +2 -2
- package/dist/runtime/lib/db/index.d.ts +2 -2
- package/dist/runtime/lib/db/index.js +2 -2
- package/dist/runtime/lib/db/migrations.d.ts +1 -1
- package/dist/runtime/lib/db/typeInference/builders/alterTable.d.ts +3 -3
- package/dist/runtime/lib/db/typeInference/builders/columnDefinition.d.ts +1 -1
- package/dist/runtime/lib/db/typeInference/builders/createTable.d.ts +2 -2
- package/dist/runtime/lib/db/typeInference/builders/createView.d.ts +1 -1
- package/dist/runtime/lib/db/typeInference/builders/dropTable.d.ts +1 -1
- package/dist/runtime/lib/db/typeInference/builders/dropView.d.ts +1 -1
- package/dist/runtime/lib/db/typeInference/builders/schema.d.ts +3 -3
- package/dist/runtime/lib/db/typeInference/database.d.ts +2 -2
- package/dist/runtime/lib/memoizeOnId.test.js +1 -1
- package/dist/runtime/lib/realtime/client.js +2 -2
- package/dist/runtime/lib/realtime/durableObject.js +1 -1
- package/dist/runtime/lib/realtime/protocol.test.js +1 -1
- package/dist/runtime/lib/realtime/shared.test.js +1 -1
- package/dist/runtime/lib/realtime/validateUpgradeRequest.test.js +1 -1
- package/dist/runtime/lib/realtime/worker.js +2 -2
- package/dist/runtime/lib/router.d.ts +1 -1
- package/dist/runtime/lib/router.test.js +2 -2
- package/dist/runtime/lib/rwContext.d.ts +1 -1
- package/dist/runtime/lib/turnstile/useTurnstile.js +1 -1
- package/dist/runtime/lib/turnstile/verifyTurnstileToken.test.js +1 -1
- package/dist/runtime/register/worker.js +1 -1
- package/dist/runtime/render/createThenableFromReadableStream.js +1 -1
- package/dist/runtime/render/preloads.d.ts +1 -1
- package/dist/runtime/render/renderDocumentHtmlStream.js +1 -1
- package/dist/runtime/render/renderToStream.d.ts +1 -1
- package/dist/runtime/render/renderToStream.js +2 -2
- package/dist/runtime/requestInfo/worker.d.ts +1 -1
- package/dist/runtime/script.js +1 -1
- package/dist/runtime/ssrBridge.d.ts +2 -2
- package/dist/runtime/ssrBridge.js +2 -2
- package/dist/runtime/worker.d.ts +1 -1
- package/dist/runtime/worker.js +3 -3
- package/dist/scripts/addon.d.mts +1 -0
- package/dist/scripts/addon.mjs +75 -0
- package/dist/scripts/debug-sync.mjs +4 -4
- package/dist/scripts/ensure-deploy-env.mjs +6 -6
- package/dist/scripts/migrate-new.mjs +3 -4
- package/dist/scripts/smoke-test.mjs +2 -2
- package/dist/scripts/worker-run.mjs +7 -9
- package/dist/vite/buildApp.mjs +1 -1
- package/dist/vite/checkIsUsingPrisma.test.mjs +1 -1
- package/dist/vite/configPlugin.mjs +1 -1
- package/dist/vite/createDirectiveLookupPlugin.mjs +1 -1
- package/dist/vite/createDirectiveLookupPlugin.test.mjs +2 -2
- package/dist/vite/createViteAwareResolver.d.mts +1 -2
- package/dist/vite/createViteAwareResolver.mjs +1 -1
- package/dist/vite/directiveModulesDevPlugin.mjs +3 -3
- package/dist/vite/directiveModulesDevPlugin.test.mjs +2 -2
- package/dist/vite/directivesPlugin.mjs +3 -3
- package/dist/vite/directivesPlugin.test.mjs +1 -1
- package/dist/vite/ensureAliasArray.test.mjs +1 -1
- package/dist/vite/findSpecifiers.mjs +1 -1
- package/dist/vite/findSpecifiers.test.mjs +2 -2
- package/dist/vite/findSsrSpecifiers.mjs +1 -1
- package/dist/vite/findSsrSpecifiers.test.mjs +1 -1
- package/dist/vite/getViteEsbuild.mjs +1 -1
- package/dist/vite/hasDirective.test.mjs +1 -1
- package/dist/vite/index.d.mts +1 -1
- package/dist/vite/invalidateCacheIfPrismaClientChanged.mjs +2 -2
- package/dist/vite/isJsFile.test.mjs +1 -1
- package/dist/vite/knownDepsResolverPlugin.d.mts +1 -1
- package/dist/vite/knownDepsResolverPlugin.mjs +1 -1
- package/dist/vite/linkerPlugin.mjs +2 -2
- package/dist/vite/linkerPlugin.test.mjs +1 -1
- package/dist/vite/miniflareHMRPlugin.mjs +5 -5
- package/dist/vite/miniflareHMRPlugin.test.mjs +1 -1
- package/dist/vite/prismaPlugin.mjs +1 -1
- package/dist/vite/redwoodPlugin.mjs +16 -16
- package/dist/vite/redwoodPlugin.test.mjs +2 -2
- package/dist/vite/runDirectivesScan.mjs +6 -5
- package/dist/vite/runDirectivesScan.test.mjs +2 -2
- package/dist/vite/ssrBridgePlugin.mjs +2 -2
- package/dist/vite/transformClientComponents.mjs +2 -2
- package/dist/vite/transformClientComponents.test.mjs +1 -1
- package/dist/vite/transformJsxScriptTagsPlugin.mjs +1 -1
- package/dist/vite/transformJsxScriptTagsPlugin.test.mjs +2 -2
- package/dist/vite/transformServerFunctions.mjs +4 -4
- package/package.json +7 -2
package/dist/lib/constants.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { resolve } from "node:path";
|
|
2
|
-
import path from "node:path";
|
|
1
|
+
import path, { resolve } from "node:path";
|
|
3
2
|
const __dirname = new URL(".", import.meta.url).pathname;
|
|
4
3
|
export const ROOT_DIR = resolve(__dirname, "..", "..");
|
|
5
4
|
export const SRC_DIR = resolve(ROOT_DIR, "src");
|
package/dist/lib/e2e/browser.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
import { computeExecutablePath, detectBrowserPlatform, install, Browser as PuppeteerBrowser, resolveBuildId, } from "@puppeteer/browsers";
|
|
2
|
+
import debug from "debug";
|
|
3
|
+
import { mkdirp, pathExists } from "fs-extra";
|
|
1
4
|
import * as os from "os";
|
|
2
5
|
import { join } from "path";
|
|
3
|
-
import { pathExists } from "fs-extra";
|
|
4
|
-
import debug from "debug";
|
|
5
|
-
import { mkdirp } from "fs-extra";
|
|
6
|
-
import { install, resolveBuildId, computeExecutablePath, detectBrowserPlatform, Browser as PuppeteerBrowser, } from "@puppeteer/browsers";
|
|
7
6
|
import puppeteer from "puppeteer-core";
|
|
8
7
|
const log = debug("rwsdk:e2e:browser");
|
|
9
8
|
/**
|
package/dist/lib/e2e/dev.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { setTimeout as sleep } from "node:timers/promises";
|
|
2
1
|
import debug from "debug";
|
|
2
|
+
import { setTimeout as sleep } from "node:timers/promises";
|
|
3
3
|
import { $ } from "../../lib/$.mjs";
|
|
4
4
|
import { poll } from "./poll.mjs";
|
|
5
5
|
const DEV_SERVER_CHECK_TIMEOUT = process.env.RWSDK_DEV_SERVER_CHECK_TIMEOUT
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import tmp from "tmp-promise";
|
|
2
|
-
import {
|
|
3
|
-
/**
|
|
4
|
-
* Sets up the test environment, preparing any resources needed for testing
|
|
5
|
-
*/
|
|
6
|
-
export declare function setupTestEnvironment(options?: SmokeTestOptions): Promise<TestResources>;
|
|
2
|
+
import { PackageManager } from "./types.mjs";
|
|
7
3
|
/**
|
|
8
4
|
* Copy project to a temporary directory with a unique name
|
|
9
5
|
*/
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import { join } from "path";
|
|
2
1
|
import debug from "debug";
|
|
3
|
-
import {
|
|
2
|
+
import { copy, pathExists } from "fs-extra";
|
|
3
|
+
import ignore from "ignore";
|
|
4
4
|
import * as fs from "node:fs";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import os from "os";
|
|
7
|
+
import { basename, join, relative, resolve } from "path";
|
|
5
8
|
import tmp from "tmp-promise";
|
|
6
|
-
import ignore from "ignore";
|
|
7
|
-
import { relative, basename, resolve } from "path";
|
|
8
|
-
import { uniqueNamesGenerator, adjectives, animals, } from "unique-names-generator";
|
|
9
|
-
import { createHash } from "crypto";
|
|
10
9
|
import { $ } from "../../lib/$.mjs";
|
|
11
10
|
import { ROOT_DIR } from "../constants.mjs";
|
|
12
|
-
import path from "node:path";
|
|
13
|
-
import os from "os";
|
|
14
11
|
import { retry } from "./retry.mjs";
|
|
15
12
|
const log = debug("rwsdk:e2e:environment");
|
|
16
13
|
const createSdkTarball = async () => {
|
|
@@ -33,59 +30,6 @@ const setTarballDependency = async (targetDir, tarballName) => {
|
|
|
33
30
|
packageJsonContent.dependencies.rwsdk = `file:${tarballName}`;
|
|
34
31
|
await fs.promises.writeFile(filePath, JSON.stringify(packageJsonContent, null, 2));
|
|
35
32
|
};
|
|
36
|
-
/**
|
|
37
|
-
* Sets up the test environment, preparing any resources needed for testing
|
|
38
|
-
*/
|
|
39
|
-
export async function setupTestEnvironment(options = {}) {
|
|
40
|
-
log("Setting up test environment with options: %O", options);
|
|
41
|
-
// Generate a resource unique key for this test run right at the start
|
|
42
|
-
const uniqueNameSuffix = uniqueNamesGenerator({
|
|
43
|
-
dictionaries: [adjectives, animals],
|
|
44
|
-
separator: "-",
|
|
45
|
-
length: 2,
|
|
46
|
-
style: "lowerCase",
|
|
47
|
-
});
|
|
48
|
-
// Create a short unique hash based on the timestamp
|
|
49
|
-
const hash = createHash("md5")
|
|
50
|
-
.update(Date.now().toString())
|
|
51
|
-
.digest("hex")
|
|
52
|
-
.substring(0, 8);
|
|
53
|
-
// Create a resource unique key even if we're not copying a project
|
|
54
|
-
const resourceUniqueKey = `${uniqueNameSuffix}-${hash}`;
|
|
55
|
-
const resources = {
|
|
56
|
-
tempDirCleanup: undefined,
|
|
57
|
-
workerName: undefined,
|
|
58
|
-
originalCwd: process.cwd(),
|
|
59
|
-
targetDir: undefined,
|
|
60
|
-
workerCreatedDuringTest: false,
|
|
61
|
-
stopDev: undefined,
|
|
62
|
-
resourceUniqueKey, // Set at initialization
|
|
63
|
-
};
|
|
64
|
-
log("Current working directory: %s", resources.originalCwd);
|
|
65
|
-
try {
|
|
66
|
-
// If a project dir is specified, copy it to a temp dir with a unique name
|
|
67
|
-
if (options.projectDir) {
|
|
68
|
-
log("Project directory specified: %s", options.projectDir);
|
|
69
|
-
const { tempDir, targetDir, workerName } = await copyProjectToTempDir(options.projectDir, resourceUniqueKey, // Pass in the existing resourceUniqueKey
|
|
70
|
-
options.packageManager);
|
|
71
|
-
// Store cleanup function
|
|
72
|
-
resources.tempDirCleanup = tempDir.cleanup;
|
|
73
|
-
resources.workerName = workerName;
|
|
74
|
-
resources.targetDir = targetDir;
|
|
75
|
-
log("Target directory: %s", targetDir);
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
log("No project directory specified, using current directory");
|
|
79
|
-
// When no project dir is specified, we'll use the current directory
|
|
80
|
-
resources.targetDir = resources.originalCwd;
|
|
81
|
-
}
|
|
82
|
-
return resources;
|
|
83
|
-
}
|
|
84
|
-
catch (error) {
|
|
85
|
-
log("Error during test environment setup: %O", error);
|
|
86
|
-
throw error;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
33
|
/**
|
|
90
34
|
* Copy project to a temporary directory with a unique name
|
|
91
35
|
*/
|
package/dist/lib/e2e/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from "./testHarness.mjs";
|
|
2
|
-
export * from "./tarball.mjs";
|
|
3
|
-
export * from "./environment.mjs";
|
|
4
|
-
export * from "./dev.mjs";
|
|
5
1
|
export * from "./browser.mjs";
|
|
2
|
+
export * from "./dev.mjs";
|
|
3
|
+
export * from "./environment.mjs";
|
|
4
|
+
export * from "./poll.mjs";
|
|
6
5
|
export * from "./release.mjs";
|
|
6
|
+
export * from "./tarball.mjs";
|
|
7
|
+
export * from "./testHarness.mjs";
|
|
7
8
|
export * from "./types.mjs";
|
|
8
|
-
export * from "./poll.mjs";
|
package/dist/lib/e2e/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from "./testHarness.mjs";
|
|
2
|
-
export * from "./tarball.mjs";
|
|
3
|
-
export * from "./environment.mjs";
|
|
4
|
-
export * from "./dev.mjs";
|
|
5
1
|
export * from "./browser.mjs";
|
|
2
|
+
export * from "./dev.mjs";
|
|
3
|
+
export * from "./environment.mjs";
|
|
4
|
+
export * from "./poll.mjs";
|
|
6
5
|
export * from "./release.mjs";
|
|
6
|
+
export * from "./tarball.mjs";
|
|
7
|
+
export * from "./testHarness.mjs";
|
|
7
8
|
export * from "./types.mjs";
|
|
8
|
-
export * from "./poll.mjs";
|
package/dist/lib/e2e/release.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { join, basename, dirname, resolve } from "path";
|
|
2
|
-
import { setTimeout } from "node:timers/promises";
|
|
3
1
|
import debug from "debug";
|
|
4
|
-
import { $ } from "../../lib/$.mjs";
|
|
5
2
|
import { execaCommand } from "execa";
|
|
6
3
|
import { existsSync, readFileSync } from "fs";
|
|
7
4
|
import { pathExists } from "fs-extra";
|
|
8
|
-
import { parse as parseJsonc } from "jsonc-parser";
|
|
9
5
|
import * as fs from "fs/promises";
|
|
6
|
+
import { parse as parseJsonc } from "jsonc-parser";
|
|
7
|
+
import { setTimeout } from "node:timers/promises";
|
|
8
|
+
import { basename, dirname, join, resolve } from "path";
|
|
9
|
+
import { $ } from "../../lib/$.mjs";
|
|
10
10
|
import { extractLastJson, parseJson } from "../../lib/jsonUtils.mjs";
|
|
11
11
|
const log = debug("rwsdk:e2e:release");
|
|
12
12
|
/**
|
package/dist/lib/e2e/setup.d.mts
CHANGED
package/dist/lib/e2e/tarball.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { createHash } from "crypto";
|
|
1
2
|
import { $ } from "execa";
|
|
2
3
|
import fs from "node:fs";
|
|
3
4
|
import path from "node:path";
|
|
4
|
-
import {
|
|
5
|
-
import { uniqueNamesGenerator, adjectives, animals, } from "unique-names-generator";
|
|
6
|
-
import { createHash } from "crypto";
|
|
5
|
+
import { adjectives, animals, uniqueNamesGenerator, } from "unique-names-generator";
|
|
7
6
|
import { ROOT_DIR } from "../constants.mjs";
|
|
7
|
+
import { copyProjectToTempDir } from "./environment.mjs";
|
|
8
8
|
const log = (message) => console.log(message);
|
|
9
9
|
/**
|
|
10
10
|
* Copies wrangler cache from monorepo to temp directory for deployment tests
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { test, beforeAll, afterAll, afterEach, describe, beforeEach, } from "vitest";
|
|
2
|
-
import { basename, join as pathJoin, dirname } from "path";
|
|
3
|
-
import { setupTarballEnvironment } from "./tarball.mjs";
|
|
4
|
-
import { runDevServer } from "./dev.mjs";
|
|
5
|
-
import { runRelease, deleteWorker, deleteD1Database, isRelatedToTest, } from "./release.mjs";
|
|
6
|
-
import { launchBrowser } from "./browser.mjs";
|
|
7
|
-
import puppeteer from "puppeteer-core";
|
|
8
1
|
import fs from "fs-extra";
|
|
9
2
|
import os from "os";
|
|
10
|
-
import path from "path";
|
|
3
|
+
import path, { basename, dirname, join as pathJoin } from "path";
|
|
4
|
+
import puppeteer from "puppeteer-core";
|
|
5
|
+
import { afterAll, afterEach, beforeAll, beforeEach, describe, test, } from "vitest";
|
|
6
|
+
import { launchBrowser } from "./browser.mjs";
|
|
7
|
+
import { runDevServer } from "./dev.mjs";
|
|
11
8
|
import { poll, pollValue } from "./poll.mjs";
|
|
9
|
+
import { deleteD1Database, deleteWorker, isRelatedToTest, runRelease, } from "./release.mjs";
|
|
10
|
+
import { setupTarballEnvironment } from "./tarball.mjs";
|
|
12
11
|
const SETUP_PLAYGROUND_ENV_TIMEOUT = process.env
|
|
13
12
|
.RWSDK_SETUP_PLAYGROUND_ENV_TIMEOUT
|
|
14
13
|
? parseInt(process.env.RWSDK_SETUP_PLAYGROUND_ENV_TIMEOUT, 10)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { getShortName } from "./getShortName.mjs";
|
|
3
1
|
import path from "node:path";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { getShortName } from "./getShortName.mjs";
|
|
4
4
|
describe("getShortName", () => {
|
|
5
5
|
it("should return the relative path if the file is inside the root", () => {
|
|
6
6
|
const root = path.join("/Users", "test", "project");
|
package/dist/lib/getSrcPaths.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import path from "path";
|
|
3
1
|
import { glob } from "glob";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import ts from "typescript";
|
|
4
4
|
/**
|
|
5
5
|
* Gets all source file paths by parsing tsconfig.json using TypeScript's compiler API.
|
|
6
6
|
* Falls back to a glob pattern if tsconfig parsing fails.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { beforeEach, describe, expect, it } from "vitest";
|
|
2
|
+
import { _resetPkgCache, hasPkgScript } from "./hasPkgScript.mjs";
|
|
3
3
|
// Manually reset the cache before each test
|
|
4
4
|
beforeEach(() => {
|
|
5
5
|
_resetPkgCache();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { describe,
|
|
2
|
-
import {
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { extractAllJson, extractLastJson, parseJson } from "./jsonUtils.mjs";
|
|
3
3
|
describe("jsonUtils", () => {
|
|
4
4
|
describe("extractLastJson", () => {
|
|
5
5
|
it("should extract the last JSON object from a string", () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { describe,
|
|
2
|
-
import {
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { findCommonAncestorDepth, normalizeModulePath, } from "./normalizeModulePath.mjs";
|
|
3
3
|
describe("findCommonAncestorDepth", () => {
|
|
4
4
|
it("should return the correct depth for common paths", () => {
|
|
5
5
|
expect(findCommonAncestorDepth("/a/b/c", "/a/b/d")).toBe(2);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { resolve } from "node:path";
|
|
2
|
-
import { symlink, copyFile } from "node:fs/promises";
|
|
3
1
|
import { pathExists } from "fs-extra";
|
|
2
|
+
import { copyFile, symlink } from "node:fs/promises";
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
4
|
export async function setupEnvFiles({ rootDir, }) {
|
|
5
5
|
const envPath = resolve(rootDir, ".env");
|
|
6
6
|
const devVarsPath = resolve(rootDir, ".dev.vars");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { createWriteStream, existsSync, mkdirSync } from "fs";
|
|
2
|
+
import { mkdirp, pathExists } from "fs-extra";
|
|
1
3
|
import * as fs from "fs/promises";
|
|
2
4
|
import { join } from "path";
|
|
3
|
-
import { mkdirp, pathExists } from "fs-extra";
|
|
4
|
-
import { createWriteStream, existsSync, mkdirSync } from "fs";
|
|
5
5
|
import { log } from "./constants.mjs";
|
|
6
6
|
// Stream capturer for logging
|
|
7
7
|
export const capturer = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { Browser, Page } from "puppeteer-core";
|
|
1
2
|
import { SmokeTestOptions, SmokeTestResult } from "./types.mjs";
|
|
2
|
-
import type { Page, Browser } from "puppeteer-core";
|
|
3
3
|
export declare function checkUrlStyles(page: Page, expectedColor: "red" | "green"): Promise<void>;
|
|
4
4
|
export declare function checkClientModuleStyles(page: Page, expectedColor: "blue" | "green"): Promise<void>;
|
|
5
5
|
/**
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
+
import * as fs from "fs/promises";
|
|
1
2
|
import { join } from "path";
|
|
2
|
-
import { log } from "./constants.mjs";
|
|
3
|
-
import { takeScreenshot } from "./artifacts.mjs";
|
|
4
|
-
import { RETRIES } from "./constants.mjs";
|
|
5
3
|
import { $ } from "../$.mjs";
|
|
6
|
-
import {
|
|
4
|
+
import { getBrowserPath as getE2EBrowserPath, launchBrowser as launchE2EBrowser, } from "../../lib/e2e/browser.mjs";
|
|
5
|
+
import { takeScreenshot } from "./artifacts.mjs";
|
|
6
|
+
import { log, RETRIES } from "./constants.mjs";
|
|
7
7
|
import { reportSmokeTestResult } from "./reporting.mjs";
|
|
8
8
|
import { updateTestStatus } from "./state.mjs";
|
|
9
|
-
import * as fs from "fs/promises";
|
|
10
|
-
import { template as urlStylesTemplate } from "./templates/smokeTestUrlStyles.css.template";
|
|
11
9
|
import { template as clientStylesTemplate } from "./templates/smokeTestClientStyles.module.css.template";
|
|
12
|
-
import {
|
|
10
|
+
import { template as urlStylesTemplate } from "./templates/smokeTestUrlStyles.css.template";
|
|
11
|
+
import { fail, withRetries } from "./utils.mjs";
|
|
13
12
|
export async function checkUrlStyles(page, expectedColor) {
|
|
14
13
|
const selector = '[data-testid="smoke-test-url-styles"]';
|
|
15
14
|
log(`Checking for element with selector: ${selector}`);
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { setTimeout } from "node:timers/promises";
|
|
3
|
-
import { pathExists } from "fs-extra";
|
|
4
|
-
import { mkdirp } from "fs-extra";
|
|
1
|
+
import { copy, mkdirp, pathExists } from "fs-extra";
|
|
5
2
|
import * as fs from "fs/promises";
|
|
6
|
-
import { copy } from "fs-extra";
|
|
7
|
-
import { relative } from "path";
|
|
8
3
|
import ignore from "ignore";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { isRunningInCI } from "./utils.mjs";
|
|
4
|
+
import { setTimeout } from "node:timers/promises";
|
|
5
|
+
import { join, relative } from "path";
|
|
12
6
|
import { capturer } from "./artifacts.mjs";
|
|
7
|
+
import { log } from "./constants.mjs";
|
|
8
|
+
import { deleteD1Database, deleteWorker, listD1Databases } from "./release.mjs";
|
|
13
9
|
import { state } from "./state.mjs";
|
|
10
|
+
import { isRunningInCI } from "./utils.mjs";
|
|
14
11
|
/**
|
|
15
12
|
* Cleans up any resources used during testing
|
|
16
13
|
*/
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { join } from "path";
|
|
2
1
|
import * as fs from "fs/promises";
|
|
2
|
+
import { parse as parseJsonc } from "jsonc-parser";
|
|
3
|
+
import MagicString from "magic-string";
|
|
4
|
+
import { join } from "path";
|
|
3
5
|
import { log } from "./constants.mjs";
|
|
4
|
-
import { getSmokeTestFunctionsTemplate } from "./templates/smokeTestFunctions.template";
|
|
5
6
|
import { getSmokeTestTemplate } from "./templates/SmokeTest.template";
|
|
6
7
|
import { getSmokeTestClientTemplate } from "./templates/SmokeTestClient.template";
|
|
7
|
-
import { template as smokeTestUrlStylesCssTemplate } from "./templates/smokeTestUrlStyles.css.template";
|
|
8
8
|
import { template as smokeTestClientStylesCssTemplate } from "./templates/smokeTestClientStyles.module.css.template";
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
9
|
+
import { getSmokeTestFunctionsTemplate } from "./templates/smokeTestFunctions.template";
|
|
10
|
+
import { template as smokeTestUrlStylesCssTemplate } from "./templates/smokeTestUrlStyles.css.template";
|
|
11
11
|
/**
|
|
12
12
|
* Creates the smoke test components in the target project directory
|
|
13
13
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { runDevServer as runE2EDevServer } from "../../lib/e2e/dev.mjs";
|
|
2
|
+
import { checkServerUp, checkUrl, launchBrowser } from "./browser.mjs";
|
|
1
3
|
import { log, RETRIES } from "./constants.mjs";
|
|
2
|
-
import { checkUrl, checkServerUp, launchBrowser } from "./browser.mjs";
|
|
3
4
|
import { state } from "./state.mjs";
|
|
4
|
-
import { runDevServer as runE2EDevServer } from "../../lib/e2e/dev.mjs";
|
|
5
5
|
/**
|
|
6
6
|
* Run the local development server and return the URL
|
|
7
7
|
*/
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SmokeTestOptions
|
|
1
|
+
import { TestResources } from "../../lib/e2e/types.mjs";
|
|
2
|
+
import { SmokeTestOptions } from "./types.mjs";
|
|
3
3
|
/**
|
|
4
4
|
* Sets up the test environment for smoke tests, preparing any resources needed for testing
|
|
5
5
|
*/
|
|
6
6
|
export declare function setupTestEnvironment(options?: SmokeTestOptions): Promise<TestResources>;
|
|
7
|
-
export { copyProjectToTempDir };
|
|
@@ -1,11 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { setupTarballEnvironment } from "../../lib/e2e/tarball.mjs";
|
|
2
2
|
import { createSmokeTestComponents } from "./codeUpdates.mjs";
|
|
3
3
|
import { log } from "./constants.mjs";
|
|
4
4
|
/**
|
|
5
5
|
* Sets up the test environment for smoke tests, preparing any resources needed for testing
|
|
6
6
|
*/
|
|
7
7
|
export async function setupTestEnvironment(options = {}) {
|
|
8
|
-
|
|
8
|
+
if (!options.projectDir) {
|
|
9
|
+
throw new Error("projectDir is required for smoke tests");
|
|
10
|
+
}
|
|
11
|
+
const tarballEnv = await setupTarballEnvironment({
|
|
12
|
+
projectDir: options.projectDir,
|
|
13
|
+
packageManager: options.packageManager,
|
|
14
|
+
});
|
|
15
|
+
const resources = {
|
|
16
|
+
tempDirCleanup: tarballEnv.cleanup,
|
|
17
|
+
workerName: undefined,
|
|
18
|
+
originalCwd: process.cwd(),
|
|
19
|
+
targetDir: tarballEnv.targetDir,
|
|
20
|
+
workerCreatedDuringTest: false,
|
|
21
|
+
stopDev: undefined,
|
|
22
|
+
resourceUniqueKey: `smoke-test-${Date.now()}`,
|
|
23
|
+
};
|
|
9
24
|
if (resources.targetDir) {
|
|
10
25
|
// Create the smoke test components in the user's project
|
|
11
26
|
log("Creating smoke test components");
|
|
@@ -13,4 +28,3 @@ export async function setupTestEnvironment(options = {}) {
|
|
|
13
28
|
}
|
|
14
29
|
return resources;
|
|
15
30
|
}
|
|
16
|
-
export { copyProjectToTempDir };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { $expect, deleteD1Database, deleteWorker, isRelatedToTest, listD1Databases } from "../../lib/e2e/release.mjs";
|
|
1
2
|
import { TestResources } from "./types.mjs";
|
|
2
|
-
|
|
3
|
-
export { deleteWorker, deleteD1Database, isRelatedToTest, $expect, listD1Databases, };
|
|
3
|
+
export { $expect, deleteD1Database, deleteWorker, isRelatedToTest, listD1Databases, };
|
|
4
4
|
/**
|
|
5
5
|
* Run the release command to deploy to Cloudflare
|
|
6
6
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { setTimeout } from "node:timers/promises";
|
|
2
|
+
import { $expect, deleteD1Database, deleteWorker, isRelatedToTest, listD1Databases, runRelease as runE2ERelease, } from "../../lib/e2e/release.mjs";
|
|
3
|
+
import { checkServerUp, checkUrl } from "./browser.mjs";
|
|
2
4
|
import { log } from "./constants.mjs";
|
|
3
|
-
|
|
4
|
-
import { runRelease as runE2ERelease, deleteWorker, deleteD1Database, isRelatedToTest, $expect, listD1Databases, } from "../../lib/e2e/release.mjs";
|
|
5
|
-
export { deleteWorker, deleteD1Database, isRelatedToTest, $expect, listD1Databases, };
|
|
5
|
+
export { $expect, deleteD1Database, deleteWorker, isRelatedToTest, listD1Databases, };
|
|
6
6
|
/**
|
|
7
7
|
* Run the release command to deploy to Cloudflare
|
|
8
8
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { join, basename } from "path";
|
|
2
|
-
import { writeFile } from "fs/promises";
|
|
3
1
|
import { mkdirp } from "fs-extra";
|
|
2
|
+
import { writeFile } from "fs/promises";
|
|
3
|
+
import { basename, join } from "path";
|
|
4
4
|
import { log } from "./constants.mjs";
|
|
5
5
|
import { state } from "./state.mjs";
|
|
6
6
|
/**
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { join } from "path";
|
|
2
|
-
import { getBrowserPath } from "./browser.mjs";
|
|
3
2
|
import { setupArtifactsDirectory } from "./artifacts.mjs";
|
|
4
|
-
import {
|
|
3
|
+
import { getBrowserPath } from "./browser.mjs";
|
|
5
4
|
import { runDevServer, runDevTest } from "./development.mjs";
|
|
5
|
+
import { setupTestEnvironment } from "./environment.mjs";
|
|
6
6
|
import { runReleaseTest } from "./release.mjs";
|
|
7
|
-
import { fail, teardown, log } from "./utils.mjs";
|
|
8
|
-
import { state, updateTestStatus } from "./state.mjs";
|
|
9
7
|
import { initializeTestStatus } from "./reporting.mjs";
|
|
8
|
+
import { state, updateTestStatus } from "./state.mjs";
|
|
9
|
+
import { fail, log, teardown } from "./utils.mjs";
|
|
10
10
|
/**
|
|
11
11
|
* Main function that orchestrates the smoke test flow
|
|
12
12
|
*/
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { mkdirp } from "fs-extra";
|
|
1
2
|
import { setTimeout } from "node:timers/promises";
|
|
2
3
|
import { join } from "path";
|
|
4
|
+
import { cleanupResources } from "./cleanup.mjs";
|
|
3
5
|
import { log } from "./constants.mjs";
|
|
4
|
-
import { mkdirp } from "fs-extra";
|
|
5
|
-
import { state } from "./state.mjs";
|
|
6
6
|
import { generateFinalReport } from "./reporting.mjs";
|
|
7
|
-
import {
|
|
7
|
+
import { state } from "./state.mjs";
|
|
8
8
|
// Re-export log from constants
|
|
9
9
|
export { log };
|
|
10
10
|
// Helper function to detect if running in CI environment
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./setWebpackRequire";
|
|
2
|
-
export { ClientOnly } from "./ClientOnly.js";
|
|
3
2
|
export { default as React } from "react";
|
|
4
|
-
|
|
3
|
+
export { ClientOnly } from "./ClientOnly.js";
|
|
4
|
+
import type { HydrationOptions, Transport } from "./types";
|
|
5
5
|
export declare const fetchTransport: Transport;
|
|
6
6
|
export declare const initClient: ({ transport, hydrateRootOptions, handleResponse, }?: {
|
|
7
7
|
transport?: Transport;
|
|
@@ -7,10 +7,10 @@ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
|
7
7
|
import "./setWebpackRequire";
|
|
8
8
|
import React from "react";
|
|
9
9
|
import { hydrateRoot } from "react-dom/client";
|
|
10
|
-
import {
|
|
10
|
+
import { createFromFetch, createFromReadableStream, encodeReply, } from "react-server-dom-webpack/client.browser";
|
|
11
11
|
import { rscStream } from "rsc-html-stream/client";
|
|
12
|
-
export { ClientOnly } from "./ClientOnly.js";
|
|
13
12
|
export { default as React } from "react";
|
|
13
|
+
export { ClientOnly } from "./ClientOnly.js";
|
|
14
14
|
export const fetchTransport = (transportContext) => {
|
|
15
15
|
const fetchCallServer = async (id, args) => {
|
|
16
16
|
const url = new URL(window.location.href);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CallServerCallback } from "react-server-dom-webpack/client.browser";
|
|
2
|
-
export type { CallServerCallback } from "react-server-dom-webpack/client.browser";
|
|
3
2
|
export type { HydrationOptions } from "react-dom/client";
|
|
3
|
+
export type { CallServerCallback } from "react-server-dom-webpack/client.browser";
|
|
4
4
|
export type ActionResponse<Result> = {
|
|
5
5
|
node: React.ReactNode;
|
|
6
6
|
actionResult: Result;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./types/client";
|
|
2
2
|
export * from "../client/client";
|
|
3
|
-
export * from "../register/client";
|
|
4
|
-
export * from "../lib/streams/consumeEventStream";
|
|
5
3
|
export * from "../client/navigation";
|
|
4
|
+
export * from "../lib/streams/consumeEventStream";
|
|
5
|
+
export * from "../register/client";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./types/client";
|
|
2
2
|
export * from "../client/client";
|
|
3
|
-
export * from "../register/client";
|
|
4
|
-
export * from "../lib/streams/consumeEventStream";
|
|
5
3
|
export * from "../client/navigation";
|
|
4
|
+
export * from "../lib/streams/consumeEventStream";
|
|
5
|
+
export * from "../register/client";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "./types/worker";
|
|
2
|
-
export * from "../register/worker";
|
|
3
|
-
export * from "../worker";
|
|
4
2
|
export * from "../error";
|
|
5
|
-
export * from "../script";
|
|
6
3
|
export * from "../lib/utils";
|
|
4
|
+
export * from "../register/worker";
|
|
5
|
+
export * from "../render/renderToStream";
|
|
6
|
+
export * from "../render/renderToString";
|
|
7
7
|
export * from "../requestInfo/types";
|
|
8
8
|
export * from "../requestInfo/worker";
|
|
9
|
-
export * from "../
|
|
10
|
-
export * from "../
|
|
9
|
+
export * from "../script";
|
|
10
|
+
export * from "../worker";
|