@homepages/concrete 1.0.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 +59 -0
- package/README.md +174 -0
- package/codemods/manifest.json +9 -0
- package/dist/artifact/playground/client/assets/index-BSA1yutg.css +1 -0
- package/dist/artifact/playground/client/assets/index-JloQyj8h.js +1101 -0
- package/dist/artifact/playground/client/index.html +13 -0
- package/dist/artifact/playground/client/island-canvas-host.mjs +1 -0
- package/dist/artifact/playground/host.mjs +127 -0
- package/dist/asset-modules.d.ts +99 -0
- package/dist/base.css +220 -0
- package/dist/browser/site-config.d.ts +18 -0
- package/dist/browser/site-config.js +56 -0
- package/dist/browser/submit-lead.d.ts +98 -0
- package/dist/browser/submit-lead.js +188 -0
- package/dist/browser.d.ts +3 -0
- package/dist/browser.js +4 -0
- package/dist/cli/build/artifact.js +225 -0
- package/dist/cli/build/captures.js +67 -0
- package/dist/cli/build/esbuild.js +127 -0
- package/dist/cli/build/fixtures.js +96 -0
- package/dist/cli/build/icons.js +76 -0
- package/dist/cli/build/index.js +38 -0
- package/dist/cli/build/playground.js +31 -0
- package/dist/cli/build/sections.js +236 -0
- package/dist/cli/build/source.js +62 -0
- package/dist/cli/build/static.js +156 -0
- package/dist/cli/capture/bundle.js +37 -0
- package/dist/cli/capture/capture-browser.js +51 -0
- package/dist/cli/capture/capture.js +121 -0
- package/dist/cli/check/analyze.js +95 -0
- package/dist/cli/check/index.js +19 -0
- package/dist/cli/check/load-workspace.js +119 -0
- package/dist/cli/check/messages.js +16 -0
- package/dist/cli/check/render/class-conflicts.js +39 -0
- package/dist/cli/check/render/html.js +86 -0
- package/dist/cli/check/render/inputs.js +53 -0
- package/dist/cli/check/render/invariants.js +58 -0
- package/dist/cli/check/render/island-frames.js +72 -0
- package/dist/cli/check/render/marker-coverage.js +102 -0
- package/dist/cli/check/render/nav.js +64 -0
- package/dist/cli/check/report.js +73 -0
- package/dist/cli/check/stages/bundles.js +129 -0
- package/dist/cli/check/stages/composition.js +67 -0
- package/dist/cli/check/stages/contracts.js +22 -0
- package/dist/cli/check/stages/dependencies.js +261 -0
- package/dist/cli/check/stages/fixtures.js +74 -0
- package/dist/cli/check/stages/lint.js +41 -0
- package/dist/cli/check/stages/logic.js +63 -0
- package/dist/cli/check/stages/render.js +144 -0
- package/dist/cli/check/stages/sections.js +83 -0
- package/dist/cli/check/stages/stylesheet.js +31 -0
- package/dist/cli/check/stages/typecheck.js +68 -0
- package/dist/cli/check/stages/workspace.js +26 -0
- package/dist/cli/commands.js +342 -0
- package/dist/cli/currency/cache.js +89 -0
- package/dist/cli/currency/decide.js +65 -0
- package/dist/cli/currency/opt-out.js +16 -0
- package/dist/cli/currency/preamble.js +183 -0
- package/dist/cli/currency/prompt.js +28 -0
- package/dist/cli/currency/refresh.js +44 -0
- package/dist/cli/currency/resolve-latest.js +185 -0
- package/dist/cli/currency/version-order.js +38 -0
- package/dist/cli/dev/crop.js +22 -0
- package/dist/cli/dev/hmr.js +26 -0
- package/dist/cli/dev/http.js +129 -0
- package/dist/cli/dev/index.js +70 -0
- package/dist/cli/dev/islands.js +390 -0
- package/dist/cli/dev/load-template.js +46 -0
- package/dist/cli/dev/request-error.js +22 -0
- package/dist/cli/dev/server.js +307 -0
- package/dist/cli/dev/tsconfig-paths.js +95 -0
- package/dist/cli/dev/vite.js +85 -0
- package/dist/cli/dev/workspace-reader.js +274 -0
- package/dist/cli/io.d.ts +14 -0
- package/dist/cli/media/cache.js +125 -0
- package/dist/cli/media/derive.js +252 -0
- package/dist/cli/media/deriver-plugin.js +71 -0
- package/dist/cli/property/index.js +180 -0
- package/dist/cli/property/library.js +137 -0
- package/dist/cli/publish/client.js +119 -0
- package/dist/cli/publish/freshness.js +66 -0
- package/dist/cli/publish/git.js +43 -0
- package/dist/cli/publish/index.js +207 -0
- package/dist/cli/publish/pack.js +78 -0
- package/dist/cli/publish/report.js +98 -0
- package/dist/cli/publish/target.js +87 -0
- package/dist/cli/publish/wire.js +29 -0
- package/dist/cli/tar.js +87 -0
- package/dist/cli/upgrade/codemod.js +56 -0
- package/dist/cli/upgrade/index.js +263 -0
- package/dist/cli/upgrade/manifest.js +72 -0
- package/dist/cli/upgrade/plan.js +68 -0
- package/dist/cli/upgrade/stage.js +71 -0
- package/dist/cli/version.d.ts +12 -0
- package/dist/cli/version.js +15 -0
- package/dist/cli/workspace.js +108 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.js +94 -0
- package/dist/css/compile.js +77 -0
- package/dist/css/graph.js +109 -0
- package/dist/css/inline.js +132 -0
- package/dist/css/rules.js +65 -0
- package/dist/design-system/format-variants.js +127 -0
- package/dist/eslint/authoring.js +46 -0
- package/dist/eslint/correctness.js +42 -0
- package/dist/eslint/rules/editor-declaration.js +103 -0
- package/dist/eslint/rules/editor-reason.js +135 -0
- package/dist/eslint/rules/island-imports.js +20 -0
- package/dist/eslint/rules/jsx-visitor.js +20 -0
- package/dist/eslint/rules/no-client-runtime.js +88 -0
- package/dist/eslint/rules/no-editor-globals.js +60 -0
- package/dist/eslint/rules/no-hard-coded-color.js +183 -0
- package/dist/eslint/rules/no-inline-style.js +24 -0
- package/dist/eslint/rules/no-marker-literal.js +37 -0
- package/dist/eslint/rules/no-nondeterminism.js +44 -0
- package/dist/eslint/rules/no-px-breakpoint.js +44 -0
- package/dist/eslint/rules/no-raw-values.js +45 -0
- package/dist/eslint/rules/serializable-props.js +95 -0
- package/dist/eslint.d.ts +6 -0
- package/dist/eslint.js +26 -0
- package/dist/fixtures/brand.d.ts +4 -0
- package/dist/fixtures/brand.js +9 -0
- package/dist/fixtures/bundle-rule.js +67 -0
- package/dist/fixtures/canonical.d.ts +149 -0
- package/dist/fixtures/image-dimensions.js +59 -0
- package/dist/fixtures/load.js +154 -0
- package/dist/fixtures/media-plugin.js +141 -0
- package/dist/fixtures/media.js +165 -0
- package/dist/fixtures/property.js +210 -0
- package/dist/fixtures/resolve.js +202 -0
- package/dist/fixtures/rows.js +108 -0
- package/dist/fixtures/synthesize-empties.js +42 -0
- package/dist/fixtures.d.ts +213 -0
- package/dist/fixtures.js +37 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.js +37 -0
- package/dist/islands/client-module.js +97 -0
- package/dist/islands/marker.d.ts +43 -0
- package/dist/islands/marker.js +44 -0
- package/dist/node_modules/.pnpm/fflate@0.8.3/node_modules/fflate/esm/browser.js +687 -0
- package/dist/packages/external/concrete/package.js +5 -0
- package/dist/packages/internal/fact-interpolation/dist/index.js +22 -0
- package/dist/packages/internal/fill-bake/dist/bake-property-ref.js +111 -0
- package/dist/packages/internal/fill-bake/dist/display.js +9 -0
- package/dist/packages/internal/fill-bake/dist/index.js +6 -0
- package/dist/packages/internal/fill-bake/dist/reconcile-cross-section.js +170 -0
- package/dist/packages/internal/fill-vocabulary/dist/facts.d.ts +32 -0
- package/dist/packages/internal/fill-vocabulary/dist/facts.js +131 -0
- package/dist/packages/internal/fill-vocabulary/dist/row-planners.js +73 -0
- package/dist/packages/internal/format-geometry/dist/capture.js +404 -0
- package/dist/packages/internal/format-geometry/dist/format.d.ts +41 -0
- package/dist/packages/internal/format-geometry/dist/geometry.js +58 -0
- package/dist/packages/internal/format-geometry/dist/index.js +4 -0
- package/dist/packages/internal/image-descriptor/dist/index.d.ts +35 -0
- package/dist/packages/internal/image-ladder/dist/crop.js +82 -0
- package/dist/packages/internal/image-ladder/dist/encode.js +23 -0
- package/dist/packages/internal/image-ladder/dist/index.js +4 -0
- package/dist/packages/internal/image-ladder/dist/policy.js +102 -0
- package/dist/packages/internal/island-runtime/dist/capture-holds.d.ts +13 -0
- package/dist/packages/internal/island-runtime/dist/capture-holds.js +45 -0
- package/dist/packages/internal/island-runtime/dist/contract.d.ts +176 -0
- package/dist/packages/internal/island-runtime/dist/contract.js +94 -0
- package/dist/packages/internal/island-runtime/dist/editor-instance-context.js +15 -0
- package/dist/packages/internal/island-runtime/dist/index.d.ts +103 -0
- package/dist/packages/internal/island-runtime/dist/index.js +163 -0
- package/dist/packages/internal/island-runtime/dist/use-capture-ready.d.ts +19 -0
- package/dist/packages/internal/island-runtime/dist/use-capture-ready.js +39 -0
- package/dist/packages/internal/island-runtime/dist/use-editor.d.ts +22 -0
- package/dist/packages/internal/island-runtime/dist/use-editor.js +54 -0
- package/dist/packages/internal/island-runtime/dist/viewport-schedule.js +105 -0
- package/dist/packages/internal/property-facts/dist/derive-facts-view.js +25 -0
- package/dist/packages/internal/property-facts/dist/index.js +3 -0
- package/dist/packages/internal/property-facts/dist/property-facts-CSdkSuD7.js +181 -0
- package/dist/packages/internal/section-contracts/dist/cap-contract.js +59 -0
- package/dist/packages/internal/section-contracts/dist/catalog.js +102 -0
- package/dist/packages/internal/section-contracts/dist/choose-select-contract.js +24 -0
- package/dist/packages/internal/section-contracts/dist/count-bounds-contract.js +48 -0
- package/dist/packages/internal/section-contracts/dist/display-contract.js +30 -0
- package/dist/packages/internal/section-contracts/dist/display-evidence-contract.js +17 -0
- package/dist/packages/internal/section-contracts/dist/group-contract.js +21 -0
- package/dist/packages/internal/section-contracts/dist/index.js +26 -0
- package/dist/packages/internal/section-contracts/dist/interpolation-contract.js +48 -0
- package/dist/packages/internal/section-contracts/dist/list-fill-contract.js +53 -0
- package/dist/packages/internal/section-contracts/dist/list-scalar-contract.js +70 -0
- package/dist/packages/internal/section-contracts/dist/name-title-contract.js +27 -0
- package/dist/packages/internal/section-contracts/dist/nested-slot-contract.js +12 -0
- package/dist/packages/internal/section-contracts/dist/option-source-contract.js +22 -0
- package/dist/packages/internal/section-contracts/dist/poi-curation-contract.js +18 -0
- package/dist/packages/internal/section-contracts/dist/pooling-field-contract.js +30 -0
- package/dist/packages/internal/section-contracts/dist/record-collection-contract.js +24 -0
- package/dist/packages/internal/section-contracts/dist/row-contract.js +37 -0
- package/dist/packages/internal/section-contracts/dist/row-fill-contract.js +38 -0
- package/dist/packages/internal/section-contracts/dist/runners.js +181 -0
- package/dist/packages/internal/section-contracts/dist/select-contract.js +28 -0
- package/dist/packages/internal/section-contracts/dist/source-contract.js +48 -0
- package/dist/packages/internal/section-contracts/dist/source-filter-contract.js +15 -0
- package/dist/packages/internal/section-contracts/dist/sources-contract.js +28 -0
- package/dist/packages/internal/section-contracts/dist/url-contract.js +20 -0
- package/dist/packages/internal/source-resolution/dist/index.js +222 -0
- package/dist/packages/internal/template-artifact/dist/hash.js +50 -0
- package/dist/packages/internal/template-artifact/dist/index.js +7 -0
- package/dist/packages/internal/template-artifact/dist/layout.js +165 -0
- package/dist/packages/internal/template-artifact/dist/manifest.js +73 -0
- package/dist/packages/internal/template-artifact/dist/sha256.js +138 -0
- package/dist/packages/internal/template-artifact/dist/verify.js +275 -0
- package/dist/packages/internal/template-contracts/dist/collection-editing.js +38 -0
- package/dist/packages/internal/template-contracts/dist/content-categories.d.ts +10 -0
- package/dist/packages/internal/template-contracts/dist/content-categories.js +17 -0
- package/dist/packages/internal/template-contracts/dist/document-value.d.ts +33 -0
- package/dist/packages/internal/template-contracts/dist/facts-view.d.ts +81 -0
- package/dist/packages/internal/template-contracts/dist/facts-view.js +136 -0
- package/dist/packages/internal/template-contracts/dist/layout.js +17 -0
- package/dist/packages/internal/template-contracts/dist/markers.d.ts +40 -0
- package/dist/packages/internal/template-contracts/dist/markers.js +41 -0
- package/dist/packages/internal/template-contracts/dist/poi-row.d.ts +63 -0
- package/dist/packages/internal/template-contracts/dist/select-key.js +13 -0
- package/dist/packages/internal/template-contracts/dist/slot-catalog.d.ts +1112 -0
- package/dist/packages/internal/template-contracts/dist/slot-catalog.js +1109 -0
- package/dist/packages/internal/template-contracts/dist/slot-overrides.js +11 -0
- package/dist/packages/internal/template-contracts/dist/tour-value.d.ts +45 -0
- package/dist/packages/internal/template-contracts/dist/video-value.d.ts +63 -0
- package/dist/playground/host/page-state.js +12 -0
- package/dist/playground/host/paths.js +9 -0
- package/dist/playground/layout.js +24 -0
- package/dist/playground/wire.js +36 -0
- package/dist/playground-island-runtime.d.ts +3 -0
- package/dist/playground-island-runtime.js +4 -0
- package/dist/primitives/FrameShell.d.ts +29 -0
- package/dist/primitives/FrameShell.js +34 -0
- package/dist/primitives/Image.d.ts +119 -0
- package/dist/primitives/Image.js +173 -0
- package/dist/primitives/Section.d.ts +22 -0
- package/dist/primitives/Section.js +26 -0
- package/dist/primitives/Tour.d.ts +43 -0
- package/dist/primitives/Tour.js +72 -0
- package/dist/primitives/Video.d.ts +57 -0
- package/dist/primitives/Video.js +116 -0
- package/dist/primitives/embed-playback.js +50 -0
- package/dist/primitives/index.d.ts +11 -0
- package/dist/primitives/marker-attrs.js +44 -0
- package/dist/primitives/object-fit.js +11 -0
- package/dist/primitives/picture-sources.d.ts +24 -0
- package/dist/primitives/picture-sources.js +52 -0
- package/dist/primitives/probe-context.js +24 -0
- package/dist/primitives/slot-bindings.d.ts +96 -0
- package/dist/primitives/slot-bindings.js +226 -0
- package/dist/primitives/slot-document.d.ts +35 -0
- package/dist/primitives/slot-document.js +37 -0
- package/dist/primitives/slot-group.d.ts +40 -0
- package/dist/primitives/slot-group.js +45 -0
- package/dist/primitives/slot-list.d.ts +21 -0
- package/dist/primitives/slot-list.js +23 -0
- package/dist/primitives/slot-media.d.ts +71 -0
- package/dist/primitives/slot-media.js +98 -0
- package/dist/primitives/slot-scalar.d.ts +53 -0
- package/dist/primitives/slot-scalar.js +98 -0
- package/dist/primitives/slot.d.ts +26 -0
- package/dist/primitives/slot.js +28 -0
- package/dist/rules/registry.js +479 -0
- package/dist/schema/compute.d.ts +22 -0
- package/dist/schema/compute.js +30 -0
- package/dist/schema/define-schema.d.ts +27 -0
- package/dist/schema/define-schema.js +73 -0
- package/dist/schema/extract-fill-spec.js +246 -0
- package/dist/schema/extract-used-facts.js +176 -0
- package/dist/schema/fact.d.ts +65 -0
- package/dist/schema/fact.js +33 -0
- package/dist/schema/fill-builders.d.ts +387 -0
- package/dist/schema/fill-builders.js +263 -0
- package/dist/schema/fill-declaration.d.ts +76 -0
- package/dist/schema/fill-declaration.js +43 -0
- package/dist/schema/fill-spec.d.ts +18 -0
- package/dist/schema/fill-spec.js +170 -0
- package/dist/schema/format-presets.d.ts +27 -0
- package/dist/schema/format-presets.js +76 -0
- package/dist/schema/format.d.ts +22 -0
- package/dist/schema/format.js +40 -0
- package/dist/schema/formats.d.ts +6 -0
- package/dist/schema/formats.js +7 -0
- package/dist/schema/layout.d.ts +32 -0
- package/dist/schema/layout.js +30 -0
- package/dist/schema/manifest.js +300 -0
- package/dist/schema/property-facts.d.ts +83 -0
- package/dist/schema/runtime-values.d.ts +88 -0
- package/dist/schema/section-nav.d.ts +38 -0
- package/dist/schema/section-nav.js +29 -0
- package/dist/schema/section-props.d.ts +98 -0
- package/dist/schema/section-schema.d.ts +53 -0
- package/dist/schema/section-schema.js +54 -0
- package/dist/schema/slot-builders.d.ts +497 -0
- package/dist/schema/slot-builders.js +331 -0
- package/dist/schema/slot-types.d.ts +110 -0
- package/dist/schema/slot-types.js +187 -0
- package/dist/section/declare.d.ts +44 -0
- package/dist/section/declare.js +27 -0
- package/dist/section/discovery.js +76 -0
- package/dist/section/groups.js +74 -0
- package/dist/section/materialize.js +28 -0
- package/dist/section/placements.js +28 -0
- package/dist/section/section.d.ts +69 -0
- package/dist/section/section.js +101 -0
- package/dist/site-analytics.d.ts +1 -0
- package/dist/site-analytics.js +15 -0
- package/dist/site-runtime/analytics.js +97 -0
- package/dist/site-runtime/site-integrations.js +97 -0
- package/dist/styles.css +60 -0
- package/dist/template/define-template.d.ts +139 -0
- package/dist/template/define-template.js +98 -0
- package/dist/template/logic-build.js +191 -0
- package/dist/template/logic-shim.d.ts +43 -0
- package/dist/template/logic-shim.js +52 -0
- package/dist/template/logic-transform.js +92 -0
- package/dist/template/materialize.js +107 -0
- package/dist/template/reconcile.d.ts +67 -0
- package/dist/template/reconcile.js +25 -0
- package/dist/template/running-copy.js +58 -0
- package/guide/reference/cli/INDEX.md +79 -0
- package/guide/reference/cli/build.md +48 -0
- package/guide/reference/cli/check.md +49 -0
- package/guide/reference/cli/dev.md +46 -0
- package/guide/reference/cli/property-add.md +53 -0
- package/guide/reference/cli/property-list.md +46 -0
- package/guide/reference/cli/publish.md +54 -0
- package/guide/reference/cli/upgrade.md +48 -0
- package/guide/reference/rules/INDEX.md +190 -0
- package/package.json +137 -0
- package/tsconfig.base.json +16 -0
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import { ASSET_PUBLIC_PATH } from "../../css/inline.js";
|
|
2
|
+
import { findWorkspaceIslands, islandMapOf, writeIslandHostScripts } from "./islands.js";
|
|
3
|
+
import { FIXTURE_MEDIA_PATH } from "../../fixtures/media-plugin.js";
|
|
4
|
+
import { HMR_EVENTS, ROUTES } from "../../playground/wire.js";
|
|
5
|
+
import { STYLESHEET_PATHS } from "../../playground/host/paths.js";
|
|
6
|
+
import { playgroundClientOutDir, playgroundHostFile } from "../../playground/layout.js";
|
|
7
|
+
import { CaptureUnavailableError, captureFixture, createCapturer } from "../capture/capture.js";
|
|
8
|
+
import { CROP_PARAM, parseCropParam } from "../../packages/internal/image-ladder/dist/crop.js";
|
|
9
|
+
import { croppedMediaUrl, cutRegion } from "./crop.js";
|
|
10
|
+
import { createHmrBus } from "./hmr.js";
|
|
11
|
+
import { RequestError, contentTypeFor, readBody, sendBytes, sendFile, sendHtml, sendText } from "./http.js";
|
|
12
|
+
import { respondToHandlerError } from "./request-error.js";
|
|
13
|
+
import { createDevVite } from "./vite.js";
|
|
14
|
+
import { DevWorkspace } from "./workspace-reader.js";
|
|
15
|
+
import { existsSync, statSync } from "node:fs";
|
|
16
|
+
import { dirname, extname, join, relative, resolve, sep } from "node:path";
|
|
17
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
18
|
+
import { readFile } from "node:fs/promises";
|
|
19
|
+
import { createServer } from "node:http";
|
|
20
|
+
|
|
21
|
+
//#region src/cli/dev/server.ts
|
|
22
|
+
/** The host module bounds a render request at the same size. */
|
|
23
|
+
const MAX_BODY_BYTES = 1024 * 1024;
|
|
24
|
+
/** How many cut crops the server keeps in memory: a session draws a handful, and a re-render asks for the same ones again. */
|
|
25
|
+
const MAX_CACHED_CROPS = 64;
|
|
26
|
+
/** The canvas kernel rewrites a stylesheet asset's `/section-assets/` URL to this mount under the frame's base. */
|
|
27
|
+
const CANVAS_SECTION_ASSET_PATH = "/runtime/section-asset";
|
|
28
|
+
/** The package root: the nearest ancestor of this module with a package.json. */
|
|
29
|
+
function findPackageRoot(fromFile) {
|
|
30
|
+
let dir = dirname(fromFile);
|
|
31
|
+
for (;;) {
|
|
32
|
+
if (existsSync(join(dir, "package.json"))) return dir;
|
|
33
|
+
const parent = dirname(dir);
|
|
34
|
+
if (parent === dir) throw new Error("concrete dev: could not locate the package root");
|
|
35
|
+
dir = parent;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const THIS_FILE = fileURLToPath(import.meta.url);
|
|
39
|
+
/** Running from source (a test, a checkout) rather than the built package. */
|
|
40
|
+
const FROM_SOURCE = extname(THIS_FILE) === ".ts";
|
|
41
|
+
/** The client shell with the base stamped: every route the client builds resolves against it. */
|
|
42
|
+
function stampBase(html, base) {
|
|
43
|
+
const tag = `<base href="${base}">`;
|
|
44
|
+
return /<head[^>]*>/i.test(html) ? html.replace(/<head[^>]*>/i, (head) => `${head}\n ${tag}`) : `${tag}${html}`;
|
|
45
|
+
}
|
|
46
|
+
/** The canvas routes the client's shell answers: the base itself and `fixtures/<fixture>/canvas[/<canvas-id>]`. */
|
|
47
|
+
function isCanvasPath(path) {
|
|
48
|
+
if (path === "/") return true;
|
|
49
|
+
const [head, fixture, view, ...rest] = path.split("/").filter(Boolean);
|
|
50
|
+
return head === "fixtures" && fixture !== void 0 && view === "canvas" && rest.length <= 1;
|
|
51
|
+
}
|
|
52
|
+
/** The host module an artifact carries, as the package built it. */
|
|
53
|
+
async function loadHostModule(packageRoot) {
|
|
54
|
+
const file = playgroundHostFile(packageRoot);
|
|
55
|
+
if (!existsSync(file)) throw new Error(`the playground host module is not built (${file}) — run the package's build.`);
|
|
56
|
+
const mod = await import(pathToFileURL(file).href);
|
|
57
|
+
if (typeof mod.createHost !== "function") throw new Error(`${file} does not export createHost.`);
|
|
58
|
+
return mod.createHost;
|
|
59
|
+
}
|
|
60
|
+
async function startDevServer(options) {
|
|
61
|
+
const { root, port, log } = options;
|
|
62
|
+
const packageRoot = findPackageRoot(THIS_FILE);
|
|
63
|
+
const clientDir = playgroundClientOutDir(packageRoot);
|
|
64
|
+
if (!existsSync(join(clientDir, "index.html"))) log.write(`concrete dev: the playground client is not built (${clientDir}) — run the package's build.\n`);
|
|
65
|
+
const createHost = await loadHostModule(packageRoot);
|
|
66
|
+
const sourceMarker = join(packageRoot, "src", "islands", "marker.tsx");
|
|
67
|
+
const browserMarker = FROM_SOURCE ? `/@fs/${sourceMarker.replace(/^\/+/, "")}` : "@homepages/concrete";
|
|
68
|
+
const serverMarker = FROM_SOURCE ? sourceMarker : "@homepages/concrete";
|
|
69
|
+
const islandEntries = findWorkspaceIslands(root).map((file) => relative(root, file));
|
|
70
|
+
const vite = await createDevVite({
|
|
71
|
+
root,
|
|
72
|
+
packageRoot,
|
|
73
|
+
markerSpecifier: browserMarker,
|
|
74
|
+
hmrPort: port + 100,
|
|
75
|
+
islandEntries
|
|
76
|
+
});
|
|
77
|
+
let islands = {
|
|
78
|
+
map: {},
|
|
79
|
+
canvasHost: null,
|
|
80
|
+
previewHost: null
|
|
81
|
+
};
|
|
82
|
+
let islandKey = "";
|
|
83
|
+
const refreshIslands = async () => {
|
|
84
|
+
const files = findWorkspaceIslands(root);
|
|
85
|
+
const key = files.join("\n");
|
|
86
|
+
if (key === islandKey && islands.canvasHost !== null) return false;
|
|
87
|
+
islandKey = key;
|
|
88
|
+
const scripts = await writeIslandHostScripts(root, files);
|
|
89
|
+
islands = files.length === 0 ? {
|
|
90
|
+
map: {},
|
|
91
|
+
canvasHost: null,
|
|
92
|
+
previewHost: null
|
|
93
|
+
} : {
|
|
94
|
+
map: islandMapOf(root, files),
|
|
95
|
+
canvasHost: scripts.canvas,
|
|
96
|
+
previewHost: scripts.preview
|
|
97
|
+
};
|
|
98
|
+
return true;
|
|
99
|
+
};
|
|
100
|
+
await refreshIslands();
|
|
101
|
+
const capturer = options.capturer ?? createCapturer({
|
|
102
|
+
root,
|
|
103
|
+
packageRoot
|
|
104
|
+
});
|
|
105
|
+
const origin = `http://localhost:${port}/`;
|
|
106
|
+
const capture = async (request) => {
|
|
107
|
+
try {
|
|
108
|
+
return await captureFixture(capturer, origin, request);
|
|
109
|
+
} catch (err) {
|
|
110
|
+
if (err instanceof CaptureUnavailableError) throw new RequestError(501, err.message);
|
|
111
|
+
throw err;
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
const workspace = new DevWorkspace({
|
|
115
|
+
root,
|
|
116
|
+
markerSpecifier: serverMarker,
|
|
117
|
+
islands: () => islands,
|
|
118
|
+
capture
|
|
119
|
+
});
|
|
120
|
+
const assetUrl = (path, transform) => transform === void 0 ? path : croppedMediaUrl(path, transform.crop);
|
|
121
|
+
const host = createHost({
|
|
122
|
+
reader: workspace,
|
|
123
|
+
assetUrl,
|
|
124
|
+
renderer: workspace.renderer(),
|
|
125
|
+
base: "/"
|
|
126
|
+
});
|
|
127
|
+
const hmr = createHmrBus();
|
|
128
|
+
const ctx = {
|
|
129
|
+
port,
|
|
130
|
+
vite,
|
|
131
|
+
workspace,
|
|
132
|
+
host,
|
|
133
|
+
hmr,
|
|
134
|
+
clientDir,
|
|
135
|
+
baseCss: join(packageRoot, FROM_SOURCE ? join("src", "css", "base.css") : join("dist", "base.css")),
|
|
136
|
+
log,
|
|
137
|
+
crops: /* @__PURE__ */ new Map()
|
|
138
|
+
};
|
|
139
|
+
const fixturesDir = join(root, "fixtures") + sep;
|
|
140
|
+
const onChange = (path) => {
|
|
141
|
+
vite.moduleGraph.invalidateAll();
|
|
142
|
+
if (path.startsWith(fixturesDir)) {
|
|
143
|
+
workspace.invalidateFixtures();
|
|
144
|
+
hmr.broadcast(HMR_EVENTS.fixtures);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (extname(path) === ".css") {
|
|
148
|
+
workspace.invalidateStylesheet();
|
|
149
|
+
hmr.broadcast(HMR_EVENTS.stylesheet);
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
workspace.invalidateSource();
|
|
153
|
+
refreshIslands().finally(() => {
|
|
154
|
+
hmr.broadcast(HMR_EVENTS.source);
|
|
155
|
+
hmr.broadcast(HMR_EVENTS.stylesheet);
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
vite.watcher.on("change", onChange);
|
|
159
|
+
vite.watcher.on("add", onChange);
|
|
160
|
+
vite.watcher.on("unlink", onChange);
|
|
161
|
+
const server = createServer((req, res) => {
|
|
162
|
+
handle(req, res, ctx).catch((err) => {
|
|
163
|
+
if (err instanceof RequestError && !res.headersSent) {
|
|
164
|
+
sendText(res, err.status, err.message);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
respondToHandlerError(err, req, res, (error) => vite.ssrFixStacktrace(error));
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
await new Promise((resolveListen, reject) => {
|
|
171
|
+
server.once("error", (err) => {
|
|
172
|
+
vite.close().finally(() => {
|
|
173
|
+
reject(err.code === "EADDRINUSE" ? /* @__PURE__ */ new Error(`port ${String(port)} is already in use — pick another with --port <n>`) : err);
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
server.listen(port, resolveListen);
|
|
177
|
+
});
|
|
178
|
+
return {
|
|
179
|
+
url: origin,
|
|
180
|
+
port,
|
|
181
|
+
workspace,
|
|
182
|
+
close: async () => {
|
|
183
|
+
hmr.closeAll();
|
|
184
|
+
await new Promise((done) => server.close(() => done()));
|
|
185
|
+
await capturer.close();
|
|
186
|
+
await vite.close();
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
/** A Node request as the fetch-style request the host module takes. Only a request with a method that carries one reads its body. */
|
|
191
|
+
async function toFetchRequest(req, url) {
|
|
192
|
+
const method = req.method ?? "GET";
|
|
193
|
+
const headers = new Headers();
|
|
194
|
+
for (const [name, value] of Object.entries(req.headers)) if (typeof value === "string") headers.set(name, value);
|
|
195
|
+
else if (Array.isArray(value)) for (const item of value) headers.append(name, item);
|
|
196
|
+
const body = method === "GET" || method === "HEAD" ? void 0 : await readBody(req, MAX_BODY_BYTES);
|
|
197
|
+
return new Request(url, {
|
|
198
|
+
method,
|
|
199
|
+
headers,
|
|
200
|
+
...body === void 0 ? {} : { body: new Uint8Array(body) }
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
async function sendFetchResponse(res, response) {
|
|
204
|
+
res.statusCode = response.status;
|
|
205
|
+
response.headers.forEach((value, name) => res.setHeader(name, value));
|
|
206
|
+
res.end(Buffer.from(await response.arrayBuffer()));
|
|
207
|
+
}
|
|
208
|
+
async function handle(req, res, ctx) {
|
|
209
|
+
const url = new URL(req.url ?? "/", `http://localhost:${ctx.port}`);
|
|
210
|
+
const path = url.pathname;
|
|
211
|
+
if (isCanvasPath(path)) return sendClientShell(ctx, res);
|
|
212
|
+
if (path === `/${ROUTES.hmr}`) return ctx.hmr.attach(res);
|
|
213
|
+
if (path === `/${STYLESHEET_PATHS.base}`) return sendBytes(res, "text/css; charset=utf-8", await readFile(ctx.baseCss));
|
|
214
|
+
if (path === `/${STYLESHEET_PATHS.template}`) return sendTemplateCss(ctx, res);
|
|
215
|
+
if (path.startsWith(`${"/section-assets"}/`)) return sendSectionAsset(ctx, path.slice(ASSET_PUBLIC_PATH.length + 1), res);
|
|
216
|
+
if (path.startsWith(`${CANVAS_SECTION_ASSET_PATH}/`)) return sendSectionAsset(ctx, path.slice(23), res);
|
|
217
|
+
if (path.startsWith(`${"/fixture-media"}/`)) return sendFixtureMedia(ctx, req, url, res);
|
|
218
|
+
const answered = await ctx.host.handle(await toFetchRequest(req, url));
|
|
219
|
+
if (answered !== null) return sendFetchResponse(res, answered);
|
|
220
|
+
if (await sendClientAsset(ctx, path, res)) return;
|
|
221
|
+
ctx.vite.middlewares(req, res, () => sendText(res, 404, "not found"));
|
|
222
|
+
}
|
|
223
|
+
async function sendClientShell(ctx, res) {
|
|
224
|
+
let html;
|
|
225
|
+
try {
|
|
226
|
+
html = await readFile(join(ctx.clientDir, "index.html"), "utf8");
|
|
227
|
+
} catch {
|
|
228
|
+
sendText(res, 500, "the playground client is not built — run the package's build");
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
sendHtml(res, stampBase(html, "/"));
|
|
232
|
+
}
|
|
233
|
+
/** A file the client build emitted, by its path under the base. `false` when there is none. */
|
|
234
|
+
async function sendClientAsset(ctx, path, res) {
|
|
235
|
+
const file = resolve(ctx.clientDir, `.${decodeURIComponent(path)}`);
|
|
236
|
+
if (!file.startsWith(ctx.clientDir + sep)) return false;
|
|
237
|
+
try {
|
|
238
|
+
if (!statSync(file).isFile()) return false;
|
|
239
|
+
} catch {
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
sendBytes(res, contentTypeFor(file), await readFile(file));
|
|
243
|
+
return true;
|
|
244
|
+
}
|
|
245
|
+
async function sendTemplateCss(ctx, res) {
|
|
246
|
+
const { css, violations } = await ctx.workspace.templateCss();
|
|
247
|
+
for (const violation of violations) ctx.log.write(`concrete dev: ${violation.file}: ${violation.message} (${violation.rule})\n`);
|
|
248
|
+
res.setHeader("cache-control", "no-cache");
|
|
249
|
+
sendBytes(res, "text/css; charset=utf-8", new TextEncoder().encode(css));
|
|
250
|
+
}
|
|
251
|
+
function sendSectionAsset(ctx, rawFilename, res) {
|
|
252
|
+
const filename = decodeURIComponent(rawFilename);
|
|
253
|
+
if (filename.includes("/") || filename.includes("\\") || filename.includes("..")) {
|
|
254
|
+
sendText(res, 403, "forbidden");
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
const asset = ctx.workspace.sectionAsset(filename);
|
|
258
|
+
if (asset === void 0) {
|
|
259
|
+
sendText(res, 404, "not found");
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
sendBytes(res, asset.contentType, asset.bytes);
|
|
263
|
+
}
|
|
264
|
+
async function sendFixtureMedia(ctx, req, url, res) {
|
|
265
|
+
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
266
|
+
sendText(res, 405, "fixture media only reads; the playground accepts no uploads.");
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
const asset = await ctx.workspace.fixtureAsset(decodeURIComponent(url.pathname));
|
|
270
|
+
if (asset === void 0) {
|
|
271
|
+
sendText(res, 404, "not found");
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
const cropValue = url.searchParams.get(CROP_PARAM);
|
|
275
|
+
if (cropValue === null) {
|
|
276
|
+
await sendFile(req, res, asset.path);
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
const rect = parseCropParam(cropValue);
|
|
280
|
+
if (rect === null) {
|
|
281
|
+
sendText(res, 400, `"${cropValue}" is not a crop of the image.`);
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
if (!asset.derived) {
|
|
285
|
+
sendText(res, 400, `${url.pathname} is not a raster image and cannot be cropped.`);
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
const key = `${url.pathname}?${CROP_PARAM}=${cropValue}`;
|
|
289
|
+
let cut = ctx.crops.get(key);
|
|
290
|
+
if (cut === void 0) {
|
|
291
|
+
cut = readFile(asset.path).then((bytes) => cutRegion(bytes, rect));
|
|
292
|
+
cut.catch(() => ctx.crops.delete(key));
|
|
293
|
+
ctx.crops.set(key, cut);
|
|
294
|
+
if (ctx.crops.size > MAX_CACHED_CROPS) ctx.crops.delete(ctx.crops.keys().next().value);
|
|
295
|
+
}
|
|
296
|
+
const image = await cut;
|
|
297
|
+
if (image === null) {
|
|
298
|
+
ctx.log.write(`concrete dev: sharp is not installed, so a crop of ${url.pathname} serves the whole image.\n`);
|
|
299
|
+
await sendFile(req, res, asset.path);
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
res.setHeader("cache-control", "no-cache");
|
|
303
|
+
sendBytes(res, image.contentType, image.bytes);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
//#endregion
|
|
307
|
+
export { findPackageRoot, isCanvasPath, stampBase, startDevServer };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { existsSync, statSync } from "node:fs";
|
|
2
|
+
import { isAbsolute, join, resolve } from "node:path";
|
|
3
|
+
|
|
4
|
+
//#region src/cli/dev/tsconfig-paths.ts
|
|
5
|
+
const RESOLVE_EXTENSIONS = [
|
|
6
|
+
"",
|
|
7
|
+
".ts",
|
|
8
|
+
".tsx",
|
|
9
|
+
".js",
|
|
10
|
+
".jsx",
|
|
11
|
+
".mjs",
|
|
12
|
+
".cjs",
|
|
13
|
+
".json"
|
|
14
|
+
];
|
|
15
|
+
function toPattern(key, targets, baseUrl) {
|
|
16
|
+
const star = key.indexOf("*");
|
|
17
|
+
const hasWildcard = star !== -1;
|
|
18
|
+
return {
|
|
19
|
+
prefix: hasWildcard ? key.slice(0, star) : key,
|
|
20
|
+
suffix: hasWildcard ? key.slice(star + 1) : "",
|
|
21
|
+
hasWildcard,
|
|
22
|
+
targets: targets.map((target) => isAbsolute(target) ? target : join(baseUrl, target))
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/** The wildcard capture for a match, `""` for an exact match, or `undefined` when `specifier` doesn't match. */
|
|
26
|
+
function matchPattern(pattern, specifier) {
|
|
27
|
+
if (!pattern.hasWildcard) return specifier === pattern.prefix ? "" : void 0;
|
|
28
|
+
if (!specifier.startsWith(pattern.prefix) || !specifier.endsWith(pattern.suffix)) return void 0;
|
|
29
|
+
return specifier.slice(pattern.prefix.length, specifier.length - pattern.suffix.length);
|
|
30
|
+
}
|
|
31
|
+
function isFile(path) {
|
|
32
|
+
try {
|
|
33
|
+
return existsSync(path) && statSync(path).isFile();
|
|
34
|
+
} catch {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/** `candidate` resolved as tsc would: itself, itself with an extension, or a directory index. */
|
|
39
|
+
function resolveCandidate(candidate) {
|
|
40
|
+
for (const ext of RESOLVE_EXTENSIONS) if (isFile(candidate + ext)) return candidate + ext;
|
|
41
|
+
for (const ext of RESOLVE_EXTENSIONS.slice(1)) {
|
|
42
|
+
const indexFile = join(candidate, `index${ext}`);
|
|
43
|
+
if (isFile(indexFile)) return indexFile;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The resolver for `root`'s tsconfig `paths`, or `null` when the workspace declares none
|
|
48
|
+
* or its tsconfig cannot be read. Synchronous, and handed the compiler rather than
|
|
49
|
+
* importing it, so the lint preset's rules (which cannot await) resolve an import exactly
|
|
50
|
+
* as `dev` does. Relative, absolute and unmapped specifiers resolve to `undefined`.
|
|
51
|
+
*/
|
|
52
|
+
function createPathsResolver(ts, root) {
|
|
53
|
+
try {
|
|
54
|
+
const configFile = ts.readConfigFile(join(root, "tsconfig.json"), (file) => ts.sys.readFile(file));
|
|
55
|
+
if (configFile.error) return null;
|
|
56
|
+
const parsed = ts.parseJsonConfigFileContent(configFile.config, ts.sys, root);
|
|
57
|
+
const rawPaths = parsed.options.paths;
|
|
58
|
+
if (!rawPaths || Object.keys(rawPaths).length === 0) return null;
|
|
59
|
+
const baseUrl = parsed.options.baseUrl ? resolve(root, parsed.options.baseUrl) : root;
|
|
60
|
+
const patterns = Object.entries(rawPaths).map(([key, targets]) => toPattern(key, targets, baseUrl)).sort((a, b) => b.prefix.length - a.prefix.length);
|
|
61
|
+
return (source) => {
|
|
62
|
+
if (source.startsWith(".") || isAbsolute(source)) return void 0;
|
|
63
|
+
for (const pattern of patterns) {
|
|
64
|
+
const matched = matchPattern(pattern, source);
|
|
65
|
+
if (matched === void 0) continue;
|
|
66
|
+
for (const target of pattern.targets) {
|
|
67
|
+
const resolved = resolveCandidate(pattern.hasWildcard ? target.replace("*", () => matched) : target);
|
|
68
|
+
if (resolved) return resolved;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
} catch {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* A Vite `resolveId` plugin from `root`'s tsconfig `paths`, or `null` when the workspace
|
|
78
|
+
* declares none or its tsconfig cannot be read — `check` owns reporting a broken tsconfig,
|
|
79
|
+
* so `dev` degrades rather than refusing to start over it.
|
|
80
|
+
*/
|
|
81
|
+
async function createTsconfigPathsPlugin(root) {
|
|
82
|
+
const ts = (await import("typescript")).default;
|
|
83
|
+
const resolvePath = createPathsResolver(ts, root);
|
|
84
|
+
if (resolvePath === null) return null;
|
|
85
|
+
return {
|
|
86
|
+
name: "concrete-dev:tsconfig-paths",
|
|
87
|
+
enforce: "pre",
|
|
88
|
+
resolveId(source) {
|
|
89
|
+
return resolvePath(source) ?? null;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
//#endregion
|
|
95
|
+
export { createPathsResolver, createTsconfigPathsPlugin };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { createTsconfigPathsPlugin } from "./tsconfig-paths.js";
|
|
2
|
+
import { islandTransformPlugin, toPosixPath } from "./islands.js";
|
|
3
|
+
import { imageDimensions } from "../../fixtures/image-dimensions.js";
|
|
4
|
+
import { extname, isAbsolute, relative } from "node:path";
|
|
5
|
+
import { readFile } from "node:fs/promises";
|
|
6
|
+
import react from "@vitejs/plugin-react";
|
|
7
|
+
import { createServer } from "vite";
|
|
8
|
+
|
|
9
|
+
//#region src/cli/dev/vite.ts
|
|
10
|
+
function isInside(dir, file) {
|
|
11
|
+
const rel = relative(dir, file);
|
|
12
|
+
return rel !== "" && !rel.startsWith("..") && !isAbsolute(rel);
|
|
13
|
+
}
|
|
14
|
+
const RASTER_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
15
|
+
".png",
|
|
16
|
+
".jpg",
|
|
17
|
+
".jpeg",
|
|
18
|
+
".webp",
|
|
19
|
+
".avif"
|
|
20
|
+
]);
|
|
21
|
+
/**
|
|
22
|
+
* A raster imported from a module is an OBJECT in the authoring contract (`AuthorImage`:
|
|
23
|
+
* url, width, height, responsive) where Vite would hand back a URL string. `dev` serves
|
|
24
|
+
* the master and derives no ladder — the ladder is the build's (`responsive: null`, the
|
|
25
|
+
* same answer fixture media gets in `dev`). A query suffix (`?url`, `?raw`) is the
|
|
26
|
+
* author asking Vite for the string form on purpose, and is left to Vite.
|
|
27
|
+
*/
|
|
28
|
+
function authorImagePlugin(root) {
|
|
29
|
+
return {
|
|
30
|
+
name: "concrete-dev:author-image",
|
|
31
|
+
enforce: "pre",
|
|
32
|
+
async load(id) {
|
|
33
|
+
if (id.includes("?") || !RASTER_EXTENSIONS.has(extname(id).toLowerCase())) return null;
|
|
34
|
+
const bytes = await readFile(id);
|
|
35
|
+
const url = isInside(root, id) ? `/${toPosixPath(relative(root, id))}` : `/@fs/${toPosixPath(id).replace(/^\/+/, "")}`;
|
|
36
|
+
const size = imageDimensions(bytes) ?? {
|
|
37
|
+
width: 0,
|
|
38
|
+
height: 0
|
|
39
|
+
};
|
|
40
|
+
return `export default ${JSON.stringify({
|
|
41
|
+
url,
|
|
42
|
+
responsive: null,
|
|
43
|
+
width: size.width,
|
|
44
|
+
height: size.height
|
|
45
|
+
})};`;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
async function createDevVite(options) {
|
|
50
|
+
const { root, packageRoot } = options;
|
|
51
|
+
const pathsPlugin = await createTsconfigPathsPlugin(root);
|
|
52
|
+
return createServer({
|
|
53
|
+
root,
|
|
54
|
+
appType: "custom",
|
|
55
|
+
configFile: false,
|
|
56
|
+
logLevel: "warn",
|
|
57
|
+
plugins: [
|
|
58
|
+
islandTransformPlugin({
|
|
59
|
+
root,
|
|
60
|
+
markerSpecifier: options.markerSpecifier
|
|
61
|
+
}),
|
|
62
|
+
react(),
|
|
63
|
+
authorImagePlugin(root),
|
|
64
|
+
...pathsPlugin === null ? [] : [pathsPlugin]
|
|
65
|
+
],
|
|
66
|
+
server: {
|
|
67
|
+
middlewareMode: true,
|
|
68
|
+
fs: { allow: [root, packageRoot] },
|
|
69
|
+
watch: { ignored: ["**/.concrete/**", "**/node_modules/**"] },
|
|
70
|
+
hmr: { port: options.hmrPort }
|
|
71
|
+
},
|
|
72
|
+
resolve: { dedupe: ["react", "react-dom"] },
|
|
73
|
+
optimizeDeps: {
|
|
74
|
+
include: [
|
|
75
|
+
"react",
|
|
76
|
+
"react-dom",
|
|
77
|
+
"react-dom/client"
|
|
78
|
+
],
|
|
79
|
+
entries: [...options.islandEntries]
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
//#endregion
|
|
85
|
+
export { authorImagePlugin, createDevVite };
|