@homepages/concrete 13.0.0 → 14.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 +42 -0
- package/README.md +4 -5
- package/codemods/manifest.json +11 -0
- package/dist/artifact/playground/client/assets/index-DZbV6Ucf.js +1338 -0
- package/dist/artifact/playground/client/index.html +1 -1
- package/dist/artifact/playground/host.mjs +22 -22
- package/dist/cli/build/manifest.js +1 -1
- package/dist/cli/build/record.js +1 -1
- package/dist/cli/check/load-workspace.js +3 -6
- package/dist/cli/commands.js +63 -15
- package/dist/cli/media/deriver-plugin.js +10 -1
- package/dist/cli/publish/artifact.js +18 -40
- package/dist/cli/publish/fixtures.js +1 -1
- package/dist/cli/publish/index.js +90 -115
- package/dist/cli/publish/report.js +36 -56
- package/dist/cli/publish/send.js +142 -0
- package/dist/cli/publish/target.js +33 -31
- package/dist/cli/publish/verdict.js +65 -0
- package/dist/cli/release/client.js +69 -0
- package/dist/cli/release/index.js +143 -0
- package/dist/cli/release/report.js +73 -0
- package/dist/cli/upgrade/fixture-modules.js +3 -5
- package/dist/cli.js +1 -0
- package/dist/css/graph.js +29 -40
- package/dist/fixtures/media-plugin.js +7 -25
- package/dist/fixtures/package-stylesheets.js +12 -48
- package/dist/packages/external/concrete/package.js +1 -1
- package/dist/packages/internal/media-resolution/dist/image.js +23 -0
- package/dist/packages/internal/playground/dist/fixture-formats.js +5 -1
- package/dist/packages/internal/playground/dist/host/built.js +4 -12
- package/dist/packages/internal/playground/dist/host/catalog-fixture.js +0 -1
- package/dist/packages/internal/playground/dist/host/download.js +1 -8
- package/dist/packages/internal/playground/dist/host/fixture-addresses.js +3 -4
- package/dist/packages/internal/playground/dist/host/program.js +1 -2
- package/dist/packages/internal/playground/dist/host/serve.js +4 -30
- package/dist/packages/internal/playground/dist/host/stored-fixtures.js +2 -9
- package/dist/packages/internal/playground/dist/layout.js +5 -5
- package/dist/packages/internal/playground/dist/send-wire.js +9 -0
- package/dist/packages/internal/playground/dist/server/changes.js +0 -1
- package/dist/packages/internal/playground/dist/server/listen.js +2 -19
- package/dist/packages/internal/property-facts/dist/registry-facts.js +0 -7
- package/dist/packages/internal/template-artifact/dist/framework-floor.js +33 -0
- package/dist/packages/internal/template-artifact/dist/index.js +3 -3
- package/dist/packages/internal/template-artifact/dist/layout.js +2 -39
- package/dist/packages/internal/template-artifact/dist/manifest.js +1 -1
- package/dist/packages/internal/template-artifact/dist/verify.js +6 -57
- package/dist/packages/internal/template-contracts/dist/tour-value.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/video-value.d.ts +1 -1
- package/dist/template/logic-build.js +38 -19
- package/guide/reference/cli/INDEX.md +5 -4
- package/guide/reference/cli/build.md +1 -1
- package/guide/reference/cli/check.md +1 -1
- package/guide/reference/cli/dev.md +1 -1
- package/guide/reference/cli/install.md +1 -1
- package/guide/reference/cli/property-add.md +1 -1
- package/guide/reference/cli/property-list.md +1 -1
- package/guide/reference/cli/publish.md +17 -16
- package/guide/reference/cli/release.md +57 -0
- package/guide/reference/cli/upgrade.md +1 -1
- package/guide/reference/rules/INDEX.md +1 -1
- package/package.json +7 -5
- package/dist/artifact/playground/client/assets/index-Bmvcss4B.js +0 -1338
- package/dist/cli/publish/captures.js +0 -61
- package/dist/cli/publish/client.js +0 -118
- package/dist/cli/publish/pack.js +0 -77
- package/dist/cli/publish/playground.js +0 -27
- package/dist/cli/publish/wire.js +0 -23
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { problemLines } from "../publish/report.js";
|
|
2
|
+
|
|
3
|
+
//#region src/cli/release/report.ts
|
|
4
|
+
const plural = (count, one, many) => `${String(count)} ${count === 1 ? one : many}`;
|
|
5
|
+
function agoText(at, now) {
|
|
6
|
+
const seconds = Math.max(0, Math.floor((now.getTime() - Date.parse(at)) / 1e3));
|
|
7
|
+
if (Number.isNaN(seconds)) return `at ${at}`;
|
|
8
|
+
if (seconds < 60) return "just now";
|
|
9
|
+
for (const [size, unit] of [
|
|
10
|
+
[86400, "day"],
|
|
11
|
+
[3600, "hour"],
|
|
12
|
+
[60, "minute"]
|
|
13
|
+
]) if (seconds >= size) return `${plural(Math.floor(seconds / size), unit, `${unit}s`)} ago`;
|
|
14
|
+
return "just now";
|
|
15
|
+
}
|
|
16
|
+
function subjectText(subject, now) {
|
|
17
|
+
const head = `${subject.dry_run ? "Dry run: releasing" : "Releasing"} ${subject.template} · version ${subject.version}`;
|
|
18
|
+
const sent = subject.sent;
|
|
19
|
+
if (sent === null) return head;
|
|
20
|
+
return `${head}, sent ${agoText(sent.at, now)}${sent.key === null ? "" : ` with key "${sent.key}"`}`;
|
|
21
|
+
}
|
|
22
|
+
function audienceText(audience) {
|
|
23
|
+
return `Audience: ${audience === "global" ? "every org" : plural(audience.orgs.length, "org", "orgs")}`;
|
|
24
|
+
}
|
|
25
|
+
function reportLines(report, dryRun) {
|
|
26
|
+
const count = (status) => report.sections.filter((section) => section.status === status).length;
|
|
27
|
+
const nothing = report.template.status === "unchanged" && count("new") === 0 && count("changed") === 0;
|
|
28
|
+
const head = dryRun ? "Would release" : "Released";
|
|
29
|
+
const lines = [];
|
|
30
|
+
if (nothing) lines.push(`${head} · the app already holds this build; nothing changes`);
|
|
31
|
+
else {
|
|
32
|
+
const sections = [
|
|
33
|
+
count("new") > 0 ? `${String(count("new"))} new` : null,
|
|
34
|
+
`${String(count("changed"))} changed`,
|
|
35
|
+
`${String(count("unchanged"))} unchanged`
|
|
36
|
+
].filter((part) => part !== null).join(", ");
|
|
37
|
+
lines.push(`${head} · template ${report.template.status} · sections: ${sections}`);
|
|
38
|
+
}
|
|
39
|
+
if (report.granted.length > 0 || report.revoked.length > 0) lines.push(`${dryRun ? "Would grant" : "Granted"} ${plural(report.granted.length, "org", "orgs")} · ${dryRun ? "would revoke" : "revoked"} ${plural(report.revoked.length, "org", "orgs")}`);
|
|
40
|
+
const adopting = plural(report.adopting, "deliverable", "deliverables");
|
|
41
|
+
lines.push(dryRun ? `${adopting} would adopt this build` : `${adopting} adopting this build`);
|
|
42
|
+
return lines;
|
|
43
|
+
}
|
|
44
|
+
function unfinishedText(unfinished) {
|
|
45
|
+
switch (unfinished.code) {
|
|
46
|
+
case "verifying": return "the console is verifying the build; asking again";
|
|
47
|
+
case "more_to_deliver": return `delivered ${plural(unfinished.delivered, "content", "contents")} to the app, ${String(unfinished.missing)} still to go; asking again`;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function refusalLines(refusal) {
|
|
51
|
+
switch (refusal.code) {
|
|
52
|
+
case "verdict_failed": return [`refused: platform ${refusal.platform} did not load the build:`, ...problemLines(refusal.problems)];
|
|
53
|
+
case "audience_not_allowed": {
|
|
54
|
+
const lines = ["refused: the build's audience is outside your team's:"];
|
|
55
|
+
if (refusal.every_org) lines.push(" the build is offered to every org, and your team may not release to every org");
|
|
56
|
+
for (const org of refusal.orgs) lines.push(` your team may not release to org ${org}`);
|
|
57
|
+
return lines;
|
|
58
|
+
}
|
|
59
|
+
case "format_in_use": return ["refused: the build drops formats deliverables of this template still hold:", ...refusal.formats.map((format) => ` ${format.format}: ${plural(format.deliverables, "deliverable", "deliverables")}`)];
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function endingLines(outcome) {
|
|
63
|
+
switch (outcome.outcome) {
|
|
64
|
+
case "released":
|
|
65
|
+
case "would_release": return [audienceText(outcome.audience), ...reportLines(outcome.report, outcome.outcome === "would_release")];
|
|
66
|
+
case "refused": return [audienceText(outcome.audience), ...refusalLines(outcome.refusal)];
|
|
67
|
+
case "not_taken": return [`The app could not take the release (${outcome.reason.code}: ${outcome.reason.detail}). Nothing says the build is unfit; run \`concrete release --version ${outcome.version}\` again.`];
|
|
68
|
+
case "ask_again": return [unfinishedText(outcome.unfinished)];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
73
|
+
export { agoText, audienceText, endingLines, refusalLines, reportLines, subjectText, unfinishedText };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { externalFile, packageFile, workspacePath } from "../../platform/paths.js";
|
|
2
2
|
import { FIXTURE_MEDIA_PATH, MEDIA_LOADERS, createFixtureMediaPlugin, externalOutsideWorkspace } from "../../fixtures/media-plugin.js";
|
|
3
3
|
import { listDirSync, removeTree } from "../../platform/fs.js";
|
|
4
|
-
import {
|
|
4
|
+
import { emptyPackageStylesheets } from "../../fixtures/package-stylesheets.js";
|
|
5
5
|
import { runningCopyPlugin } from "../../template/running-copy.js";
|
|
6
6
|
import { basename, join } from "node:path";
|
|
7
7
|
import { pathToFileURL } from "node:url";
|
|
@@ -58,7 +58,7 @@ async function evaluateFixtureModules(root, files) {
|
|
|
58
58
|
await mkdir(cache, { recursive: true });
|
|
59
59
|
const outdir = await mkdtemp(join(cache, `${importSerial++}-`));
|
|
60
60
|
const media = createFixtureMediaPlugin(root, urlOfPath);
|
|
61
|
-
|
|
61
|
+
emptyPackageStylesheets();
|
|
62
62
|
try {
|
|
63
63
|
let result;
|
|
64
64
|
try {
|
|
@@ -83,8 +83,7 @@ async function evaluateFixtureModules(root, files) {
|
|
|
83
83
|
retiredSubpathPlugin(),
|
|
84
84
|
runningCopyPlugin(),
|
|
85
85
|
externalOutsideWorkspace(root),
|
|
86
|
-
media.plugin
|
|
87
|
-
stylesheets.plugin
|
|
86
|
+
media.plugin
|
|
88
87
|
],
|
|
89
88
|
metafile: true,
|
|
90
89
|
write: true,
|
|
@@ -116,7 +115,6 @@ async function evaluateFixtureModules(root, files) {
|
|
|
116
115
|
problems: []
|
|
117
116
|
};
|
|
118
117
|
} finally {
|
|
119
|
-
await stylesheets.dispose();
|
|
120
118
|
await removeTree(outdir);
|
|
121
119
|
}
|
|
122
120
|
}
|
package/dist/cli.js
CHANGED
|
@@ -62,6 +62,7 @@ async function main(argv, io) {
|
|
|
62
62
|
if (cmd === "upgrade") return dispatch(cmd, async () => (await import("./cli/upgrade/index.js")).runUpgrade, args, io);
|
|
63
63
|
if (cmd === "install") return dispatch(cmd, async () => (await import("./cli/install/index.js")).runInstall, args, io);
|
|
64
64
|
if (cmd === "publish") return dispatch(cmd, async () => (await import("./cli/publish/index.js")).runPublish, args, io);
|
|
65
|
+
if (cmd === "release") return dispatch(cmd, async () => (await import("./cli/release/index.js")).runRelease, args, io);
|
|
65
66
|
if (cmd === "property") return dispatch(command.name, async () => (await import("./cli/property/index.js")).runProperty, args, io);
|
|
66
67
|
io.stderr.write(`concrete: '${cmd}' is declared but has no dispatch branch.\n`);
|
|
67
68
|
return 1;
|
package/dist/css/graph.js
CHANGED
|
@@ -3,7 +3,6 @@ import { relative } from "node:path";
|
|
|
3
3
|
import { build } from "esbuild";
|
|
4
4
|
|
|
5
5
|
//#region src/css/graph.ts
|
|
6
|
-
const CSS_NAMESPACE = "concrete-css-graph";
|
|
7
6
|
const UNFOLLOWED_RE = /^(?:react|react-dom)(?:\/.*)?$|^@homepages\/concrete(?:\/(?!.*\.css$).*)?$/;
|
|
8
7
|
const EMPTY_LOADERS = Object.fromEntries([
|
|
9
8
|
".svg",
|
|
@@ -27,49 +26,40 @@ const EMPTY_LOADERS = Object.fromEntries([
|
|
|
27
26
|
".pdf",
|
|
28
27
|
".zip"
|
|
29
28
|
].map((ext) => [ext, "empty"]));
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
function graphPlugin() {
|
|
29
|
+
const BARE_FILTER = /^[^./]/;
|
|
30
|
+
const CSS_FILTER = /\.css$/;
|
|
31
|
+
function graphPlugin(root) {
|
|
32
|
+
const stylesheets = /* @__PURE__ */ new Map();
|
|
35
33
|
return {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
api
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
34
|
+
plugin: {
|
|
35
|
+
name: "concrete-css-graph",
|
|
36
|
+
setup(api) {
|
|
37
|
+
api.onResolve({ filter: BARE_FILTER }, (args) => args.kind !== "entry-point" && UNFOLLOWED_RE.test(args.path) ? externalSpecifier(args.path) : void 0);
|
|
38
|
+
api.onLoad({ filter: CSS_FILTER }, (args) => {
|
|
39
|
+
if (args.namespace !== "file") return void 0;
|
|
40
|
+
stylesheets.set(metafileKey(root, args.path), args.path);
|
|
41
|
+
return {
|
|
42
|
+
contents: "",
|
|
43
|
+
loader: "js"
|
|
44
|
+
};
|
|
46
45
|
});
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
namespace: CSS_NAMESPACE,
|
|
51
|
-
sideEffects: true
|
|
52
|
-
};
|
|
53
|
-
});
|
|
54
|
-
api.onLoad({
|
|
55
|
-
filter: /.*/,
|
|
56
|
-
namespace: CSS_NAMESPACE
|
|
57
|
-
}, () => ({
|
|
58
|
-
contents: "",
|
|
59
|
-
loader: "js"
|
|
60
|
-
}));
|
|
61
|
-
}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
stylesheets
|
|
62
49
|
};
|
|
63
50
|
}
|
|
64
|
-
function
|
|
51
|
+
function metafileKey(root, file) {
|
|
52
|
+
return toPosix(relative(root, file));
|
|
53
|
+
}
|
|
54
|
+
function stylesheetsInImportOrder(metafile, entryKey, stylesheets) {
|
|
65
55
|
const order = [];
|
|
66
56
|
const seen = /* @__PURE__ */ new Set();
|
|
67
|
-
const prefix = `${CSS_NAMESPACE}:`;
|
|
68
57
|
const visit = (key) => {
|
|
69
58
|
if (seen.has(key)) return;
|
|
70
59
|
seen.add(key);
|
|
71
|
-
|
|
72
|
-
|
|
60
|
+
const stylesheet = stylesheets.get(key);
|
|
61
|
+
if (stylesheet !== void 0) {
|
|
62
|
+
order.push(stylesheet);
|
|
73
63
|
return;
|
|
74
64
|
}
|
|
75
65
|
for (const record of metafile.inputs[key]?.imports ?? []) {
|
|
@@ -81,7 +71,8 @@ function stylesheetsInImportOrder(metafile, entryKey) {
|
|
|
81
71
|
return order;
|
|
82
72
|
}
|
|
83
73
|
async function collectCssGraph(input) {
|
|
84
|
-
const
|
|
74
|
+
const graph = graphPlugin(input.root);
|
|
75
|
+
return stylesheetsInImportOrder((await build({
|
|
85
76
|
entryPoints: [input.templateFile],
|
|
86
77
|
absWorkingDir: input.root,
|
|
87
78
|
bundle: true,
|
|
@@ -92,11 +83,9 @@ async function collectCssGraph(input) {
|
|
|
92
83
|
jsx: "automatic",
|
|
93
84
|
outdir: "out",
|
|
94
85
|
loader: EMPTY_LOADERS,
|
|
95
|
-
plugins: [
|
|
86
|
+
plugins: [graph.plugin],
|
|
96
87
|
logLevel: "silent"
|
|
97
|
-
});
|
|
98
|
-
const entryKey = toPosix(relative(input.root, input.templateFile));
|
|
99
|
-
return stylesheetsInImportOrder(result.metafile, entryKey);
|
|
88
|
+
})).metafile, metafileKey(input.root, input.templateFile), graph.stylesheets);
|
|
100
89
|
}
|
|
101
90
|
|
|
102
91
|
//#endregion
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { externalFile, isInsideRoot } from "../platform/paths.js";
|
|
2
2
|
import { fixtureMediaUrl as fixtureMediaUrl$1, importedFileValue } from "../packages/internal/playground/dist/host/property-derive.js";
|
|
3
|
-
import { basename } from "node:path";
|
|
3
|
+
import { basename, resolve } from "node:path";
|
|
4
4
|
import { readFile } from "node:fs/promises";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
|
|
7
7
|
//#region src/fixtures/media-plugin.ts
|
|
8
|
-
const
|
|
9
|
-
const RESOLVING = Symbol("concrete-
|
|
8
|
+
const NAME = "concrete-fixture-media";
|
|
9
|
+
const RESOLVING = Symbol("concrete-external-outside-workspace:resolving");
|
|
10
10
|
const FIXTURE_MEDIA_PATH = "/fixture-media";
|
|
11
11
|
const MEDIA_FILTER = /\.(?:[pP][nN][gG]|[jJ][pP][eE]?[gG]|[wW][eE][bB][pP]|[aA][vV][iI][fF]|[sS][vV][gG]|[gG][iI][fF]|[iI][cC][oO]|[wW][oO][fF][fF]2?|[tT][tT][fF]|[oO][tT][fF]|[eE][oO][tT]|[mM][pP]4|[wW][eE][bB][mM]|[mM][oO][vV]|[mM][pP]3|[wW][aA][vV]|[pP][dD][fF]|[zZ][iI][pP])$/;
|
|
12
12
|
const MEDIA_LOADERS = Object.fromEntries([
|
|
@@ -37,6 +37,7 @@ function externalOutsideWorkspace(root) {
|
|
|
37
37
|
setup(build) {
|
|
38
38
|
build.onResolve({ filter: /^\.\.?\// }, async (args) => {
|
|
39
39
|
if (args.pluginData === RESOLVING) return null;
|
|
40
|
+
if (isInsideRoot(root, resolve(args.resolveDir, args.path))) return null;
|
|
40
41
|
const resolved = await build.resolve(args.path, {
|
|
41
42
|
importer: args.importer,
|
|
42
43
|
namespace: args.namespace,
|
|
@@ -71,29 +72,10 @@ function createFixtureMediaPlugin(root, urlOf) {
|
|
|
71
72
|
const assets = /* @__PURE__ */ new Map();
|
|
72
73
|
return {
|
|
73
74
|
plugin: {
|
|
74
|
-
name:
|
|
75
|
+
name: NAME,
|
|
75
76
|
setup(build) {
|
|
76
|
-
build.
|
|
77
|
-
if (args.
|
|
78
|
-
if (args.kind !== "import-statement" && args.kind !== "dynamic-import") return null;
|
|
79
|
-
const resolved = await build.resolve(args.path, {
|
|
80
|
-
importer: args.importer,
|
|
81
|
-
namespace: args.namespace,
|
|
82
|
-
resolveDir: args.resolveDir,
|
|
83
|
-
kind: args.kind,
|
|
84
|
-
pluginData: RESOLVING
|
|
85
|
-
});
|
|
86
|
-
if (resolved.errors.length > 0 || resolved.path === "") return null;
|
|
87
|
-
if (!isInsideRoot(root, resolved.path)) return null;
|
|
88
|
-
return {
|
|
89
|
-
path: resolved.path,
|
|
90
|
-
namespace: NAMESPACE
|
|
91
|
-
};
|
|
92
|
-
});
|
|
93
|
-
build.onLoad({
|
|
94
|
-
filter: /.*/,
|
|
95
|
-
namespace: NAMESPACE
|
|
96
|
-
}, async (args) => {
|
|
77
|
+
build.onLoad({ filter: MEDIA_FILTER }, async (args) => {
|
|
78
|
+
if (args.namespace !== "file" || !isInsideRoot(root, args.path)) return void 0;
|
|
97
79
|
const bytes = await readFile(args.path);
|
|
98
80
|
const { asset, value } = await fixtureMediaModule(args.path, bytes, urlOf?.(args.path, bytes));
|
|
99
81
|
assets.set(asset.url, asset);
|
|
@@ -1,53 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { register } from "node:module";
|
|
2
2
|
|
|
3
3
|
//#region src/fixtures/package-stylesheets.ts
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}]
|
|
15
|
-
});
|
|
16
|
-
const stylesheets = /* @__PURE__ */ new Map();
|
|
17
|
-
return {
|
|
18
|
-
plugin: {
|
|
19
|
-
name: NAMESPACE,
|
|
20
|
-
setup(api) {
|
|
21
|
-
api.onResolve({ filter: /^[^./]/ }, async (args) => {
|
|
22
|
-
if (args.kind === "entry-point" || args.path.startsWith("node:") || resolve === void 0) return null;
|
|
23
|
-
const key = `${args.kind}\0${args.resolveDir}\0${args.path}`;
|
|
24
|
-
let stylesheet = stylesheets.get(key);
|
|
25
|
-
if (stylesheet === void 0) {
|
|
26
|
-
stylesheet = resolve(args.path, {
|
|
27
|
-
kind: args.kind,
|
|
28
|
-
importer: args.importer,
|
|
29
|
-
resolveDir: args.resolveDir
|
|
30
|
-
}).then((resolved) => resolved.errors.length === 0 && !resolved.external && resolved.path.endsWith(".css") ? resolved.path : null);
|
|
31
|
-
stylesheets.set(key, stylesheet);
|
|
32
|
-
}
|
|
33
|
-
const path = await stylesheet;
|
|
34
|
-
return path === null ? null : {
|
|
35
|
-
path,
|
|
36
|
-
namespace: NAMESPACE
|
|
37
|
-
};
|
|
38
|
-
});
|
|
39
|
-
api.onLoad({
|
|
40
|
-
filter: /.*/,
|
|
41
|
-
namespace: NAMESPACE
|
|
42
|
-
}, () => ({
|
|
43
|
-
contents: "",
|
|
44
|
-
loader: "empty"
|
|
45
|
-
}));
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
dispose: () => resolver.dispose()
|
|
49
|
-
};
|
|
4
|
+
const HOOKS = `export async function load(url, context, nextLoad) {
|
|
5
|
+
if (url.startsWith("file:") && new URL(url).pathname.endsWith(".css")) return { format: "module", source: "", shortCircuit: true };
|
|
6
|
+
return nextLoad(url, context);
|
|
7
|
+
}
|
|
8
|
+
`;
|
|
9
|
+
let registered = false;
|
|
10
|
+
function emptyPackageStylesheets() {
|
|
11
|
+
if (registered) return;
|
|
12
|
+
register(`data:text/javascript,${encodeURIComponent(HOOKS)}`);
|
|
13
|
+
registered = true;
|
|
50
14
|
}
|
|
51
15
|
|
|
52
16
|
//#endregion
|
|
53
|
-
export {
|
|
17
|
+
export { emptyPackageStylesheets };
|
|
@@ -78,6 +78,28 @@ function slotServedKey(v, mask, at) {
|
|
|
78
78
|
};
|
|
79
79
|
return (mask === null ? null : own(mask === "white" ? "mask_white" : "mask_black")) ?? own("cutout") ?? (mask === null ? slotCutKey(v, at) : null);
|
|
80
80
|
}
|
|
81
|
+
function sameCrop(a, b) {
|
|
82
|
+
if (a === null || b === null) return a === b;
|
|
83
|
+
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
84
|
+
}
|
|
85
|
+
function carriesCutAt(framing, photoId, crop) {
|
|
86
|
+
const cut = (framing.renditions && typeof framing.renditions === "object" ? framing.renditions : {}).crop;
|
|
87
|
+
const key = renditionKey(cut);
|
|
88
|
+
if (key === null || cropKeyOwner(key) !== photoId) return false;
|
|
89
|
+
const over = cut.over;
|
|
90
|
+
return over !== null && typeof over === "object" && sameCrop(storedCrop(over.crop), crop);
|
|
91
|
+
}
|
|
92
|
+
function noteOwedCuts(v, photoId, record, at, mask, store) {
|
|
93
|
+
if (store.notePending === void 0 || mask !== null || record?.kind !== "image") return;
|
|
94
|
+
const owes = (framing, crop) => cropsPart(crop) && !carriesCutAt(framing, photoId, crop);
|
|
95
|
+
const cutout = renditionKey((v.renditions && typeof v.renditions === "object" ? v.renditions : {}).cutout);
|
|
96
|
+
const desktop = cutout === null || !cutout.startsWith(`processed/cutout/${photoId}/`) ? owes(v, framingCrop(v, at)) : false;
|
|
97
|
+
const mobile = v.mobile && typeof v.mobile === "object" ? v.mobile : at === void 0 ? null : {};
|
|
98
|
+
if (desktop || mobile !== null && owes(mobile, framingCrop(mobile, at, "mobile"))) store.notePending({
|
|
99
|
+
kind: "cut",
|
|
100
|
+
id: photoId
|
|
101
|
+
});
|
|
102
|
+
}
|
|
81
103
|
function readMediaId(v) {
|
|
82
104
|
return contentMediaIdOf(v) ?? "";
|
|
83
105
|
}
|
|
@@ -101,6 +123,7 @@ async function resolveImageValue(value, records, store, aspects) {
|
|
|
101
123
|
aspects,
|
|
102
124
|
imageAspect: imageAspectOf(record, ar)
|
|
103
125
|
};
|
|
126
|
+
if (photoId) noteOwedCuts(v, photoId, record, at, mask, store);
|
|
104
127
|
const mobileKey = photoId ? mobileCutKey(v, at) : null;
|
|
105
128
|
const mobile = mobileKey ? await mobileCropUrl(mobileKey, store) : null;
|
|
106
129
|
const alt = typeof v.alt === "string" ? v.alt : "";
|
|
@@ -3,7 +3,11 @@ import { listNamesProperties } from "./fixture-conversions/list-names-properties
|
|
|
3
3
|
|
|
4
4
|
//#region ../../internal/playground/dist/fixture-formats.js
|
|
5
5
|
const FIXTURES_ROOT = `${FIXTURES_DIR}/`;
|
|
6
|
+
const FIRST_FIXTURE_FORMAT = 1;
|
|
6
7
|
const FIXTURE_CONVERSIONS = [listNamesProperties];
|
|
8
|
+
function fixtureFormat(conversions = FIXTURE_CONVERSIONS) {
|
|
9
|
+
return 1 + conversions.length;
|
|
10
|
+
}
|
|
7
11
|
async function runFixtureConversion(conversion, files) {
|
|
8
12
|
const converted = await conversion.convert(files);
|
|
9
13
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -17,4 +21,4 @@ async function runFixtureConversion(conversion, files) {
|
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
//#endregion
|
|
20
|
-
export { FIXTURE_CONVERSIONS, runFixtureConversion };
|
|
24
|
+
export { FIXTURE_CONVERSIONS, fixtureFormat, runFixtureConversion };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SECTION_FILES, builtTreePath, sectionPath } from "../../../template-artifact/dist/layout.js";
|
|
2
|
+
import { CANVAS_ISLAND_HOST } from "../layout.js";
|
|
2
3
|
import { readBuild as readBuild$1 } from "../../../template-artifact/dist/build.js";
|
|
3
4
|
import { ROUTES } from "../wire.js";
|
|
4
5
|
|
|
@@ -99,7 +100,7 @@ function builtIslands(env, binding, buildBase) {
|
|
|
99
100
|
const importMap = Object.fromEntries(Object.entries(vendor).map(([specifier, ref]) => [specifier, url(ref.filename)]));
|
|
100
101
|
return {
|
|
101
102
|
map,
|
|
102
|
-
canvasHost: env.url(
|
|
103
|
+
canvasHost: env.url(CANVAS_ISLAND_HOST),
|
|
103
104
|
importMap,
|
|
104
105
|
documentLoader: {
|
|
105
106
|
kind: "bundles",
|
|
@@ -110,14 +111,6 @@ function builtIslands(env, binding, buildBase) {
|
|
|
110
111
|
}
|
|
111
112
|
};
|
|
112
113
|
}
|
|
113
|
-
function shippedHalf(env) {
|
|
114
|
-
const { captures } = env;
|
|
115
|
-
if (captures === void 0) return {};
|
|
116
|
-
return {
|
|
117
|
-
captured: () => captures.fixtures(),
|
|
118
|
-
shipped: (path) => captures.read(path)
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
114
|
function builtEnv(env) {
|
|
122
115
|
let read = null;
|
|
123
116
|
let held = null;
|
|
@@ -167,8 +160,7 @@ function builtEnv(env) {
|
|
|
167
160
|
template: async () => (await current()).template,
|
|
168
161
|
islands: async (buildBase) => builtIslands(env, (await current()).binding, buildBase),
|
|
169
162
|
computes: async (key) => computesAt(await current(), key),
|
|
170
|
-
binding: async () => (await current()).binding
|
|
171
|
-
...shippedHalf(env)
|
|
163
|
+
binding: async () => (await current()).binding
|
|
172
164
|
},
|
|
173
165
|
site: {
|
|
174
166
|
binding: async () => (await current()).binding,
|
|
@@ -33,7 +33,6 @@ function catalogFixture(plan, property, fixture) {
|
|
|
33
33
|
return {
|
|
34
34
|
name: fixture.id,
|
|
35
35
|
doc: docFingerprint(fixture.instances),
|
|
36
|
-
...fixture.capturable === false ? { capturable: false } : {},
|
|
37
36
|
...pagesOff.length > 0 ? { pagesOff } : {},
|
|
38
37
|
addresses: fixtureAddresses(plan, property, fixture)
|
|
39
38
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { addressComplete, addressView, normalizeAddressValue } from "../../../template-contracts/dist/address-value.js";
|
|
2
|
-
import { CAPTURE_FILES } from "../../../template-artifact/dist/layout.js";
|
|
3
2
|
|
|
4
3
|
//#region ../../internal/playground/dist/host/download.js
|
|
5
4
|
const PAGE_IMAGE = ".png";
|
|
@@ -18,12 +17,6 @@ function propertyAddressOf(facts) {
|
|
|
18
17
|
function attachmentDisposition(name) {
|
|
19
18
|
return `attachment; filename*=UTF-8''${encodeURIComponent(name)}`;
|
|
20
19
|
}
|
|
21
|
-
function shippedDownloadPath(input) {
|
|
22
|
-
const at = `${input.fixture}/${input.format}/`;
|
|
23
|
-
if (input.file.contentType === "application/pdf") return `${at}${CAPTURE_FILES.document}`;
|
|
24
|
-
if (input.file.contentType === "application/zip") return `${at}${CAPTURE_FILES.bundle}`;
|
|
25
|
-
return `${at}${input.file.page ?? ""}${PAGE_IMAGE}`;
|
|
26
|
-
}
|
|
27
20
|
function correctedDownloadLocation(url, named, owner) {
|
|
28
21
|
const from = `/properties/${encodeURIComponent(named)}/content/`;
|
|
29
22
|
const at = url.pathname.lastIndexOf(from);
|
|
@@ -31,4 +24,4 @@ function correctedDownloadLocation(url, named, owner) {
|
|
|
31
24
|
}
|
|
32
25
|
|
|
33
26
|
//#endregion
|
|
34
|
-
export { attachmentDisposition, correctedDownloadLocation, parseDownloadPath, propertyAddressOf
|
|
27
|
+
export { attachmentDisposition, correctedDownloadLocation, parseDownloadPath, propertyAddressOf };
|
|
@@ -30,20 +30,19 @@ function fixtureAddresses(plan, property, fixture) {
|
|
|
30
30
|
format: format.id,
|
|
31
31
|
href: ROUTES.canvas(property, fixture.id, c.id, format.id)
|
|
32
32
|
})));
|
|
33
|
-
if (!
|
|
34
|
-
const pageImages = plan.downloads === "made" || template.output === "image";
|
|
33
|
+
if (!plan.downloads || pages.length === 0) return { canvas };
|
|
35
34
|
return {
|
|
36
35
|
canvas,
|
|
37
36
|
download: template.formats.map((format) => ({
|
|
38
37
|
format: format.id,
|
|
39
38
|
href: ROUTES.download(property, fixture.id, { format: format.id }),
|
|
40
|
-
pages:
|
|
39
|
+
pages: pages.map((page) => ({
|
|
41
40
|
page: page.id,
|
|
42
41
|
href: ROUTES.download(property, fixture.id, {
|
|
43
42
|
format: format.id,
|
|
44
43
|
page: page.id
|
|
45
44
|
})
|
|
46
|
-
}))
|
|
45
|
+
}))
|
|
47
46
|
}))
|
|
48
47
|
};
|
|
49
48
|
}
|
|
@@ -15,7 +15,7 @@ import { rowImageUploadSave } from "./row-images.js";
|
|
|
15
15
|
import { fixtureMedia, fixtureOwnedMedia, laidValues, propertyContacts, propertyMediaItems, propertyMediaLists, settledComputed, slotProvenance } from "./slots.js";
|
|
16
16
|
import { parseSaveRequest, saveDocuments } from "./save.js";
|
|
17
17
|
import { linkSave, parseLibraryRequest, removeSave, uploadSave } from "./media-saves.js";
|
|
18
|
-
import {
|
|
18
|
+
import { propertyAddressOf } from "./download.js";
|
|
19
19
|
import { OUTPUT_FOLDERS, ROUTES, parseOutputPath } from "../wire.js";
|
|
20
20
|
import { fixtureOperation, parseFixtureOperation } from "./fixture-operations.js";
|
|
21
21
|
import { downloadFilename, downloadStem } from "../../../download-files/dist/names.js";
|
|
@@ -324,7 +324,7 @@ function serveHost(mount, mountedAt = "/") {
|
|
|
324
324
|
function addressPlan(template) {
|
|
325
325
|
return {
|
|
326
326
|
template,
|
|
327
|
-
downloads: template.output
|
|
327
|
+
downloads: template.output !== "website" && downloads === true
|
|
328
328
|
};
|
|
329
329
|
}
|
|
330
330
|
async function catalog() {
|
|
@@ -393,7 +393,7 @@ function serveHost(mount, mountedAt = "/") {
|
|
|
393
393
|
},
|
|
394
394
|
properties: markedProperties(listed.properties.map((property) => catalogProperty(addressPlan(template), listed, property)), jobs === void 0 ? [] : await jobs.list(), (operation) => jobs?.mark(operation)),
|
|
395
395
|
capabilities: {
|
|
396
|
-
download: addressPlan(template).downloads
|
|
396
|
+
download: addressPlan(template).downloads,
|
|
397
397
|
save: saves !== void 0,
|
|
398
398
|
upload: saves !== void 0
|
|
399
399
|
},
|
|
@@ -882,32 +882,6 @@ function serveHost(mount, mountedAt = "/") {
|
|
|
882
882
|
file: asked.file
|
|
883
883
|
};
|
|
884
884
|
}
|
|
885
|
-
async function shippedDownload(at, url) {
|
|
886
|
-
const named = parseDownloadPath(at.rest);
|
|
887
|
-
if (named === null) throw new HostRefusal(404, `There is no download at ${url.pathname}.`);
|
|
888
|
-
const asked = await askedDownload({
|
|
889
|
-
property: at.property,
|
|
890
|
-
fixture: at.fixture,
|
|
891
|
-
format: url.searchParams.get("format"),
|
|
892
|
-
page: named.page
|
|
893
|
-
});
|
|
894
|
-
if (asked.subject.property !== at.property) return new Response(null, {
|
|
895
|
-
status: 308,
|
|
896
|
-
headers: { location: correctedDownloadLocation(url, at.property, asked.subject.property) }
|
|
897
|
-
});
|
|
898
|
-
if (reader.shipped === void 0) throw new HostRefusal(501, "This playground makes no downloads.");
|
|
899
|
-
const path = shippedDownloadPath({
|
|
900
|
-
fixture: asked.fixture.id,
|
|
901
|
-
format: asked.format.id,
|
|
902
|
-
file: asked.file
|
|
903
|
-
});
|
|
904
|
-
const bytes = await reader.shipped(path);
|
|
905
|
-
if (bytes === null) throw new HostRefusal(404, `This publish shipped no ${path.slice(path.indexOf("/") + 1)} for the fixture "${asked.fixture.id}", or a save since has changed it.`);
|
|
906
|
-
return new Response(new Uint8Array(bytes), { headers: {
|
|
907
|
-
"content-type": asked.file.contentType,
|
|
908
|
-
"content-disposition": attachmentDisposition(asked.file.name)
|
|
909
|
-
} });
|
|
910
|
-
}
|
|
911
885
|
async function route(request, url, path) {
|
|
912
886
|
if (path === ROUTES.jobs || path.startsWith(`${ROUTES.jobs}/`)) return jobRoute(request, url, path);
|
|
913
887
|
if (path === "api/probe") return probe(request, url);
|
|
@@ -926,7 +900,7 @@ function serveHost(mount, mountedAt = "/") {
|
|
|
926
900
|
if (path === "api/requirements") return jsonResponse(await requirements(url));
|
|
927
901
|
if (path === "api/facts") return jsonResponse(await facts(url));
|
|
928
902
|
const site = parseOutputPath(path);
|
|
929
|
-
if (site?.output === OUTPUT_FOLDERS.download && site.rest[0] !== ASSETS)
|
|
903
|
+
if (site?.output === OUTPUT_FOLDERS.download && site.rest[0] !== ASSETS) throw new HostRefusal(501, "This playground makes no downloads.");
|
|
930
904
|
if (site?.output === OUTPUT_FOLDERS.site) return siteFile(request, url, site);
|
|
931
905
|
return null;
|
|
932
906
|
}
|
|
@@ -83,7 +83,7 @@ function fixtureReads(env, view, sizes) {
|
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
85
|
function storedFixtures(input) {
|
|
86
|
-
const { env, built
|
|
86
|
+
const { env, built } = input;
|
|
87
87
|
let cached = null;
|
|
88
88
|
const load = async (view) => {
|
|
89
89
|
const build = await built.readAt(view);
|
|
@@ -101,14 +101,7 @@ function storedFixtures(input) {
|
|
|
101
101
|
listedIn: LISTED_IN,
|
|
102
102
|
placements
|
|
103
103
|
});
|
|
104
|
-
const
|
|
105
|
-
const fixtures = loaded.fixtures.map((fixture) => {
|
|
106
|
-
const hosted = hostFixtureOf(fixture, (url) => sizes.get(url));
|
|
107
|
-
return captured === void 0 ? hosted : {
|
|
108
|
-
...hosted,
|
|
109
|
-
capturable: captured.has(fixture.id)
|
|
110
|
-
};
|
|
111
|
-
});
|
|
104
|
+
const fixtures = loaded.fixtures.map((fixture) => hostFixtureOf(fixture, (url) => sizes.get(url)));
|
|
112
105
|
return {
|
|
113
106
|
properties: loaded.properties.map((property) => hostPropertyOf(property, (url) => sizes.get(url))),
|
|
114
107
|
fixtures,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { PLAYGROUND_CLIENT_DIR, PLAYGROUND_DIR } from "../../template-artifact/dist/layout.js";
|
|
2
|
-
import "../../template-artifact/dist/index.js";
|
|
3
1
|
import { resolve } from "node:path";
|
|
4
2
|
|
|
5
3
|
//#region ../../internal/playground/dist/layout.js
|
|
4
|
+
const CLIENT_DIR = "client";
|
|
5
|
+
const CANVAS_ISLAND_HOST = "island-canvas-host.mjs";
|
|
6
6
|
function playgroundDistDir(packageRoot) {
|
|
7
|
-
return resolve(packageRoot, "dist", "artifact",
|
|
7
|
+
return resolve(packageRoot, "dist", "artifact", "playground");
|
|
8
8
|
}
|
|
9
9
|
function playgroundClientDir(playgroundDir) {
|
|
10
|
-
return resolve(playgroundDir,
|
|
10
|
+
return resolve(playgroundDir, CLIENT_DIR);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
//#endregion
|
|
14
|
-
export { playgroundClientDir, playgroundDistDir };
|
|
14
|
+
export { CANVAS_ISLAND_HOST, playgroundClientDir, playgroundDistDir };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region ../../internal/playground/dist/send-wire.js
|
|
2
|
+
const CONSOLE_KEY_HEADER = "console-key";
|
|
3
|
+
const SEND_ROUTE = "/api/sends";
|
|
4
|
+
const CONTENT_ROUTE = "/api/contents/";
|
|
5
|
+
const VERDICT_ROUTE = "/api/verdicts";
|
|
6
|
+
const RELEASE_ROUTE = "/api/releases";
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
export { CONSOLE_KEY_HEADER, CONTENT_ROUTE, RELEASE_ROUTE, SEND_ROUTE, VERDICT_ROUTE };
|