@warlock.js/core 5.34.3 → 5.36.0
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/CHANGELOG.md +69 -0
- package/esm/cli/cli-commands.manager.mjs +1 -1
- package/esm/cli/cli-commands.manager.mjs.map +1 -1
- package/esm/cli/commands/add.command.mjs +1 -0
- package/esm/cli/commands/add.command.mjs.map +1 -1
- package/esm/cli/commands/build.command.mjs +30 -3
- package/esm/cli/commands/build.command.mjs.map +1 -1
- package/esm/cli/commands/check/check-command.action.mjs +1 -0
- package/esm/cli/commands/check/check-command.action.mjs.map +1 -1
- package/esm/cli/commands/check.command.mjs +5 -0
- package/esm/cli/commands/check.command.mjs.map +1 -1
- package/esm/cli/commands/explain/explain-command.action.mjs +21 -0
- package/esm/cli/commands/explain/explain-command.action.mjs.map +1 -1
- package/esm/cli/commands/explain.command.mjs +14 -4
- package/esm/cli/commands/explain.command.mjs.map +1 -1
- package/esm/cli/commands/generate/generate.command.mjs +19 -1
- package/esm/cli/commands/generate/generate.command.mjs.map +1 -1
- package/esm/cli/commands/generate/generators/endpoint.generator.mjs +1 -1
- package/esm/cli/commands/generate/generators/endpoint.generator.mjs.map +1 -1
- package/esm/cli/commands/generate/generators/web.generator.mjs +169 -0
- package/esm/cli/commands/generate/generators/web.generator.mjs.map +1 -0
- package/esm/cli/commands/generate/templates/web-stubs.mjs +231 -0
- package/esm/cli/commands/generate/templates/web-stubs.mjs.map +1 -0
- package/esm/cli/commands/inspect/inspect-command.action.mjs +4 -3
- package/esm/cli/commands/inspect/inspect-command.action.mjs.map +1 -1
- package/esm/cli/commands/inspect.command.mjs +13 -8
- package/esm/cli/commands/inspect.command.mjs.map +1 -1
- package/esm/cli/commands/mcp/mcp-command.action.mjs +1 -1
- package/esm/cli/commands/mcp/mcp-command.action.mjs.map +1 -1
- package/esm/config/config-loader.d.mts.map +1 -1
- package/esm/config/config-loader.mjs +2 -0
- package/esm/config/config-loader.mjs.map +1 -1
- package/esm/config/load-config-files.mjs +4 -0
- package/esm/config/load-config-files.mjs.map +1 -1
- package/esm/dev-server/file-event-handler.mjs +11 -1
- package/esm/dev-server/file-event-handler.mjs.map +1 -1
- package/esm/dev-server/file-manager.d.mts +1 -1
- package/esm/dev-server/file-manager.d.mts.map +1 -1
- package/esm/dev-server/file-manager.mjs.map +1 -1
- package/esm/dev-server/files-orchestrator.mjs +16 -1
- package/esm/dev-server/files-orchestrator.mjs.map +1 -1
- package/esm/dev-server/files-watcher.mjs +13 -4
- package/esm/dev-server/files-watcher.mjs.map +1 -1
- package/esm/dev-server/loader/loader-port-acks.mjs +21 -9
- package/esm/dev-server/loader/loader-port-acks.mjs.map +1 -1
- package/esm/dev-server/loader/register-loader.mjs +31 -12
- package/esm/dev-server/loader/register-loader.mjs.map +1 -1
- package/esm/dev-server/module-loader.mjs +15 -1
- package/esm/dev-server/module-loader.mjs.map +1 -1
- package/esm/dev-server/parse-imports.mjs +1 -1
- package/esm/dev-server/special-file-patterns.mjs +4 -1
- package/esm/dev-server/special-file-patterns.mjs.map +1 -1
- package/esm/dev-server/type-generator.mjs +1 -1
- package/esm/e2e/cdp.d.mts.map +1 -1
- package/esm/e2e/cdp.mjs +9 -2
- package/esm/e2e/cdp.mjs.map +1 -1
- package/esm/e2e/index.d.mts +2 -2
- package/esm/e2e/page.d.mts +14 -1
- package/esm/e2e/page.d.mts.map +1 -1
- package/esm/e2e/page.mjs +81 -8
- package/esm/e2e/page.mjs.map +1 -1
- package/esm/e2e/types.d.mts +49 -0
- package/esm/e2e/types.d.mts.map +1 -1
- package/esm/e2e/types.mjs.map +1 -1
- package/esm/errors/error-codes.d.mts +72 -0
- package/esm/errors/error-codes.d.mts.map +1 -1
- package/esm/errors/error-codes.mjs +72 -0
- package/esm/errors/error-codes.mjs.map +1 -1
- package/esm/errors/index.d.mts +2 -2
- package/esm/errors/index.mjs +2 -2
- package/esm/generations/add-command.action.mjs +2 -0
- package/esm/generations/add-command.action.mjs.map +1 -1
- package/esm/generations/design-system-payload.mjs +53 -0
- package/esm/generations/design-system-payload.mjs.map +1 -0
- package/esm/generations/features/design-system.feature.mjs +38 -0
- package/esm/generations/features/design-system.feature.mjs.map +1 -0
- package/esm/generations/features/index.mjs +3 -1
- package/esm/generations/features/index.mjs.map +1 -1
- package/esm/generations/features/notifications.feature.mjs +13 -2
- package/esm/generations/features/notifications.feature.mjs.map +1 -1
- package/esm/generations/features/test.feature.mjs +48 -13
- package/esm/generations/features/test.feature.mjs.map +1 -1
- package/esm/generations/features/web.feature.mjs +3 -3
- package/esm/generations/features/web.feature.mjs.map +1 -1
- package/esm/generations/stubs.mjs +9 -5
- package/esm/generations/stubs.mjs.map +1 -1
- package/esm/http/error-mapper.d.mts +1 -1
- package/esm/http/error-mapper.mjs +3 -3
- package/esm/http/error-mapper.mjs.map +1 -1
- package/esm/http/error-response.d.mts +3 -0
- package/esm/http/error-response.d.mts.map +1 -1
- package/esm/http/error-response.mjs +8 -2
- package/esm/http/error-response.mjs.map +1 -1
- package/esm/http/errors/errors.d.mts +8 -0
- package/esm/http/errors/errors.d.mts.map +1 -1
- package/esm/http/errors/errors.mjs +13 -1
- package/esm/http/errors/errors.mjs.map +1 -1
- package/esm/http/index.d.mts +3 -2
- package/esm/http/index.mjs +3 -2
- package/esm/http/list-endpoint.d.mts +35 -0
- package/esm/http/list-endpoint.d.mts.map +1 -0
- package/esm/http/list-endpoint.mjs +28 -0
- package/esm/http/list-endpoint.mjs.map +1 -0
- package/esm/http/middleware/inject-request-context.d.mts.map +1 -1
- package/esm/http/middleware/inject-request-context.mjs +12 -2
- package/esm/http/middleware/inject-request-context.mjs.map +1 -1
- package/esm/http/server.mjs +1 -1
- package/esm/index.d.mts +10 -6
- package/esm/index.mjs +5 -2
- package/esm/localization/index.mjs +3 -1
- package/esm/localization/translation-usage-graph.d.mts +49 -0
- package/esm/localization/translation-usage-graph.d.mts.map +1 -0
- package/esm/localization/translation-usage-graph.mjs +128 -0
- package/esm/localization/translation-usage-graph.mjs.map +1 -0
- package/esm/localization/translation-usage.d.mts +85 -0
- package/esm/localization/translation-usage.d.mts.map +1 -0
- package/esm/localization/translation-usage.mjs +307 -0
- package/esm/localization/translation-usage.mjs.map +1 -0
- package/esm/openapi/security.mjs +12 -4
- package/esm/openapi/security.mjs.map +1 -1
- package/esm/openapi/types.d.mts +2 -0
- package/esm/openapi/types.d.mts.map +1 -1
- package/esm/production/build-budgets.d.mts +64 -0
- package/esm/production/build-budgets.d.mts.map +1 -0
- package/esm/production/build-budgets.mjs +109 -0
- package/esm/production/build-budgets.mjs.map +1 -0
- package/esm/production/production-builder.mjs +13 -1
- package/esm/production/production-builder.mjs.map +1 -1
- package/esm/production/resolve-build-config.d.mts +1 -1
- package/esm/production/resolve-build-config.d.mts.map +1 -1
- package/esm/production/resolve-build-config.mjs.map +1 -1
- package/esm/production/route-registration-snapshot.mjs +5 -3
- package/esm/production/route-registration-snapshot.mjs.map +1 -1
- package/esm/restful/restful.d.mts +1 -1
- package/esm/router/router.d.mts +2 -0
- package/esm/router/router.d.mts.map +1 -1
- package/esm/router/router.mjs +4 -1
- package/esm/router/router.mjs.map +1 -1
- package/esm/router/types.d.mts +19 -0
- package/esm/router/types.d.mts.map +1 -1
- package/esm/tests/fakes/storage-fake.d.mts +3 -1
- package/esm/tests/fakes/storage-fake.d.mts.map +1 -1
- package/esm/tests/fakes/storage-fake.mjs +3 -3
- package/esm/tests/fakes/storage-fake.mjs.map +1 -1
- package/esm/tests/fakes/test-fakes.d.mts +3 -1
- package/esm/tests/fakes/test-fakes.d.mts.map +1 -1
- package/esm/tests/fakes/test-fakes.mjs +3 -2
- package/esm/tests/fakes/test-fakes.mjs.map +1 -1
- package/esm/tests/index.d.mts +4 -2
- package/esm/tests/index.mjs +3 -1
- package/esm/tests/load-unit-config.mjs +24 -0
- package/esm/tests/load-unit-config.mjs.map +1 -0
- package/esm/tests/response-contract.d.mts +32 -0
- package/esm/tests/response-contract.d.mts.map +1 -0
- package/esm/tests/response-contract.mjs +116 -0
- package/esm/tests/response-contract.mjs.map +1 -0
- package/esm/tests/start-http-development-server.d.mts.map +1 -1
- package/esm/tests/start-http-development-server.mjs +10 -2
- package/esm/tests/start-http-development-server.mjs.map +1 -1
- package/esm/tests/test-lifecycle-state.mjs.map +1 -1
- package/esm/tests/test-locales.mjs +33 -0
- package/esm/tests/test-locales.mjs.map +1 -0
- package/esm/tests/test-runtime-scope.d.mts +15 -0
- package/esm/tests/test-runtime-scope.d.mts.map +1 -0
- package/esm/tests/test-runtime-scope.mjs +80 -0
- package/esm/tests/test-runtime-scope.mjs.map +1 -0
- package/esm/tests/vitest-setup.d.mts +13 -3
- package/esm/tests/vitest-setup.d.mts.map +1 -1
- package/esm/tests/vitest-setup.mjs +146 -18
- package/esm/tests/vitest-setup.mjs.map +1 -1
- package/esm/tooling/check/affected-files.d.mts +5 -0
- package/esm/tooling/check/affected-files.d.mts.map +1 -0
- package/esm/tooling/check/affected-files.mjs +56 -0
- package/esm/tooling/check/affected-files.mjs.map +1 -0
- package/esm/tooling/check/api-route-references.d.mts +16 -0
- package/esm/tooling/check/api-route-references.d.mts.map +1 -0
- package/esm/tooling/check/api-route-references.mjs +146 -0
- package/esm/tooling/check/api-route-references.mjs.map +1 -0
- package/esm/tooling/check/changed-files.d.mts +2 -0
- package/esm/tooling/check/changed-files.d.mts.map +1 -1
- package/esm/tooling/check/changed-files.mjs +2 -2
- package/esm/tooling/check/changed-files.mjs.map +1 -1
- package/esm/tooling/check/conventions-step.d.mts +7 -3
- package/esm/tooling/check/conventions-step.d.mts.map +1 -1
- package/esm/tooling/check/conventions-step.mjs +59 -8
- package/esm/tooling/check/conventions-step.mjs.map +1 -1
- package/esm/tooling/check/fixes.d.mts +8 -0
- package/esm/tooling/check/fixes.d.mts.map +1 -0
- package/esm/tooling/check/fixes.mjs +31 -0
- package/esm/tooling/check/fixes.mjs.map +1 -0
- package/esm/tooling/check/index.d.mts +12 -0
- package/esm/tooling/check/index.mjs +3 -2
- package/esm/tooling/check/run-check.d.mts +2 -0
- package/esm/tooling/check/run-check.d.mts.map +1 -1
- package/esm/tooling/check/run-check.mjs +23 -5
- package/esm/tooling/check/run-check.mjs.map +1 -1
- package/esm/tooling/check/run-tests.mjs +1 -1
- package/esm/tooling/check/source-ast.d.mts +1 -0
- package/esm/tooling/check/translation-conventions.mjs +32 -0
- package/esm/tooling/check/translation-conventions.mjs.map +1 -0
- package/esm/tooling/check/web-conventions.d.mts +10 -0
- package/esm/tooling/check/web-conventions.d.mts.map +1 -0
- package/esm/tooling/check/web-conventions.mjs +126 -0
- package/esm/tooling/check/web-conventions.mjs.map +1 -0
- package/esm/tooling/index.d.mts +7 -2
- package/esm/tooling/index.mjs +4 -2
- package/esm/tooling/inspect/collect-files.mjs +172 -0
- package/esm/tooling/inspect/collect-files.mjs.map +1 -0
- package/esm/tooling/inspect/collect-pages.mjs +3 -2
- package/esm/tooling/inspect/collect-pages.mjs.map +1 -1
- package/esm/tooling/inspect/collect-routes.mjs +1 -1
- package/esm/tooling/inspect/collect-routes.mjs.map +1 -1
- package/esm/tooling/inspect/explain-file.d.mts +12 -0
- package/esm/tooling/inspect/explain-file.d.mts.map +1 -0
- package/esm/tooling/inspect/explain-file.mjs +45 -0
- package/esm/tooling/inspect/explain-file.mjs.map +1 -0
- package/esm/tooling/inspect/index.d.mts +3 -2
- package/esm/tooling/inspect/index.mjs +2 -1
- package/esm/tooling/inspect/inspect-app.d.mts.map +1 -1
- package/esm/tooling/inspect/inspect-app.mjs +9 -3
- package/esm/tooling/inspect/inspect-app.mjs.map +1 -1
- package/esm/tooling/inspect/inspect-report.schema.mjs +34 -1
- package/esm/tooling/inspect/inspect-report.schema.mjs.map +1 -1
- package/esm/tooling/inspect/inspect-report.types.d.mts +17 -1
- package/esm/tooling/inspect/inspect-report.types.d.mts.map +1 -1
- package/esm/tooling/inspect/inspect-report.types.mjs +2 -1
- package/esm/tooling/inspect/inspect-report.types.mjs.map +1 -1
- package/esm/tooling/mcp/mcp-tools.d.mts.map +1 -1
- package/esm/tooling/mcp/mcp-tools.mjs +8 -2
- package/esm/tooling/mcp/mcp-tools.mjs.map +1 -1
- package/esm/tooling/problem.d.mts +4 -0
- package/esm/tooling/problem.d.mts.map +1 -1
- package/esm/tooling/problem.mjs +1 -0
- package/esm/tooling/problem.mjs.map +1 -1
- package/esm/tooling/syntax/ast.d.mts +2 -0
- package/esm/tooling/typecheck/run-typecheck.mjs +5 -1
- package/esm/tooling/typecheck/run-typecheck.mjs.map +1 -1
- package/esm/upgrade/codemods/index.mjs +2 -0
- package/esm/upgrade/codemods/index.mjs.map +1 -1
- package/esm/upgrade/codemods/vite-vitest.mjs +170 -0
- package/esm/upgrade/codemods/vite-vitest.mjs.map +1 -0
- package/esm/upgrade/notes.mjs +4 -0
- package/esm/upgrade/notes.mjs.map +1 -1
- package/esm/vite/index.d.mts +3 -1
- package/esm/vite/index.mjs +3 -1
- package/esm/vite/test-setup-reporter.d.mts +16 -0
- package/esm/vite/test-setup-reporter.d.mts.map +1 -0
- package/esm/vite/test-setup-reporter.mjs +55 -0
- package/esm/vite/test-setup-reporter.mjs.map +1 -0
- package/esm/vite/test-workers.d.mts +5 -0
- package/esm/vite/test-workers.d.mts.map +1 -0
- package/esm/vite/test-workers.mjs +38 -0
- package/esm/vite/test-workers.mjs.map +1 -0
- package/esm/warlock-config/index.d.mts +2 -1
- package/esm/warlock-config/types.d.mts +3 -0
- package/esm/warlock-config/types.d.mts.map +1 -1
- package/llms-full.txt +874 -9
- package/llms.txt +2 -0
- package/package.json +15 -14
- package/schemas/inspect-report.schema.json +47 -1
- package/skills/build-budgets/SKILL.md +51 -0
- package/skills/build-restful/SKILL.md +56 -0
- package/skills/configure-app/SKILL.md +7 -0
- package/skills/create-module/SKILL.md +9 -0
- package/skills/generate-web-ui/SKILL.md +71 -0
- package/skills/index.md +2 -2
- package/skills/register-route/SKILL.md +13 -0
- package/skills/run-app/SKILL.md +1 -1
- package/skills/send-mail/SKILL.md +25 -0
- package/skills/send-response/SKILL.md +50 -0
- package/skills/test-browser/SKILL.md +53 -0
- package/skills/test-http/SKILL.md +91 -0
- package/skills/test-service/SKILL.md +161 -3
- package/skills/upgrade-from-5-29/SKILL.md +109 -0
- package/skills/use-localization/SKILL.md +25 -0
- package/skills/warlock-check/SKILL.md +75 -1
- package/skills/warlock-inspect/SKILL.md +45 -2
- package/skills/warlock-mcp/SKILL.md +4 -0
- package/skills/write-cli-command/SKILL.md +18 -0
- package/esm/production/build-app-production.mjs +0 -14
- package/esm/production/build-app-production.mjs.map +0 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
//#region ../../packages/core/src/vite/test-setup-reporter.ts
|
|
2
|
+
/** Vitest reporter shape, with no runtime dependency on Vitest in the config helper. */
|
|
3
|
+
var TestSetupReporter = class {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.files = 0;
|
|
6
|
+
this.bootstraps = 0;
|
|
7
|
+
this.workers = /* @__PURE__ */ new Set();
|
|
8
|
+
this.totals = {};
|
|
9
|
+
this.shutdowns = /* @__PURE__ */ new Map();
|
|
10
|
+
}
|
|
11
|
+
onTestRunStart() {
|
|
12
|
+
this.files = 0;
|
|
13
|
+
this.bootstraps = 0;
|
|
14
|
+
this.workers.clear();
|
|
15
|
+
this.totals = {};
|
|
16
|
+
this.shutdowns.clear();
|
|
17
|
+
}
|
|
18
|
+
onUserConsoleLog(log) {
|
|
19
|
+
for (const line of log.content.split("\n")) {
|
|
20
|
+
const file = line.startsWith("[warlock:test] file=");
|
|
21
|
+
const summary = line.startsWith("[warlock:test] summary ");
|
|
22
|
+
if (!file && !summary) continue;
|
|
23
|
+
const marker = line.lastIndexOf("pid=");
|
|
24
|
+
if (marker === -1) continue;
|
|
25
|
+
const [pid, ...parts] = line.slice(marker + 4).trim().split(/\s+/);
|
|
26
|
+
if (!pid || !/^\d+$/.test(pid)) continue;
|
|
27
|
+
const steps = {};
|
|
28
|
+
for (const part of parts) {
|
|
29
|
+
const match = /^([a-zA-Z]+)=(\d+(?:\.\d+)?)ms$/.exec(part);
|
|
30
|
+
if (match?.[1] && match[2]) steps[match[1]] = Number(match[2]);
|
|
31
|
+
}
|
|
32
|
+
if (summary) {
|
|
33
|
+
if (steps.shutdown !== void 0) this.shutdowns.set(pid, steps.shutdown);
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
this.workers.add(pid);
|
|
37
|
+
this.files += 1;
|
|
38
|
+
if (steps.bootstrap !== void 0) this.bootstraps += 1;
|
|
39
|
+
for (const [step, ms] of Object.entries(steps)) this.totals[step] = (this.totals[step] ?? 0) + ms;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
onTestRunEnd() {
|
|
43
|
+
if (!this.files) return;
|
|
44
|
+
const shutdown = [...this.shutdowns.values()].reduce((sum, ms) => sum + ms, 0);
|
|
45
|
+
const steps = Object.entries({
|
|
46
|
+
...this.totals,
|
|
47
|
+
shutdown
|
|
48
|
+
}).map(([step, ms]) => `${step}=${ms.toFixed(2)}ms`).join(" ");
|
|
49
|
+
console.info(`[warlock:test] run summary files=${this.files} workers=${this.workers.size} bootstraps=${this.bootstraps} ${steps}`);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
export { TestSetupReporter };
|
|
55
|
+
//# sourceMappingURL=test-setup-reporter.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-setup-reporter.mjs","names":[],"sources":["../../../../../../../../packages/core/src/vite/test-setup-reporter.ts"],"sourcesContent":["/** Vitest reporter shape, with no runtime dependency on Vitest in the config helper. */\nexport class TestSetupReporter {\n private files = 0;\n private bootstraps = 0;\n private workers = new Set<string>();\n private totals: Record<string, number> = {};\n private shutdowns = new Map<string, number>();\n\n public onTestRunStart(): void {\n this.files = 0;\n this.bootstraps = 0;\n this.workers.clear();\n this.totals = {};\n this.shutdowns.clear();\n }\n\n public onUserConsoleLog(log: { content: string }): void {\n for (const line of log.content.split(\"\\n\")) {\n const file = line.startsWith(\"[warlock:test] file=\");\n const summary = line.startsWith(\"[warlock:test] summary \");\n if (!file && !summary) continue;\n const marker = line.lastIndexOf(\"pid=\");\n if (marker === -1) continue;\n const [pid, ...parts] = line\n .slice(marker + 4)\n .trim()\n .split(/\\s+/);\n if (!pid || !/^\\d+$/.test(pid)) continue;\n const steps: Record<string, number> = {};\n for (const part of parts) {\n const match = /^([a-zA-Z]+)=(\\d+(?:\\.\\d+)?)ms$/.exec(part);\n if (match?.[1] && match[2]) steps[match[1]] = Number(match[2]);\n }\n if (summary) {\n if (steps.shutdown !== undefined) this.shutdowns.set(pid, steps.shutdown);\n continue;\n }\n this.workers.add(pid);\n this.files += 1;\n if (steps.bootstrap !== undefined) this.bootstraps += 1;\n for (const [step, ms] of Object.entries(steps))\n this.totals[step] = (this.totals[step] ?? 0) + ms;\n }\n }\n\n public onTestRunEnd(): void {\n if (!this.files) return;\n const shutdown = [...this.shutdowns.values()].reduce((sum, ms) => sum + ms, 0);\n const steps = Object.entries({ ...this.totals, shutdown })\n .map(([step, ms]) => `${step}=${ms.toFixed(2)}ms`)\n .join(\" \");\n console.info(\n `[warlock:test] run summary files=${this.files} workers=${this.workers.size} bootstraps=${this.bootstraps} ${steps}`,\n );\n }\n}\n"],"mappings":";;AACA,IAAa,oBAAb,MAA+B;;eACb;oBACK;iCACH,IAAI,IAAY;gBACO,CAAC;mCACtB,IAAI,IAAoB;;CAE5C,AAAO,iBAAuB;EAC5B,KAAK,QAAQ;EACb,KAAK,aAAa;EAClB,KAAK,QAAQ,MAAM;EACnB,KAAK,SAAS,CAAC;EACf,KAAK,UAAU,MAAM;CACvB;CAEA,AAAO,iBAAiB,KAAgC;EACtD,KAAK,MAAM,QAAQ,IAAI,QAAQ,MAAM,IAAI,GAAG;GAC1C,MAAM,OAAO,KAAK,WAAW,sBAAsB;GACnD,MAAM,UAAU,KAAK,WAAW,yBAAyB;GACzD,IAAI,CAAC,QAAQ,CAAC,SAAS;GACvB,MAAM,SAAS,KAAK,YAAY,MAAM;GACtC,IAAI,WAAW,IAAI;GACnB,MAAM,CAAC,KAAK,GAAG,SAAS,KACrB,MAAM,SAAS,CAAC,CAAC,CACjB,KAAK,CAAC,CACN,MAAM,KAAK;GACd,IAAI,CAAC,OAAO,CAAC,QAAQ,KAAK,GAAG,GAAG;GAChC,MAAM,QAAgC,CAAC;GACvC,KAAK,MAAM,QAAQ,OAAO;IACxB,MAAM,QAAQ,kCAAkC,KAAK,IAAI;IACzD,IAAI,QAAQ,MAAM,MAAM,IAAI,MAAM,MAAM,MAAM,OAAO,MAAM,EAAE;GAC/D;GACA,IAAI,SAAS;IACX,IAAI,MAAM,aAAa,QAAW,KAAK,UAAU,IAAI,KAAK,MAAM,QAAQ;IACxE;GACF;GACA,KAAK,QAAQ,IAAI,GAAG;GACpB,KAAK,SAAS;GACd,IAAI,MAAM,cAAc,QAAW,KAAK,cAAc;GACtD,KAAK,MAAM,CAAC,MAAM,OAAO,OAAO,QAAQ,KAAK,GAC3C,KAAK,OAAO,SAAS,KAAK,OAAO,SAAS,KAAK;EACnD;CACF;CAEA,AAAO,eAAqB;EAC1B,IAAI,CAAC,KAAK,OAAO;EACjB,MAAM,WAAW,CAAC,GAAG,KAAK,UAAU,OAAO,CAAC,CAAC,CAAC,QAAQ,KAAK,OAAO,MAAM,IAAI,CAAC;EAC7E,MAAM,QAAQ,OAAO,QAAQ;GAAE,GAAG,KAAK;GAAQ;EAAS,CAAC,CAAC,CACvD,KAAK,CAAC,MAAM,QAAQ,GAAG,KAAK,GAAG,GAAG,QAAQ,CAAC,EAAE,GAAG,CAAC,CACjD,KAAK,GAAG;EACX,QAAQ,KACN,oCAAoC,KAAK,MAAM,WAAW,KAAK,QAAQ,KAAK,cAAc,KAAK,WAAW,GAAG,OAC/G;CACF;AACF"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
//#region ../../packages/core/src/vite/test-workers.d.ts
|
|
2
|
+
/** Limit Vitest forks to both CPU affinity and the tightest visible cgroup v2 quota. */
|
|
3
|
+
export declare function recommendedTestWorkers(parallelism?: number, read?: (file: string) => string): number;
|
|
4
|
+
//#endregion
|
|
5
|
+
//# sourceMappingURL=test-workers.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-workers.d.mts","names":[],"sources":["../../../../../../../../packages/core/src/vite/test-workers.ts"],"mappings":";;wBAqBgB,uBACd,sBACA,QAAO"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { availableParallelism } from "node:os";
|
|
4
|
+
|
|
5
|
+
//#region ../../packages/core/src/vite/test-workers.ts
|
|
6
|
+
/** cgroup v2 cpu.max: quota microseconds / period microseconds; round down to avoid oversubscription. */
|
|
7
|
+
function cpuQuotaWorkers(value) {
|
|
8
|
+
const [quota, period] = value.trim().split(/\s+/);
|
|
9
|
+
if (quota === "max") return void 0;
|
|
10
|
+
const quotaNumber = Number(quota);
|
|
11
|
+
const periodNumber = Number(period);
|
|
12
|
+
if (!Number.isFinite(quotaNumber) || !Number.isFinite(periodNumber) || quotaNumber <= 0 || periodNumber <= 0) return void 0;
|
|
13
|
+
return Math.max(1, Math.floor(quotaNumber / periodNumber));
|
|
14
|
+
}
|
|
15
|
+
/** Limit Vitest forks to both CPU affinity and the tightest visible cgroup v2 quota. */
|
|
16
|
+
function recommendedTestWorkers(parallelism = availableParallelism(), read = (file) => readFileSync(file, "utf8")) {
|
|
17
|
+
let workers = Math.max(1, Math.floor(parallelism));
|
|
18
|
+
const root = "/sys/fs/cgroup";
|
|
19
|
+
let directory = root;
|
|
20
|
+
try {
|
|
21
|
+
const entry = read("/proc/self/cgroup").split("\n").find((line) => line.startsWith("0::"));
|
|
22
|
+
if (entry) directory = path.resolve(root, `.${entry.slice(3)}`);
|
|
23
|
+
if (directory !== root && !directory.startsWith(`${root}/`)) directory = root;
|
|
24
|
+
} catch {}
|
|
25
|
+
for (;;) {
|
|
26
|
+
try {
|
|
27
|
+
const quota = cpuQuotaWorkers(read(path.join(directory, "cpu.max")));
|
|
28
|
+
if (quota !== void 0) workers = Math.min(workers, quota);
|
|
29
|
+
} catch {}
|
|
30
|
+
if (directory === root) break;
|
|
31
|
+
directory = path.dirname(directory);
|
|
32
|
+
}
|
|
33
|
+
return workers;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
export { cpuQuotaWorkers, recommendedTestWorkers };
|
|
38
|
+
//# sourceMappingURL=test-workers.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-workers.mjs","names":[],"sources":["../../../../../../../../packages/core/src/vite/test-workers.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { availableParallelism } from \"node:os\";\nimport path from \"node:path\";\n\n/** cgroup v2 cpu.max: quota microseconds / period microseconds; round down to avoid oversubscription. */\nexport function cpuQuotaWorkers(value: string): number | undefined {\n const [quota, period] = value.trim().split(/\\s+/);\n if (quota === \"max\") return undefined;\n const quotaNumber = Number(quota);\n const periodNumber = Number(period);\n if (\n !Number.isFinite(quotaNumber) ||\n !Number.isFinite(periodNumber) ||\n quotaNumber <= 0 ||\n periodNumber <= 0\n )\n return undefined;\n return Math.max(1, Math.floor(quotaNumber / periodNumber));\n}\n\n/** Limit Vitest forks to both CPU affinity and the tightest visible cgroup v2 quota. */\nexport function recommendedTestWorkers(\n parallelism = availableParallelism(),\n read: (file: string) => string = (file) => readFileSync(file, \"utf8\"),\n): number {\n let workers = Math.max(1, Math.floor(parallelism));\n const root = \"/sys/fs/cgroup\";\n let directory = root;\n try {\n const entry = read(\"/proc/self/cgroup\")\n .split(\"\\n\")\n .find((line) => line.startsWith(\"0::\"));\n if (entry) directory = path.resolve(root, `.${entry.slice(3)}`);\n if (directory !== root && !directory.startsWith(`${root}/`)) directory = root;\n } catch {\n /* Non-Linux hosts use CPU affinity. */\n }\n for (;;) {\n try {\n const quota = cpuQuotaWorkers(read(path.join(directory, \"cpu.max\")));\n if (quota !== undefined) workers = Math.min(workers, quota);\n } catch {\n /* Missing/unreadable quotas do not replace the affinity limit. */\n }\n if (directory === root) break;\n directory = path.dirname(directory);\n }\n return workers;\n}\n"],"mappings":";;;;;;AAKA,SAAgB,gBAAgB,OAAmC;CACjE,MAAM,CAAC,OAAO,UAAU,MAAM,KAAK,CAAC,CAAC,MAAM,KAAK;CAChD,IAAI,UAAU,OAAO,OAAO;CAC5B,MAAM,cAAc,OAAO,KAAK;CAChC,MAAM,eAAe,OAAO,MAAM;CAClC,IACE,CAAC,OAAO,SAAS,WAAW,KAC5B,CAAC,OAAO,SAAS,YAAY,KAC7B,eAAe,KACf,gBAAgB,GAEhB,OAAO;CACT,OAAO,KAAK,IAAI,GAAG,KAAK,MAAM,cAAc,YAAY,CAAC;AAC3D;;AAGA,SAAgB,uBACd,cAAc,qBAAqB,GACnC,QAAkC,SAAS,aAAa,MAAM,MAAM,GAC5D;CACR,IAAI,UAAU,KAAK,IAAI,GAAG,KAAK,MAAM,WAAW,CAAC;CACjD,MAAM,OAAO;CACb,IAAI,YAAY;CAChB,IAAI;EACF,MAAM,QAAQ,KAAK,mBAAmB,CAAC,CACpC,MAAM,IAAI,CAAC,CACX,MAAM,SAAS,KAAK,WAAW,KAAK,CAAC;EACxC,IAAI,OAAO,YAAY,KAAK,QAAQ,MAAM,IAAI,MAAM,MAAM,CAAC,GAAG;EAC9D,IAAI,cAAc,QAAQ,CAAC,UAAU,WAAW,GAAG,KAAK,EAAE,GAAG,YAAY;CAC3E,QAAQ,CAER;CACA,SAAS;EACP,IAAI;GACF,MAAM,QAAQ,gBAAgB,KAAK,KAAK,KAAK,WAAW,SAAS,CAAC,CAAC;GACnE,IAAI,UAAU,QAAW,UAAU,KAAK,IAAI,SAAS,KAAK;EAC5D,QAAQ,CAER;EACA,IAAI,cAAc,MAAM;EACxB,YAAY,KAAK,QAAQ,SAAS;CACpC;CACA,OAAO;AACT"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import { BudgetPage, BudgetViolation, BuildBudgetReport, BuildBudgets, PageBudget, PayloadBudget } from "../production/build-budgets.mjs";
|
|
1
2
|
import { WarlockConfig } from "./types.mjs";
|
|
2
3
|
import { defineConfig } from "./define-config.mjs";
|
|
3
4
|
import { WarlockConfigManager, isUnknownTsExtensionError, isUnresolvedConfigImportError, isUnsupportedTypeStrippingError, warlockConfigManager } from "./warlock-config.manager.mjs";
|
|
4
|
-
export { WarlockConfig, WarlockConfigManager, defineConfig, isUnknownTsExtensionError, isUnresolvedConfigImportError, isUnsupportedTypeStrippingError, warlockConfigManager };
|
|
5
|
+
export { type BudgetPage, type BudgetViolation, type BuildBudgetReport, type BuildBudgets, type PageBudget, type PayloadBudget, WarlockConfig, WarlockConfigManager, defineConfig, isUnknownTsExtensionError, isUnresolvedConfigImportError, isUnsupportedTypeStrippingError, warlockConfigManager };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BuildBudgets } from "../production/build-budgets.mjs";
|
|
1
2
|
import { BuiltInHealthCheckerOptions, FileHealthCheckerContract } from "../dev-server/health-checker/file-health-checker.contract.mjs";
|
|
2
3
|
import { Connector } from "../connectors/types.mjs";
|
|
3
4
|
import { CLICommand } from "../commands/cli-command.mjs";
|
|
@@ -45,6 +46,8 @@ export type WarlockConfig = {
|
|
|
45
46
|
* @default dist
|
|
46
47
|
*/
|
|
47
48
|
outdir?: string;
|
|
49
|
+
/** Per-page compressed client asset limits. Omit for reporting only. */
|
|
50
|
+
budgets?: BuildBudgets;
|
|
48
51
|
/**
|
|
49
52
|
* Alias for {@link outdir}.
|
|
50
53
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","names":[],"sources":["../../../../../../../../packages/core/src/warlock-config/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../../../../../../../../packages/core/src/warlock-config/types.ts"],"mappings":";;;;;;;;;;;;YAeY;;;;EAIV;;;;IAIE;;;;IAIA;;;;IAIA;;;;;;;;;;;;;EAcF,QAAQ,KAAK;;;;;;IAMX;;IAEA,UAAU;;;;;;;;;;;IAWV;;;;;;IAMA;;;;;;;IAOA;;;;;;;;;;;;;;;;;IAiBA;;;;;;;;;;;;;;;;IAgBA;;;;;;IAMA;;;;;;IAMA;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BF,aAAa;;;;EAKb;IACE,WAAW;;;;;EAMb;;;;IAIE;;;;;;MAME;;;;;;MAMA;;;;;;IAMF,iBAAiB,8BAA8B;;;;;IAK/C;;;;;;;;;IASA;;;;;;;;;IASA;;;;;;;;;;IAUA;;;;;;;;;;;;IAYA;;;;;;;;;;IAUA;;;;;;;;;IASA;;MAIM;;MAEA;;MAEA;;;;;;EAOR;;;;;;;;;;;;;;;;;;IAkBE,aAAa,MAAM;;;;;;;;EASrB;;;;;;;;;IASE;;;;;;;;IASA"}
|