@capyclaw/ppt-suite 2.5.69 → 2.5.71
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/composition.lock.json +27 -27
- package/contract/ppt-contract.json +27 -1
- package/dsh-suite.json +27 -17
- package/node_modules/@capyclaw/asset-service/dsh-suite.json +1 -1
- package/node_modules/@capyclaw/asset-service/package.json +1 -1
- package/node_modules/@capyclaw/asset-service/src/index.mjs +4 -3
- package/node_modules/@capyclaw/document-workbench/package.json +6 -3
- package/node_modules/@capyclaw/document-workbench/src/client/index.mjs +56 -3
- package/node_modules/@capyclaw/document-workbench/src/client/visibility.mjs +112 -0
- package/node_modules/@capyclaw/document-workbench/src/model/manifest.mjs +6 -4
- package/node_modules/@capyclaw/document-workbench/src/model/ops.mjs +7 -2
- package/node_modules/@capyclaw/document-workbench/src/session/index.mjs +8 -0
- package/node_modules/@capyclaw/document-workbench/src/store/file-backend.mjs +17 -10
- package/node_modules/@capyclaw/document-workbench/src/store/projection.mjs +39 -0
- package/node_modules/@capyclaw/document-workbench/src/testing/index.mjs +14 -11
- package/node_modules/@capyclaw/editor-host/dsh-suite.json +1 -1
- package/node_modules/@capyclaw/editor-host/package.json +1 -1
- package/node_modules/@capyclaw/editor-host/src/index.mjs +12 -21
- package/node_modules/@capyclaw/foundation/abi/assets.mjs +26 -0
- package/node_modules/@capyclaw/foundation/abi/bridge.mjs +3 -1
- package/node_modules/@capyclaw/foundation/abi/index.mjs +15 -0
- package/node_modules/@capyclaw/foundation/abi/visibility.mjs +90 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/lifecycle-hook.mjs +21 -4
- package/node_modules/@capyclaw/foundation/lib/host/caps.mjs +5 -1
- package/node_modules/@capyclaw/foundation/lib/host/contract.mjs +5 -2
- package/node_modules/@capyclaw/foundation/lib/host/dsh.mjs +4 -0
- package/node_modules/@capyclaw/foundation/lib/host/memory.mjs +29 -2
- package/node_modules/@capyclaw/foundation/lib/kernel.mjs +13 -3
- package/node_modules/@capyclaw/foundation/package.json +1 -1
- package/node_modules/@capyclaw/plugin-kit/package.json +3 -1
- package/node_modules/@capyclaw/plugin-kit/src/editor/heartbeat-worker.js +5 -2
- package/node_modules/@capyclaw/plugin-kit/src/editor/heartbeat.mjs +26 -0
- package/node_modules/@capyclaw/plugin-kit/src/editor/lease.mjs +3 -1
- package/node_modules/@capyclaw/plugin-kit/src/service/static.mjs +79 -0
- package/node_modules/@capyclaw/plugin-kit/src/workspace/manager.mjs +13 -5
- package/node_modules/@capyclaw/portal/package.json +1 -1
- package/node_modules/@capyclaw/ppt-editor/app.js +458 -10
- package/node_modules/@capyclaw/ppt-editor/contract/ppt-contract.json +27 -1
- package/node_modules/@capyclaw/ppt-editor/heartbeat-worker.js +5 -2
- package/node_modules/@capyclaw/ppt-editor/index.html +4 -0
- package/node_modules/@capyclaw/ppt-editor/package.json +2 -2
- package/node_modules/@capyclaw/ppt-skill-api/contract/ppt-contract.json +27 -1
- package/node_modules/@capyclaw/ppt-skill-api/package.json +1 -1
- package/node_modules/@capyclaw/ppt-skill-api/skills/pptist-api/references/tool-contract.md +1 -1
- package/node_modules/@capyclaw/ppt-skill-proposal/contract/ppt-contract.json +27 -1
- package/node_modules/@capyclaw/ppt-skill-proposal/package.json +1 -1
- package/node_modules/@capyclaw/ppt-workbench/contract/ppt-contract.json +27 -1
- package/node_modules/@capyclaw/ppt-workbench/core/deck-layout.js +3 -1
- package/node_modules/@capyclaw/ppt-workbench/core/ops/slide.js +9 -3
- package/node_modules/@capyclaw/ppt-workbench/core/text.js +14 -2
- package/node_modules/@capyclaw/ppt-workbench/package.json +10 -8
- package/node_modules/@capyclaw/ppt-workbench/plugin.mjs +13 -1
- package/node_modules/@capyclaw/ppt-workbench/server/contract.mjs +1 -1
- package/node_modules/@capyclaw/ppt-workbench/server/embedded-host.mjs +201 -20
- package/node_modules/@capyclaw/ppt-workbench/server/relay.mjs +10 -7
- package/node_modules/@capyclaw/ppt-workbench/server/shared/SHARED_MANIFEST.json +4 -4
- package/node_modules/@capyclaw/ppt-workbench/server/store/backends/file-backend.mjs +3 -0
- package/node_modules/@capyclaw/ppt-workbench/server/store/checkpoints.mjs +4 -1
- package/node_modules/@capyclaw/ppt-workbench/server/store/index.mjs +4 -0
- package/node_modules/@capyclaw/ppt-workbench/server/store/sessions.mjs +139 -4
- package/node_modules/@capyclaw/ppt-workbench/server/store/shape.mjs +37 -0
- package/node_modules/@capyclaw/ppt-workbench/server/workbench-framework.mjs +34 -0
- package/node_modules/@capyclaw/service-broker/README.md +1 -1
- package/node_modules/@capyclaw/service-broker/lib/control.mjs +23 -7
- package/node_modules/@capyclaw/service-broker/lib/engine.mjs +60 -6
- package/node_modules/@capyclaw/service-broker/lib/host.mjs +11 -6
- package/node_modules/@capyclaw/service-broker/lib/skills-client.mjs +30 -10
- package/node_modules/@capyclaw/service-broker/package.json +1 -1
- package/node_modules/@capyclaw/service-host/dsh-suite.json +1 -1
- package/node_modules/@capyclaw/service-host/package.json +1 -1
- package/node_modules/@capyclaw/service-host/src/index.mjs +13 -22
- package/node_modules/@capyclaw/skills-service/README.md +42 -10
- package/node_modules/@capyclaw/skills-service/package.json +6 -3
- package/node_modules/@capyclaw/skills-service/server.mjs +129 -51
- package/node_modules/@capyclaw/suite-kit/README.md +289 -0
- package/node_modules/@capyclaw/suite-kit/bin/dsh-domain.mjs +98 -0
- package/node_modules/@capyclaw/suite-kit/bin/dsh-suite.mjs +174 -0
- package/node_modules/@capyclaw/suite-kit/client/embed.js +35 -0
- package/node_modules/@capyclaw/suite-kit/domain.schema.json +129 -0
- package/node_modules/@capyclaw/suite-kit/package.json +58 -0
- package/node_modules/@capyclaw/suite-kit/src/activation-registry.mjs +184 -0
- package/node_modules/@capyclaw/suite-kit/src/artifacts.mjs +131 -0
- package/node_modules/@capyclaw/suite-kit/src/capability.mjs +181 -0
- package/node_modules/@capyclaw/suite-kit/src/compose.mjs +201 -0
- package/node_modules/@capyclaw/suite-kit/src/domain.mjs +138 -0
- package/node_modules/@capyclaw/suite-kit/src/embed.mjs +81 -0
- package/node_modules/@capyclaw/suite-kit/src/host.mjs +230 -0
- package/node_modules/@capyclaw/suite-kit/src/index.mjs +24 -0
- package/node_modules/@capyclaw/suite-kit/src/manifest.mjs +263 -0
- package/node_modules/@capyclaw/suite-kit/src/orchestration.mjs +100 -0
- package/node_modules/@capyclaw/suite-kit/src/profile.mjs +584 -0
- package/node_modules/@capyclaw/suite-kit/src/surface.mjs +28 -0
- package/node_modules/@capyclaw/suite-kit/suite.schema.json +128 -0
- package/node_modules/@capyclaw/tool-host/dsh-suite.json +2 -2
- package/node_modules/@capyclaw/tool-host/lib/host.mjs +34 -4
- package/node_modules/@capyclaw/tool-host/package.json +1 -1
- package/node_modules/@capyclaw/tool-host/src/admit-images.mjs +80 -0
- package/node_modules/@capyclaw/tool-host/src/caller-session.mjs +25 -0
- package/node_modules/@capyclaw/tool-host/src/index.mjs +59 -14
- package/node_modules/@capyclaw/tool-host/src/mode-gate.mjs +272 -0
- package/node_modules/@capyclaw/work-store/README.md +83 -0
- package/node_modules/@capyclaw/work-store/STANDARD.md +263 -0
- package/node_modules/@capyclaw/work-store/cordis.patch.yml +3 -0
- package/node_modules/@capyclaw/work-store/dsh-suite.json +33 -0
- package/node_modules/@capyclaw/work-store/icon.svg +7 -0
- package/node_modules/@capyclaw/work-store/lib/host.mjs +21 -0
- package/node_modules/@capyclaw/work-store/package.json +68 -0
- package/node_modules/@capyclaw/work-store/src/backend.mjs +90 -0
- package/node_modules/@capyclaw/work-store/src/db.mjs +199 -0
- package/node_modules/@capyclaw/work-store/src/envelope.mjs +132 -0
- package/node_modules/@capyclaw/work-store/src/index.mjs +571 -0
- package/node_modules/@capyclaw/work-store/src/interop.mjs +70 -0
- package/node_modules/@capyclaw/work-store/src/refs.mjs +99 -0
- package/node_modules/@capyclaw/work-store/src/routes.mjs +135 -0
- package/node_modules/playwright-core/LICENSE +202 -0
- package/node_modules/playwright-core/NOTICE +5 -0
- package/node_modules/playwright-core/README.md +3 -0
- package/node_modules/playwright-core/ThirdPartyNotices.txt +13 -0
- package/node_modules/playwright-core/bin/install_media_pack.ps1 +5 -0
- package/node_modules/playwright-core/bin/install_webkit_wsl.ps1 +33 -0
- package/node_modules/playwright-core/bin/reinstall_chrome_beta_linux.sh +42 -0
- package/node_modules/playwright-core/bin/reinstall_chrome_beta_mac.sh +13 -0
- package/node_modules/playwright-core/bin/reinstall_chrome_beta_win.ps1 +24 -0
- package/node_modules/playwright-core/bin/reinstall_chrome_stable_linux.sh +42 -0
- package/node_modules/playwright-core/bin/reinstall_chrome_stable_mac.sh +12 -0
- package/node_modules/playwright-core/bin/reinstall_chrome_stable_win.ps1 +24 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_beta_linux.sh +48 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_beta_mac.sh +11 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_beta_win.ps1 +23 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_dev_linux.sh +48 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_dev_mac.sh +11 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_dev_win.ps1 +23 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_stable_linux.sh +48 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_stable_mac.sh +11 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_stable_win.ps1 +24 -0
- package/node_modules/playwright-core/browsers.json +52 -0
- package/node_modules/playwright-core/cli.js +22 -0
- package/node_modules/playwright-core/index.d.ts +17 -0
- package/node_modules/playwright-core/index.js +17 -0
- package/node_modules/playwright-core/index.mjs +28 -0
- package/node_modules/playwright-core/lib/bootstrap.js +149 -0
- package/node_modules/playwright-core/lib/coreBundle.js +78041 -0
- package/node_modules/playwright-core/lib/entry/cliDaemon.js +5 -0
- package/node_modules/playwright-core/lib/entry/dashboardApp.js +3 -0
- package/node_modules/playwright-core/lib/entry/mcp.js +10 -0
- package/node_modules/playwright-core/lib/entry/oopBrowserDownload.js +3 -0
- package/node_modules/playwright-core/lib/package.js +50 -0
- package/node_modules/playwright-core/lib/server/chromium/appIcon.png +0 -0
- package/node_modules/playwright-core/lib/server/electron/loader.js +123 -0
- package/node_modules/playwright-core/lib/serverRegistry.js +1939 -0
- package/node_modules/playwright-core/lib/serverRegistry.js.LICENSE +65 -0
- package/node_modules/playwright-core/lib/tools/cli-client/channelSessions.js +141 -0
- package/node_modules/playwright-core/lib/tools/cli-client/cli.js +7 -0
- package/node_modules/playwright-core/lib/tools/cli-client/help.json +808 -0
- package/node_modules/playwright-core/lib/tools/cli-client/minimist.js +128 -0
- package/node_modules/playwright-core/lib/tools/cli-client/output.js +352 -0
- package/node_modules/playwright-core/lib/tools/cli-client/program.js +422 -0
- package/node_modules/playwright-core/lib/tools/cli-client/registry.js +180 -0
- package/node_modules/playwright-core/lib/tools/cli-client/session.js +261 -0
- package/node_modules/playwright-core/lib/tools/dashboard/appIcon.png +0 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/SKILL.md +493 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/element-attributes.md +23 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/playwright-tests.md +39 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/pr-attachments.md +60 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/request-mocking.md +87 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/running-code.md +245 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/session-management.md +227 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/storage-state.md +275 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/test-generation.md +433 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/tracing.md +139 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/video-recording.md +216 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/SKILL.md +136 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/gallery-spec.md +144 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/migration.md +89 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/react.md +69 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/typing.md +173 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/vue.md +77 -0
- package/node_modules/playwright-core/lib/tools/skills/playwright-trace/SKILL.md +174 -0
- package/node_modules/playwright-core/lib/tools/utils/extension.js +112 -0
- package/node_modules/playwright-core/lib/tools/utils/socketConnection.js +108 -0
- package/node_modules/playwright-core/lib/utilsBundle.js +86078 -0
- package/node_modules/playwright-core/lib/utilsBundle.js.LICENSE +1890 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/codeMirrorModule--QdMvsKi.css +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/codeMirrorModule-CQ8RZGBm.js +32 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/codicon-DCmgc-ay.ttf +0 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/firefox-1bWoP6pv.svg +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/firefox-beta-k3eOH_eK.svg +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/firefox-nightly-Cp5nfeDT.svg +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/index-AwgwcYie.css +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/index-hRvO4yU2.js +12 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/safari-na3_-uQk.svg +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/index.html +29 -0
- package/node_modules/playwright-core/lib/vite/dashboard/playwright-logo.svg +24 -0
- package/node_modules/playwright-core/lib/vite/htmlReport/index.html +16 -0
- package/node_modules/playwright-core/lib/vite/htmlReport/report.css +2 -0
- package/node_modules/playwright-core/lib/vite/htmlReport/report.js +32 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule--QdMvsKi.css +1 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-DK72OMRi.js +32 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/index-BZpYJZ-P.css +1 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/index-Cn0mmDuv.js +129 -0
- package/node_modules/playwright-core/lib/vite/recorder/index.html +29 -0
- package/node_modules/playwright-core/lib/vite/recorder/playwright-logo.svg +9 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/codeMirrorModule-BEB2e8M3.js +32 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/defaultSettingsView-D-g2vrvf.js +184 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/urlMatch-L3liM589.js +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/xtermModule-B794rD2Z.js +7 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/codeMirrorModule.-QdMvsKi.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/defaultSettingsView.C8BeHuxd.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/index.B_TqY17P.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/index.html +44 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/index.oNry3Hjv.js +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/manifest.webmanifest +16 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/playwright-logo.svg +9 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/snapshot.B_Jk1wbt.js +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/snapshot.html +10 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/sw.bundle.js +4 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.CYwC_gH1.js +5 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.CyMfwkXJ.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.html +18 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/xtermModule.kHJ-D0s7.css +1 -0
- package/node_modules/playwright-core/lib/webp_codec.LICENSE +173 -0
- package/node_modules/playwright-core/lib/webp_codec.wasm +0 -0
- package/node_modules/playwright-core/lib/xdg-open +1267 -0
- package/node_modules/playwright-core/package.json +34 -0
- package/node_modules/playwright-core/types/protocol.d.ts +24776 -0
- package/node_modules/playwright-core/types/structs.d.ts +52 -0
- package/node_modules/playwright-core/types/types.d.ts +27167 -0
- package/package.json +17 -15
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 引用标准:结构化正文里只写 `@asset/<sha256>`,字节在内容寻址 blob 仓,
|
|
3
|
+
* 读时展开成可加载地址。`@media/<sha>` 是 PPT 历史别名,一视同仁地解析。
|
|
4
|
+
*
|
|
5
|
+
* 两个纯工具,套件无关:
|
|
6
|
+
* extractDataUris(value, putAsset) 写入闸:把内联 data: URI 抽进 blob 仓换引用
|
|
7
|
+
* resolveRefs(value, urlBase) 读取展开:@asset/@media → <urlBase>/assets/<sha>
|
|
8
|
+
* collectRefs(value) 收集正文里引用的全部 blob id(供 work_assets 索引)
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const ASSET_REF = /@asset\/([a-f0-9]{64})/gi
|
|
12
|
+
const MEDIA_REF = /@media\/([a-f0-9]{8,64})/gi
|
|
13
|
+
const DATA_URI = /^data:([^;,]+);base64,([A-Za-z0-9+/=\s]+)$/
|
|
14
|
+
|
|
15
|
+
/** 内联字节超过这个阈值才抽进 blob 仓(小图标留着无妨)。 */
|
|
16
|
+
export const EXTRACT_THRESHOLD = 2048
|
|
17
|
+
|
|
18
|
+
export function isAssetRef(text) {
|
|
19
|
+
return typeof text === 'string' && (ASSET_REF.test(text) || MEDIA_REF.test(text))
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** 收集一个 JSON 值里引用的全部 blob id(去重)。 */
|
|
23
|
+
export function collectRefs(value) {
|
|
24
|
+
const found = new Set()
|
|
25
|
+
const walk = (node) => {
|
|
26
|
+
if (typeof node === 'string') {
|
|
27
|
+
for (const re of [ASSET_REF, MEDIA_REF]) {
|
|
28
|
+
re.lastIndex = 0
|
|
29
|
+
let m
|
|
30
|
+
while ((m = re.exec(node))) found.add(m[1].toLowerCase())
|
|
31
|
+
}
|
|
32
|
+
} else if (Array.isArray(node)) {
|
|
33
|
+
node.forEach(walk)
|
|
34
|
+
} else if (node && typeof node === 'object') {
|
|
35
|
+
Object.values(node).forEach(walk)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
walk(value)
|
|
39
|
+
return [...found]
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* 读取展开:把 @asset/<sha> 与 @media/<sha> 换成 `<urlBase>/assets/<sha>`。
|
|
44
|
+
* 返回**新副本**,不改原值(与 PPT 的就地 expand 不同,底座要纯)。
|
|
45
|
+
*/
|
|
46
|
+
export function resolveRefs(value, urlBase) {
|
|
47
|
+
const base = String(urlBase || '').replace(/\/$/, '')
|
|
48
|
+
const sub = (text) => text
|
|
49
|
+
.replace(ASSET_REF, (_m, sha) => `${base}/assets/${sha.toLowerCase()}`)
|
|
50
|
+
.replace(MEDIA_REF, (_m, sha) => `${base}/assets/${sha.toLowerCase()}`)
|
|
51
|
+
const walk = (node) => {
|
|
52
|
+
if (typeof node === 'string') return sub(node)
|
|
53
|
+
if (Array.isArray(node)) return node.map(walk)
|
|
54
|
+
if (node && typeof node === 'object') {
|
|
55
|
+
const out = {}
|
|
56
|
+
for (const [k, v] of Object.entries(node)) out[k] = walk(v)
|
|
57
|
+
return out
|
|
58
|
+
}
|
|
59
|
+
return node
|
|
60
|
+
}
|
|
61
|
+
return walk(value)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* 写入闸:递归扫描,把超阈值的内联 data: URI 抽进 blob 仓,换成 @asset/<sha>。
|
|
66
|
+
* putAsset(buffer, contentType) → { id }(通常接 ctx.assets 的 put)。
|
|
67
|
+
* 返回 { value, extracted:[{ id, mime, size }] }。value 是新副本。
|
|
68
|
+
*/
|
|
69
|
+
export async function extractDataUris(value, putAsset, options = {}) {
|
|
70
|
+
const threshold = Number(options.threshold ?? EXTRACT_THRESHOLD)
|
|
71
|
+
const extracted = []
|
|
72
|
+
const walk = async (node) => {
|
|
73
|
+
if (typeof node === 'string') {
|
|
74
|
+
const m = DATA_URI.exec(node)
|
|
75
|
+
if (!m) return node
|
|
76
|
+
const mime = m[1]
|
|
77
|
+
const buf = Buffer.from(m[2].replace(/\s/g, ''), 'base64')
|
|
78
|
+
if (!buf.length || buf.length < threshold) return node
|
|
79
|
+
const asset = await putAsset(buf, mime)
|
|
80
|
+
const id = String(asset?.id || '').toLowerCase()
|
|
81
|
+
if (!/^[a-f0-9]{64}$/.test(id)) return node
|
|
82
|
+
extracted.push({ id, mime, size: buf.length })
|
|
83
|
+
return `@asset/${id}`
|
|
84
|
+
}
|
|
85
|
+
if (Array.isArray(node)) {
|
|
86
|
+
const out = []
|
|
87
|
+
for (const item of node) out.push(await walk(item))
|
|
88
|
+
return out
|
|
89
|
+
}
|
|
90
|
+
if (node && typeof node === 'object') {
|
|
91
|
+
const out = {}
|
|
92
|
+
for (const [k, v] of Object.entries(node)) out[k] = await walk(v)
|
|
93
|
+
return out
|
|
94
|
+
}
|
|
95
|
+
return node
|
|
96
|
+
}
|
|
97
|
+
const next = await walk(value)
|
|
98
|
+
return { value: next, extracted }
|
|
99
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 前端查询面:把 work-store 的目录/版本/文档暴露成 HTTP,供后期的本地作品浏览界面调用。
|
|
3
|
+
* 只读为主(浏览),写操作走服务 API;额外给一个 rollback 便利口。
|
|
4
|
+
*
|
|
5
|
+
* GET <base>/works 列表(suite/kind/session/status/tag/q/sort/limit/offset)
|
|
6
|
+
* GET <base>/works/stats 分类统计(仪表盘)
|
|
7
|
+
* GET <base>/works/<id> 单个作品(目录元数据 + 当前状态摘要)
|
|
8
|
+
* GET <base>/works/<id>/document 当前领域文档(?key=deck)
|
|
9
|
+
* GET <base>/works/<id>/versions 版本列表
|
|
10
|
+
* GET <base>/works/<id>/version/<n> 某版本快照
|
|
11
|
+
* GET <base>/works/<id>/assets 引用的 blob 清单
|
|
12
|
+
* POST <base>/works/<id>/rollback { version } 回滚
|
|
13
|
+
*
|
|
14
|
+
* 与 asset-service 一样返回裸 handler(req,res,u),由宿主的 prefix 路由挂载。
|
|
15
|
+
*/
|
|
16
|
+
import { send, readBody } from '@capyclaw/plugin-kit/service/http'
|
|
17
|
+
|
|
18
|
+
export function createWorkRoutes({ store, basePath = '/works' }) {
|
|
19
|
+
if (!store) throw new Error('createWorkRoutes 需要 store')
|
|
20
|
+
const base = String(basePath).replace(/\/$/, '')
|
|
21
|
+
|
|
22
|
+
return async function workRoutes(req, res, u) {
|
|
23
|
+
const p = u.pathname
|
|
24
|
+
if (!p.startsWith(base)) return false
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
if (req.method === 'GET' && p === `${base}/works`) {
|
|
28
|
+
const q = u.searchParams
|
|
29
|
+
const result = store.listWorks({
|
|
30
|
+
suite: q.get('suite') || undefined,
|
|
31
|
+
kind: q.get('kind') || undefined,
|
|
32
|
+
sessionId: q.get('session') ?? undefined,
|
|
33
|
+
status: q.has('status') ? Number(q.get('status')) : undefined,
|
|
34
|
+
tag: q.get('tag') || undefined,
|
|
35
|
+
query: q.get('q') || undefined,
|
|
36
|
+
sort: q.get('sort') || undefined,
|
|
37
|
+
limit: q.get('limit') ? Number(q.get('limit')) : undefined,
|
|
38
|
+
offset: q.get('offset') ? Number(q.get('offset')) : undefined,
|
|
39
|
+
includeDeleted: q.get('deleted') === '1',
|
|
40
|
+
})
|
|
41
|
+
send(req, res, 200, result)
|
|
42
|
+
return true
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (req.method === 'GET' && p === `${base}/works/stats`) {
|
|
46
|
+
send(req, res, 200, store.stats())
|
|
47
|
+
return true
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* ---- 产物信封查询面(workStore.artifacts,docs/suite-interop-standard.md §B) ---- */
|
|
51
|
+
if (req.method === 'GET' && p === `${base}/artifacts`) {
|
|
52
|
+
const q = u.searchParams
|
|
53
|
+
send(req, res, 200, store.listArtifacts({
|
|
54
|
+
workId: q.get('work') || undefined,
|
|
55
|
+
sessionId: q.get('session') ?? undefined,
|
|
56
|
+
type: q.get('type') || undefined,
|
|
57
|
+
producer: q.get('producer') || undefined,
|
|
58
|
+
producerSuite: q.get('suite') || undefined,
|
|
59
|
+
query: q.get('q') || undefined,
|
|
60
|
+
sort: q.get('sort') || undefined,
|
|
61
|
+
limit: q.get('limit') ? Number(q.get('limit')) : undefined,
|
|
62
|
+
offset: q.get('offset') ? Number(q.get('offset')) : undefined,
|
|
63
|
+
includeDeleted: q.get('deleted') === '1',
|
|
64
|
+
}))
|
|
65
|
+
return true
|
|
66
|
+
}
|
|
67
|
+
if (req.method === 'GET' && p.startsWith(`${base}/artifacts/`)) {
|
|
68
|
+
const restA = p.slice(`${base}/artifacts/`.length)
|
|
69
|
+
const [aid, ...atail] = restA.split('/')
|
|
70
|
+
const artifactId = decodeURIComponent(aid)
|
|
71
|
+
if (atail[0] === 'chain') {
|
|
72
|
+
send(req, res, 200, { artifactId, chain: store.artifactChain(artifactId) })
|
|
73
|
+
return true
|
|
74
|
+
}
|
|
75
|
+
const env = store.getArtifact(artifactId)
|
|
76
|
+
if (!env) { send(req, res, 404, { error: 'artifact not found' }); return true }
|
|
77
|
+
const urlBase = u.searchParams.get('base')
|
|
78
|
+
send(req, res, 200, urlBase ? store.resolveArtifact(artifactId, urlBase) : env)
|
|
79
|
+
return true
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const rest = p.slice(`${base}/works/`.length)
|
|
83
|
+
if (!p.startsWith(`${base}/works/`) || !rest) return false
|
|
84
|
+
const [id, ...tail] = rest.split('/')
|
|
85
|
+
const workId = decodeURIComponent(id)
|
|
86
|
+
|
|
87
|
+
if (req.method === 'GET' && tail.length === 0) {
|
|
88
|
+
const work = store.getWork(workId)
|
|
89
|
+
if (!work) { send(req, res, 404, { error: 'work not found' }); return true }
|
|
90
|
+
const state = store.readState(workId)
|
|
91
|
+
send(req, res, 200, { work, hasState: state != null, seq: state?.seq | 0, assets: store.listAssets(workId) })
|
|
92
|
+
return true
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (req.method === 'GET' && tail[0] === 'document') {
|
|
96
|
+
const key = u.searchParams.get('key') || undefined
|
|
97
|
+
const doc = store.getDocument(workId, key)
|
|
98
|
+
if (doc == null) { send(req, res, 404, { error: 'document not found' }); return true }
|
|
99
|
+
send(req, res, 200, { workId, key: key || null, document: doc })
|
|
100
|
+
return true
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (req.method === 'GET' && tail[0] === 'versions') {
|
|
104
|
+
send(req, res, 200, { workId, versions: store.listVersions(workId) })
|
|
105
|
+
return true
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (req.method === 'GET' && tail[0] === 'version' && tail[1]) {
|
|
109
|
+
const v = store.getVersion(workId, Number(tail[1]))
|
|
110
|
+
if (!v) { send(req, res, 404, { error: 'version not found' }); return true }
|
|
111
|
+
send(req, res, 200, v)
|
|
112
|
+
return true
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (req.method === 'GET' && tail[0] === 'assets') {
|
|
116
|
+
send(req, res, 200, { workId, assets: store.listAssets(workId) })
|
|
117
|
+
return true
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (req.method === 'POST' && tail[0] === 'rollback') {
|
|
121
|
+
const body = await readBody(req, 64 * 1024)
|
|
122
|
+
const version = Number(body?.version)
|
|
123
|
+
if (!Number.isInteger(version)) { send(req, res, 400, { error: '缺少 version' }); return true }
|
|
124
|
+
const work = store.rollback(workId, version)
|
|
125
|
+
send(req, res, 200, { work })
|
|
126
|
+
return true
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return false
|
|
130
|
+
} catch (error) {
|
|
131
|
+
send(req, res, 500, { error: String(error?.message || error) })
|
|
132
|
+
return true
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Portions Copyright (c) Microsoft Corporation.
|
|
190
|
+
Portions Copyright 2017 Google Inc.
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
microsoft/playwright-core
|
|
2
|
+
|
|
3
|
+
THIRD-PARTY SOFTWARE NOTICES AND INFORMATION
|
|
4
|
+
|
|
5
|
+
This package bundles third-party software inside individual files under
|
|
6
|
+
`lib/`. Each bundled output has a sidecar `<bundle>.js.LICENSE` file next
|
|
7
|
+
to it listing every npm package whose source was inlined into that
|
|
8
|
+
bundle, together with the full license text for each.
|
|
9
|
+
|
|
10
|
+
For example:
|
|
11
|
+
- lib/utilsBundle.js.LICENSE
|
|
12
|
+
|
|
13
|
+
This project incorporates components from the projects listed below. The original copyright notices and the licenses under which Microsoft received such components are set forth below. Microsoft reserves all rights not expressly granted herein, whether by implication, estoppel or otherwise.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
$ErrorActionPreference = 'Stop'
|
|
2
|
+
|
|
3
|
+
# This script sets up a WSL distribution that will be used to run WebKit.
|
|
4
|
+
|
|
5
|
+
$Distribution = "playwright"
|
|
6
|
+
$Username = "pwuser"
|
|
7
|
+
|
|
8
|
+
$distributions = (wsl --list --quiet) -split "\r?\n"
|
|
9
|
+
if ($distributions -contains $Distribution) {
|
|
10
|
+
Write-Host "WSL distribution '$Distribution' already exists. Skipping installation."
|
|
11
|
+
} else {
|
|
12
|
+
Write-Host "Installing new WSL distribution '$Distribution'..."
|
|
13
|
+
$VhdSize = "10GB"
|
|
14
|
+
wsl --install -d Ubuntu-24.04 --name $Distribution --no-launch --vhd-size $VhdSize
|
|
15
|
+
wsl -d $Distribution -u root adduser --gecos GECOS --disabled-password $Username
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
$pwshDirname = (Resolve-Path -Path $PSScriptRoot).Path;
|
|
19
|
+
$playwrightCoreRoot = Resolve-Path (Join-Path $pwshDirname "..")
|
|
20
|
+
|
|
21
|
+
$initScript = @"
|
|
22
|
+
if [ ! -f "/home/$Username/node/bin/node" ]; then
|
|
23
|
+
mkdir -p /home/$Username/node
|
|
24
|
+
curl -fsSL https://nodejs.org/dist/v22.17.0/node-v22.17.0-linux-x64.tar.xz -o /home/$Username/node/node-v22.17.0-linux-x64.tar.xz
|
|
25
|
+
tar -xJf /home/$Username/node/node-v22.17.0-linux-x64.tar.xz -C /home/$Username/node --strip-components=1
|
|
26
|
+
sudo -u $Username echo 'export PATH=/home/$Username/node/bin:\`$PATH' >> /home/$Username/.profile
|
|
27
|
+
fi
|
|
28
|
+
/home/$Username/node/bin/node cli.js install-deps webkit
|
|
29
|
+
sudo -u $Username PLAYWRIGHT_SKIP_BROWSER_GC=1 /home/$Username/node/bin/node cli.js install webkit
|
|
30
|
+
"@ -replace "\r\n", "`n"
|
|
31
|
+
|
|
32
|
+
wsl -d $Distribution --cd $playwrightCoreRoot -u root -- bash -c "$initScript"
|
|
33
|
+
Write-Host "Done!"
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -e
|
|
3
|
+
set -x
|
|
4
|
+
|
|
5
|
+
if [[ $(arch) == "aarch64" ]]; then
|
|
6
|
+
echo "ERROR: not supported on Linux Arm64"
|
|
7
|
+
exit 1
|
|
8
|
+
fi
|
|
9
|
+
|
|
10
|
+
if [ -z "$PLAYWRIGHT_HOST_PLATFORM_OVERRIDE" ]; then
|
|
11
|
+
if [[ ! -f "/etc/os-release" ]]; then
|
|
12
|
+
echo "ERROR: cannot install on unknown linux distribution (/etc/os-release is missing)"
|
|
13
|
+
exit 1
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
ID=$(bash -c 'source /etc/os-release && echo $ID')
|
|
17
|
+
if [[ "${ID}" != "ubuntu" && "${ID}" != "debian" ]]; then
|
|
18
|
+
echo "ERROR: cannot install on $ID distribution - only Ubuntu and Debian are supported"
|
|
19
|
+
exit 1
|
|
20
|
+
fi
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
# 1. make sure to remove old beta if any.
|
|
24
|
+
if dpkg --get-selections | grep -q "^google-chrome-beta[[:space:]]*install$" >/dev/null; then
|
|
25
|
+
apt-get remove -y google-chrome-beta
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
# 2. Update apt lists (needed to install curl and chrome dependencies)
|
|
29
|
+
apt-get update
|
|
30
|
+
|
|
31
|
+
# 3. Install curl to download chrome
|
|
32
|
+
if ! command -v curl >/dev/null; then
|
|
33
|
+
apt-get install -y curl
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
# 4. download chrome beta from dl.google.com and install it.
|
|
37
|
+
cd /tmp
|
|
38
|
+
curl -L -O https://dl.google.com/linux/direct/google-chrome-beta_current_amd64.deb
|
|
39
|
+
apt-get install -y ./google-chrome-beta_current_amd64.deb
|
|
40
|
+
rm -rf ./google-chrome-beta_current_amd64.deb
|
|
41
|
+
cd -
|
|
42
|
+
google-chrome-beta --version
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -e
|
|
3
|
+
set -x
|
|
4
|
+
|
|
5
|
+
rm -rf "/Applications/Google Chrome Beta.app"
|
|
6
|
+
cd /tmp
|
|
7
|
+
curl -L --retry 3 -o ./googlechromebeta.dmg https://dl.google.com/chrome/mac/universal/beta/googlechromebeta.dmg
|
|
8
|
+
hdiutil attach -nobrowse -quiet -noautofsck -noautoopen -mountpoint /Volumes/googlechromebeta.dmg ./googlechromebeta.dmg
|
|
9
|
+
cp -pR "/Volumes/googlechromebeta.dmg/Google Chrome Beta.app" /Applications
|
|
10
|
+
hdiutil detach /Volumes/googlechromebeta.dmg
|
|
11
|
+
rm -rf /tmp/googlechromebeta.dmg
|
|
12
|
+
|
|
13
|
+
/Applications/Google\ Chrome\ Beta.app/Contents/MacOS/Google\ Chrome\ Beta --version
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
$ErrorActionPreference = 'Stop'
|
|
2
|
+
|
|
3
|
+
$url = 'https://dl.google.com/tag/s/dl/chrome/install/beta/googlechromebetastandaloneenterprise64.msi'
|
|
4
|
+
|
|
5
|
+
Write-Host "Downloading Google Chrome Beta"
|
|
6
|
+
$wc = New-Object net.webclient
|
|
7
|
+
$msiInstaller = "$env:temp\google-chrome-beta.msi"
|
|
8
|
+
$wc.Downloadfile($url, $msiInstaller)
|
|
9
|
+
|
|
10
|
+
Write-Host "Installing Google Chrome Beta"
|
|
11
|
+
$arguments = "/i `"$msiInstaller`" /quiet"
|
|
12
|
+
Start-Process msiexec.exe -ArgumentList $arguments -Wait
|
|
13
|
+
Remove-Item $msiInstaller
|
|
14
|
+
|
|
15
|
+
$suffix = "\\Google\\Chrome Beta\\Application\\chrome.exe"
|
|
16
|
+
if (Test-Path "${env:ProgramFiles(x86)}$suffix") {
|
|
17
|
+
(Get-Item "${env:ProgramFiles(x86)}$suffix").VersionInfo
|
|
18
|
+
} elseif (Test-Path "${env:ProgramFiles}$suffix") {
|
|
19
|
+
(Get-Item "${env:ProgramFiles}$suffix").VersionInfo
|
|
20
|
+
} else {
|
|
21
|
+
Write-Host "ERROR: Failed to install Google Chrome Beta."
|
|
22
|
+
Write-Host "ERROR: This could be due to insufficient privileges, in which case re-running as Administrator may help."
|
|
23
|
+
exit 1
|
|
24
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -e
|
|
3
|
+
set -x
|
|
4
|
+
|
|
5
|
+
if [[ $(arch) == "aarch64" ]]; then
|
|
6
|
+
echo "ERROR: not supported on Linux Arm64"
|
|
7
|
+
exit 1
|
|
8
|
+
fi
|
|
9
|
+
|
|
10
|
+
if [ -z "$PLAYWRIGHT_HOST_PLATFORM_OVERRIDE" ]; then
|
|
11
|
+
if [[ ! -f "/etc/os-release" ]]; then
|
|
12
|
+
echo "ERROR: cannot install on unknown linux distribution (/etc/os-release is missing)"
|
|
13
|
+
exit 1
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
ID=$(bash -c 'source /etc/os-release && echo $ID')
|
|
17
|
+
if [[ "${ID}" != "ubuntu" && "${ID}" != "debian" ]]; then
|
|
18
|
+
echo "ERROR: cannot install on $ID distribution - only Ubuntu and Debian are supported"
|
|
19
|
+
exit 1
|
|
20
|
+
fi
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
# 1. make sure to remove old stable if any.
|
|
24
|
+
if dpkg --get-selections | grep -q "^google-chrome[[:space:]]*install$" >/dev/null; then
|
|
25
|
+
apt-get remove -y google-chrome
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
# 2. Update apt lists (needed to install curl and chrome dependencies)
|
|
29
|
+
apt-get update
|
|
30
|
+
|
|
31
|
+
# 3. Install curl to download chrome
|
|
32
|
+
if ! command -v curl >/dev/null; then
|
|
33
|
+
apt-get install -y curl
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
# 4. download chrome stable from dl.google.com and install it.
|
|
37
|
+
cd /tmp
|
|
38
|
+
curl -L -O https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
|
39
|
+
apt-get install -y ./google-chrome-stable_current_amd64.deb
|
|
40
|
+
rm -rf ./google-chrome-stable_current_amd64.deb
|
|
41
|
+
cd -
|
|
42
|
+
google-chrome --version
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -e
|
|
3
|
+
set -x
|
|
4
|
+
|
|
5
|
+
rm -rf "/Applications/Google Chrome.app"
|
|
6
|
+
cd /tmp
|
|
7
|
+
curl -L --retry 3 -o ./googlechrome.dmg https://dl.google.com/chrome/mac/universal/stable/GGRO/googlechrome.dmg
|
|
8
|
+
hdiutil attach -nobrowse -quiet -noautofsck -noautoopen -mountpoint /Volumes/googlechrome.dmg ./googlechrome.dmg
|
|
9
|
+
cp -pR "/Volumes/googlechrome.dmg/Google Chrome.app" /Applications
|
|
10
|
+
hdiutil detach /Volumes/googlechrome.dmg
|
|
11
|
+
rm -rf /tmp/googlechrome.dmg
|
|
12
|
+
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
$ErrorActionPreference = 'Stop'
|
|
2
|
+
$url = 'https://dl.google.com/tag/s/dl/chrome/install/googlechromestandaloneenterprise64.msi'
|
|
3
|
+
|
|
4
|
+
$wc = New-Object net.webclient
|
|
5
|
+
$msiInstaller = "$env:temp\google-chrome.msi"
|
|
6
|
+
Write-Host "Downloading Google Chrome"
|
|
7
|
+
$wc.Downloadfile($url, $msiInstaller)
|
|
8
|
+
|
|
9
|
+
Write-Host "Installing Google Chrome"
|
|
10
|
+
$arguments = "/i `"$msiInstaller`" /quiet"
|
|
11
|
+
Start-Process msiexec.exe -ArgumentList $arguments -Wait
|
|
12
|
+
Remove-Item $msiInstaller
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
$suffix = "\\Google\\Chrome\\Application\\chrome.exe"
|
|
16
|
+
if (Test-Path "${env:ProgramFiles(x86)}$suffix") {
|
|
17
|
+
(Get-Item "${env:ProgramFiles(x86)}$suffix").VersionInfo
|
|
18
|
+
} elseif (Test-Path "${env:ProgramFiles}$suffix") {
|
|
19
|
+
(Get-Item "${env:ProgramFiles}$suffix").VersionInfo
|
|
20
|
+
} else {
|
|
21
|
+
Write-Host "ERROR: Failed to install Google Chrome."
|
|
22
|
+
Write-Host "ERROR: This could be due to insufficient privileges, in which case re-running as Administrator may help."
|
|
23
|
+
exit 1
|
|
24
|
+
}
|