@pygmalionjs/pygmalion 0.2.38 → 0.2.40
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/README.md +7 -0
- package/dist-lib/{App-DTeXtV9b.js → App-CiVUoaTo.js} +4619 -4449
- package/dist-lib/pygmalion.js +1105 -1039
- package/dist-lib/testing.js +1 -1
- package/node/design-session.mjs +6 -0
- package/node/dev-mirror.mjs +8 -2
- package/node/dev-view.vite.mjs +4 -0
- package/node/preview-artifact-plugin.mjs +0 -0
- package/node/preview-artifact-store.mjs +653 -0
- package/node/preview-vite-cache.mjs +26 -0
- package/node/route-dependency-digest.mjs +62 -0
- package/node/route-preview-artifact-v3.mjs +44 -16
- package/node/storyboard.mjs +2 -0
- package/node/vite.mjs +6 -0
- package/package.json +4 -1
- package/storyboard.d.ts +1 -0
- package/types.d.ts +4 -0
- package/vite.d.ts +12 -0
package/dist-lib/testing.js
CHANGED
package/node/design-session.mjs
CHANGED
|
@@ -11,6 +11,7 @@ import { normalizeViteMode } from './dev-mirror.mjs';
|
|
|
11
11
|
import { writeStyleEdit, writeTextEdit } from './inspect-plugin.mjs';
|
|
12
12
|
import { createUnifiedDiff } from './source-diff.mjs';
|
|
13
13
|
import { writeSourceOperations } from './source-operations.mjs';
|
|
14
|
+
import { resolvePygmalionPreviewViteCacheDir } from './preview-vite-cache.mjs';
|
|
14
15
|
|
|
15
16
|
const execFileAsync = promisify(execFile);
|
|
16
17
|
|
|
@@ -526,6 +527,11 @@ export function pygmalionDesignSessionPlugin(options) {
|
|
|
526
527
|
PYGMALION_APP_ROOT: sessionAppRoot,
|
|
527
528
|
PYGMALION_VITE_CONFIG: viteConfig,
|
|
528
529
|
PYGMALION_PREVIEW_BASE: `${sessionPreviewPrefix}/`,
|
|
530
|
+
PYGMALION_VITE_CACHE_DIR: resolvePygmalionPreviewViteCacheDir({
|
|
531
|
+
appRoot: sessionAppRoot,
|
|
532
|
+
instance: `session:${session.id}:${session.headSha}`,
|
|
533
|
+
modulesDirectory: dependencies.modulesDirectory,
|
|
534
|
+
}),
|
|
529
535
|
PYGMALION_DEV_FRONTEND_ROOT: sessionAppRoot,
|
|
530
536
|
PYGMALION_DEV_BASE: `${sessionPreviewPrefix}/`,
|
|
531
537
|
},
|
package/node/dev-mirror.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import path from 'node:path';
|
|
|
7
7
|
import { fileURLToPath } from 'node:url';
|
|
8
8
|
import { promisify } from 'node:util';
|
|
9
9
|
import { execFile } from 'node:child_process';
|
|
10
|
+
import { resolvePygmalionPreviewViteCacheDir } from './preview-vite-cache.mjs';
|
|
10
11
|
|
|
11
12
|
const execFileAsync = promisify(execFile);
|
|
12
13
|
|
|
@@ -864,7 +865,7 @@ export function pygmalionDevMirrorPlugin(options) {
|
|
|
864
865
|
await run(command, args, { cwd: path.resolve(inventory.cwd ?? editorRoot) });
|
|
865
866
|
};
|
|
866
867
|
|
|
867
|
-
const startPreview = async (restart) => {
|
|
868
|
+
const startPreview = async (restart, sourceIdentity = ref) => {
|
|
868
869
|
if (restart) await stopPreview();
|
|
869
870
|
if (previewChild && previewChild.exitCode == null && previewPort != null) return;
|
|
870
871
|
|
|
@@ -900,6 +901,11 @@ export function pygmalionDevMirrorPlugin(options) {
|
|
|
900
901
|
PYGMALION_APP_ROOT: mirrorAppRoot,
|
|
901
902
|
PYGMALION_VITE_CONFIG: viteConfig,
|
|
902
903
|
PYGMALION_PREVIEW_BASE: `${prefix}/`,
|
|
904
|
+
PYGMALION_VITE_CACHE_DIR: resolvePygmalionPreviewViteCacheDir({
|
|
905
|
+
appRoot: mirrorAppRoot,
|
|
906
|
+
instance: `mirror:${sourceIdentity}:${prefix}`,
|
|
907
|
+
modulesDirectory: dependencies.modulesDirectory,
|
|
908
|
+
}),
|
|
903
909
|
// Legacy names keep older preview configs working.
|
|
904
910
|
PYGMALION_DEV_FRONTEND_ROOT: mirrorAppRoot,
|
|
905
911
|
PYGMALION_DEV_BASE: `${prefix}/`,
|
|
@@ -963,7 +969,7 @@ export function pygmalionDevMirrorPlugin(options) {
|
|
|
963
969
|
await claimDevMirror(repoRoot, mirrorRoot, ownerToken);
|
|
964
970
|
const dependenciesChanged = await syncDependencies();
|
|
965
971
|
await generateInventory(commit);
|
|
966
|
-
await startPreview(dependenciesChanged);
|
|
972
|
+
await startPreview(dependenciesChanged, commit);
|
|
967
973
|
|
|
968
974
|
revision += 1;
|
|
969
975
|
status = {
|
package/node/dev-view.vite.mjs
CHANGED
|
@@ -14,6 +14,9 @@ const previewBase =
|
|
|
14
14
|
process.env.PYGMALION_PREVIEW_BASE ||
|
|
15
15
|
process.env.PYGMALION_DEV_BASE ||
|
|
16
16
|
'/__pygmalion-dev/';
|
|
17
|
+
const previewCacheDir = process.env.PYGMALION_VITE_CACHE_DIR
|
|
18
|
+
? path.resolve(process.env.PYGMALION_VITE_CACHE_DIR)
|
|
19
|
+
: undefined;
|
|
17
20
|
export const PREVIEW_RUNTIME_DEDUPE = ['react', 'react-dom'];
|
|
18
21
|
|
|
19
22
|
function previewRuntimePlugin() {
|
|
@@ -49,6 +52,7 @@ export default defineConfig(async (env) => {
|
|
|
49
52
|
return mergeConfig(loaded.config, {
|
|
50
53
|
root: appRoot,
|
|
51
54
|
base: previewBase,
|
|
55
|
+
...(previewCacheDir ? { cacheDir: previewCacheDir } : {}),
|
|
52
56
|
resolve: {
|
|
53
57
|
// A host config can resolve editor and application dependencies through
|
|
54
58
|
// different package roots. A preview must still run one React dispatcher;
|
|
Binary file
|