@scenar/cli 0.3.0 → 0.5.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/example-bundle/assets/index-BU7trbqC.js +147 -0
- package/example-bundle/assets/style-COSwl6WP.css +1 -0
- package/example-bundle/index.html +6 -2
- package/example-bundle/pack-manifest.json +8 -8
- package/package.json +4 -9
- package/src/__tests__/embed-snippet.test.ts +1 -1
- package/src/__tests__/install-command.test.ts +97 -0
- package/src/__tests__/local-url.test.ts +17 -0
- package/src/__tests__/pack-generate-embed-entry.test.ts +22 -0
- package/src/__tests__/run-install.test.ts +222 -0
- package/src/__tests__/scenario-validator.test.ts +0 -1
- package/src/api.d.ts +3 -1
- package/src/api.d.ts.map +1 -1
- package/src/api.js +3 -1
- package/src/api.js.map +1 -1
- package/src/api.ts +10 -1
- package/src/commands/install.d.ts +3 -0
- package/src/commands/install.d.ts.map +1 -0
- package/src/commands/install.js +67 -0
- package/src/commands/install.js.map +1 -0
- package/src/commands/install.ts +89 -0
- package/src/commands/pack.js +2 -2
- package/src/commands/pack.js.map +1 -1
- package/src/commands/pack.ts +2 -2
- package/src/commands/serve.d.ts.map +1 -1
- package/src/commands/serve.js +1 -2
- package/src/commands/serve.js.map +1 -1
- package/src/commands/serve.ts +1 -2
- package/src/commands/try.js +1 -1
- package/src/commands/try.ts +1 -1
- package/src/embed/embed-snippet.d.ts.map +1 -0
- package/src/embed/embed-snippet.js.map +1 -0
- package/src/index.d.ts.map +1 -1
- package/src/index.js +3 -5
- package/src/index.js.map +1 -1
- package/src/index.ts +3 -5
- package/src/install/run-install.d.ts +72 -0
- package/src/install/run-install.d.ts.map +1 -0
- package/src/install/run-install.js +378 -0
- package/src/install/run-install.js.map +1 -0
- package/src/install/run-install.ts +461 -0
- package/src/install/scaffold.d.ts +29 -0
- package/src/install/scaffold.d.ts.map +1 -0
- package/src/install/scaffold.js +231 -0
- package/src/install/scaffold.js.map +1 -0
- package/src/install/scaffold.ts +253 -0
- package/src/pack/generate-embed-entry.d.ts +11 -0
- package/src/pack/generate-embed-entry.d.ts.map +1 -1
- package/src/pack/generate-embed-entry.js +34 -0
- package/src/pack/generate-embed-entry.js.map +1 -1
- package/src/pack/generate-embed-entry.ts +35 -0
- package/src/pack/pack-manifest.d.ts +1 -1
- package/src/pack/pack-manifest.d.ts.map +1 -1
- package/src/pack/pack-manifest.ts +1 -1
- package/src/publish/publish-flow.d.ts +3 -3
- package/src/publish/publish-flow.js +3 -3
- package/src/publish/publish-flow.ts +3 -3
- package/src/publish/run-publish.js +1 -1
- package/src/publish/run-publish.js.map +1 -1
- package/src/publish/run-publish.ts +1 -1
- package/src/render/detect-render-export.d.ts +2 -2
- package/src/render/detect-render-export.js +2 -2
- package/src/render/detect-render-export.ts +2 -2
- package/src/serve/local-url.d.ts +8 -0
- package/src/serve/local-url.d.ts.map +1 -0
- package/src/serve/local-url.js +21 -0
- package/src/serve/local-url.js.map +1 -0
- package/src/serve/local-url.ts +20 -0
- package/src/serve/run-serve.js +2 -2
- package/src/serve/run-serve.js.map +1 -1
- package/src/serve/run-serve.ts +2 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/example-bundle/assets/index-BLQ14SEo.js +0 -147
- package/example-bundle/assets/style-Dnzx_jUO.css +0 -1
- package/src/__tests__/deploy-command.test.ts +0 -45
- package/src/__tests__/deploy-flow.test.ts +0 -125
- package/src/__tests__/deploy-upload.test.ts +0 -39
- package/src/commands/deploy.d.ts +0 -3
- package/src/commands/deploy.d.ts.map +0 -1
- package/src/commands/deploy.js +0 -150
- package/src/commands/deploy.js.map +0 -1
- package/src/commands/deploy.ts +0 -186
- package/src/commands/preview.d.ts +0 -3
- package/src/commands/preview.d.ts.map +0 -1
- package/src/commands/preview.js +0 -93
- package/src/commands/preview.js.map +0 -1
- package/src/commands/preview.ts +0 -138
- package/src/deploy/client.d.ts +0 -20
- package/src/deploy/client.d.ts.map +0 -1
- package/src/deploy/client.js +0 -22
- package/src/deploy/client.js.map +0 -1
- package/src/deploy/client.ts +0 -28
- package/src/deploy/deploy-flow.d.ts +0 -78
- package/src/deploy/deploy-flow.d.ts.map +0 -1
- package/src/deploy/deploy-flow.js +0 -53
- package/src/deploy/deploy-flow.js.map +0 -1
- package/src/deploy/deploy-flow.ts +0 -115
- package/src/deploy/embed-snippet.d.ts.map +0 -1
- package/src/deploy/embed-snippet.js.map +0 -1
- package/src/deploy/upload.d.ts +0 -10
- package/src/deploy/upload.d.ts.map +0 -1
- package/src/deploy/upload.js +0 -23
- package/src/deploy/upload.js.map +0 -1
- package/src/deploy/upload.ts +0 -29
- /package/src/{deploy → embed}/embed-snippet.d.ts +0 -0
- /package/src/{deploy → embed}/embed-snippet.js +0 -0
- /package/src/{deploy → embed}/embed-snippet.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack-manifest.d.ts","sourceRoot":"","sources":["../../../src/pack/pack-manifest.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,6EAA6E;AAC7E,MAAM,WAAW,QAAQ;IACvB,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,yBAAyB;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,0EAA0E;IAC1E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED
|
|
1
|
+
{"version":3,"file":"pack-manifest.d.ts","sourceRoot":"","sources":["../../../src/pack/pack-manifest.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,6EAA6E;AAC7E,MAAM,WAAW,QAAQ;IACvB,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,yBAAyB;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,0EAA0E;IAC1E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,+DAA+D;AAC/D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,sDAAsD;IACtD,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC;CAC5B;AAED,kFAAkF;AAClF,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AAEvD,mEAAmE;AACnE,eAAO,MAAM,kBAAkB,kBAAkB,CAAC;AAElD;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,gBAAgB,EAAE,MAAM,EACxB,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,IAAI,CAAC,CAgBf;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CA+BjG;AAED,mDAAmD;AACnD,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAM7F;AAiBD,oFAAoF;AACpF,wBAAsB,wBAAwB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAQpG"}
|
|
@@ -21,7 +21,7 @@ export interface PackFile {
|
|
|
21
21
|
readonly contentType: string;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
/** The deploy instruction file
|
|
24
|
+
/** The deploy instruction file the upload backend consumes. */
|
|
25
25
|
export interface PackManifest {
|
|
26
26
|
readonly schemaVersion: number;
|
|
27
27
|
readonly scenarioId: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GitHub Pages publishing — the OSS "permanent public URL" path of Phase 1.
|
|
3
3
|
*
|
|
4
|
-
* The flow is dependency-injected
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* The flow is dependency-injected so its ordering and payloads are unit-testable
|
|
5
|
+
* against fakes, with zero live GitHub calls in the test suite. The real
|
|
6
|
+
* `gh`/`git` implementations live in ./github.ts.
|
|
7
7
|
*/
|
|
8
8
|
/** Identity for the target GitHub repository + how to write to it. */
|
|
9
9
|
export interface PublishOptions {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GitHub Pages publishing — the OSS "permanent public URL" path of Phase 1.
|
|
3
3
|
*
|
|
4
|
-
* The flow is dependency-injected
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* The flow is dependency-injected so its ordering and payloads are unit-testable
|
|
5
|
+
* against fakes, with zero live GitHub calls in the test suite. The real
|
|
6
|
+
* `gh`/`git` implementations live in ./github.ts.
|
|
7
7
|
*/
|
|
8
8
|
/** A repo name's allowed characters (GitHub: alphanumerics, ., _, -). */
|
|
9
9
|
const REPO_NAME_PATTERN = /^[A-Za-z0-9._-]+$/;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GitHub Pages publishing — the OSS "permanent public URL" path of Phase 1.
|
|
3
3
|
*
|
|
4
|
-
* The flow is dependency-injected
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* The flow is dependency-injected so its ordering and payloads are unit-testable
|
|
5
|
+
* against fakes, with zero live GitHub calls in the test suite. The real
|
|
6
|
+
* `gh`/`git` implementations live in ./github.ts.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
/** A repo name's allowed characters (GitHub: alphanumerics, ., _, -). */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolve, join, basename } from "node:path";
|
|
2
2
|
import { stat, readFile } from "node:fs/promises";
|
|
3
3
|
import { PACK_MANIFEST_FILE } from "../pack/pack-manifest.js";
|
|
4
|
-
import { buildEmbedSnippet, buildEnhancedEmbedSnippet } from "../
|
|
4
|
+
import { buildEmbedSnippet, buildEnhancedEmbedSnippet } from "../embed/embed-snippet.js";
|
|
5
5
|
import { readBundleViewport } from "../bundle/read-viewport.js";
|
|
6
6
|
import { createGithubPublisher } from "./github.js";
|
|
7
7
|
import { runPublishFlow, validateRepoName, validatePublishPath, normalizePath, } from "./publish-flow.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-publish.js","sourceRoot":"","sources":["../../../src/publish/run-publish.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"run-publish.js","sourceRoot":"","sources":["../../../src/publish/run-publish.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,GAGd,MAAM,mBAAmB,CAAC;AAE3B,mEAAmE;AACnE,MAAM,U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zE,MAAM,EAAE,GAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAA8B,CAAC,UAAU,CAAC;QACpE,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,qBAAqB,CAAC,IAAI,CAAC,EAAE,CAAC;YAAE,OAAO,EAAE,CAAC;IAC1E,CAAC;IAAC,MAAM,CAAC;QACP,yDAAyD;IAC3D,CAAC;IACD,OAAO,QAAQ,CAAC,SAAS,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolve, join, basename } from "node:path";
|
|
2
2
|
import { stat, readFile } from "node:fs/promises";
|
|
3
3
|
import { PACK_MANIFEST_FILE } from "../pack/pack-manifest.js";
|
|
4
|
-
import { buildEmbedSnippet, buildEnhancedEmbedSnippet } from "../
|
|
4
|
+
import { buildEmbedSnippet, buildEnhancedEmbedSnippet } from "../embed/embed-snippet.js";
|
|
5
5
|
import { readBundleViewport } from "../bundle/read-viewport.js";
|
|
6
6
|
import type { Viewport } from "../pack/viewport.js";
|
|
7
7
|
import { createGithubPublisher } from "./github.js";
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Checks `render.tsx` first (recommended — a lean file that only imports
|
|
5
5
|
* view components), then falls back to `index.tsx`. Using a dedicated
|
|
6
|
-
* `render.tsx` avoids pulling browser-only dependencies (
|
|
7
|
-
*
|
|
6
|
+
* `render.tsx` avoids pulling browser-only dependencies (a product SDK
|
|
7
|
+
* client, data-mock wiring, etc.) into the Remotion webpack bundle.
|
|
8
8
|
*
|
|
9
9
|
* Uses a lightweight source-text scan rather than a dynamic import.
|
|
10
10
|
* The actual module resolution and type checking happens later when
|
|
@@ -7,8 +7,8 @@ const RENDER_FILE_CANDIDATES = ["render.tsx", "render.ts", "index.tsx", "index.t
|
|
|
7
7
|
*
|
|
8
8
|
* Checks `render.tsx` first (recommended — a lean file that only imports
|
|
9
9
|
* view components), then falls back to `index.tsx`. Using a dedicated
|
|
10
|
-
* `render.tsx` avoids pulling browser-only dependencies (
|
|
11
|
-
*
|
|
10
|
+
* `render.tsx` avoids pulling browser-only dependencies (a product SDK
|
|
11
|
+
* client, data-mock wiring, etc.) into the Remotion webpack bundle.
|
|
12
12
|
*
|
|
13
13
|
* Uses a lightweight source-text scan rather than a dynamic import.
|
|
14
14
|
* The actual module resolution and type checking happens later when
|
|
@@ -9,8 +9,8 @@ const RENDER_FILE_CANDIDATES = ["render.tsx", "render.ts", "index.tsx", "index.t
|
|
|
9
9
|
*
|
|
10
10
|
* Checks `render.tsx` first (recommended — a lean file that only imports
|
|
11
11
|
* view components), then falls back to `index.tsx`. Using a dedicated
|
|
12
|
-
* `render.tsx` avoids pulling browser-only dependencies (
|
|
13
|
-
*
|
|
12
|
+
* `render.tsx` avoids pulling browser-only dependencies (a product SDK
|
|
13
|
+
* client, data-mock wiring, etc.) into the Remotion webpack bundle.
|
|
14
14
|
*
|
|
15
15
|
* Uses a lightweight source-text scan rather than a dynamic import.
|
|
16
16
|
* The actual module resolution and type checking happens later when
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derive a locally-viewable URL from an embed URL. Some local edges serve over
|
|
3
|
+
* http on `*.localhost` even when the URL is emitted as https; for those hosts
|
|
4
|
+
* we downgrade the scheme so the printed link is clickable. Production https
|
|
5
|
+
* URLs and non-URL input are returned unchanged.
|
|
6
|
+
*/
|
|
7
|
+
export declare function localViewUrl(embedUrl: string): string;
|
|
8
|
+
//# sourceMappingURL=local-url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-url.d.ts","sourceRoot":"","sources":["../../../src/serve/local-url.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAarD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derive a locally-viewable URL from an embed URL. Some local edges serve over
|
|
3
|
+
* http on `*.localhost` even when the URL is emitted as https; for those hosts
|
|
4
|
+
* we downgrade the scheme so the printed link is clickable. Production https
|
|
5
|
+
* URLs and non-URL input are returned unchanged.
|
|
6
|
+
*/
|
|
7
|
+
export function localViewUrl(embedUrl) {
|
|
8
|
+
try {
|
|
9
|
+
const url = new URL(embedUrl);
|
|
10
|
+
const isLocal = url.hostname === "localhost" || url.hostname.endsWith(".localhost");
|
|
11
|
+
if (isLocal && url.protocol === "https:") {
|
|
12
|
+
url.protocol = "http:";
|
|
13
|
+
return url.toString();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
// Not a parseable URL — return as-is.
|
|
18
|
+
}
|
|
19
|
+
return embedUrl;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=local-url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-url.js","sourceRoot":"","sources":["../../../src/serve/local-url.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,QAAgB;IAC3C,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC9B,MAAM,OAAO,GACX,GAAG,CAAC,QAAQ,KAAK,WAAW,IAAI,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;QACtE,IAAI,OAAO,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;YACzC,GAAG,CAAC,QAAQ,GAAG,OAAO,CAAC;YACvB,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;QACxB,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,sCAAsC;IACxC,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derive a locally-viewable URL from an embed URL. Some local edges serve over
|
|
3
|
+
* http on `*.localhost` even when the URL is emitted as https; for those hosts
|
|
4
|
+
* we downgrade the scheme so the printed link is clickable. Production https
|
|
5
|
+
* URLs and non-URL input are returned unchanged.
|
|
6
|
+
*/
|
|
7
|
+
export function localViewUrl(embedUrl: string): string {
|
|
8
|
+
try {
|
|
9
|
+
const url = new URL(embedUrl);
|
|
10
|
+
const isLocal =
|
|
11
|
+
url.hostname === "localhost" || url.hostname.endsWith(".localhost");
|
|
12
|
+
if (isLocal && url.protocol === "https:") {
|
|
13
|
+
url.protocol = "http:";
|
|
14
|
+
return url.toString();
|
|
15
|
+
}
|
|
16
|
+
} catch {
|
|
17
|
+
// Not a parseable URL — return as-is.
|
|
18
|
+
}
|
|
19
|
+
return embedUrl;
|
|
20
|
+
}
|
package/src/serve/run-serve.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolve, join } from "node:path";
|
|
2
2
|
import { stat } from "node:fs/promises";
|
|
3
|
-
import { buildEmbedSnippet, buildEnhancedEmbedSnippet } from "../
|
|
4
|
-
import { localViewUrl } from "
|
|
3
|
+
import { buildEmbedSnippet, buildEnhancedEmbedSnippet } from "../embed/embed-snippet.js";
|
|
4
|
+
import { localViewUrl } from "./local-url.js";
|
|
5
5
|
import { readBundleViewport } from "../bundle/read-viewport.js";
|
|
6
6
|
import { startBundleServer } from "./static-server.js";
|
|
7
7
|
/** The servable entry every packed bundle contains at its root. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-serve.js","sourceRoot":"","sources":["../../../src/serve/run-serve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"run-serve.js","sourceRoot":"","sources":["../../../src/serve/run-serve.ts"],"names":[],"mappings":"AAAA,OAAO,EAA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AAC,CAAC;IAEH,MAAM,GAAG,GAAG,YAAY,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACrC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,MAAM,kBAAkB,CAAC,WAAW,CAAC,CAAC;IACrE,MAAM,OAAO,GAAG,iBAAiB,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC/D,MAAM,eAAe,GAAG,yBAAyB,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;IAE/E,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,EAAE,CAAC;AACzF,CAAC"}
|
package/src/serve/run-serve.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolve, join } from "node:path";
|
|
2
2
|
import { stat } from "node:fs/promises";
|
|
3
|
-
import { buildEmbedSnippet, buildEnhancedEmbedSnippet } from "../
|
|
4
|
-
import { localViewUrl } from "
|
|
3
|
+
import { buildEmbedSnippet, buildEnhancedEmbedSnippet } from "../embed/embed-snippet.js";
|
|
4
|
+
import { localViewUrl } from "./local-url.js";
|
|
5
5
|
import { readBundleViewport } from "../bundle/read-viewport.js";
|
|
6
6
|
import type { Viewport } from "../pack/viewport.js";
|
|
7
7
|
import { startBundleServer, type BundleServerHandle } from "./static-server.js";
|