useblocks-cli 1.1.64 → 1.1.70
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/dist/index.js +28 -24
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -51,7 +51,7 @@ var ROOT_DIR$2 = (0, path.resolve)(__dirname, "../../..");
|
|
|
51
51
|
(0, path.resolve)(ROOT_DIR$2, "./packages");
|
|
52
52
|
(0, path.resolve)(ROOT_DIR$2, "./local_modules");
|
|
53
53
|
(0, path.resolve)(ROOT_DIR$2, "./build");
|
|
54
|
-
(0, path.resolve)(ROOT_DIR$2, "index.html"), (0, path.resolve)(ROOT_DIR$2, "src/index.tsx"), (0, path.resolve)(ROOT_DIR$2, "src/plugin/loader/index.ts"), (0, path.resolve)(ROOT_DIR$2, "src/plugin/core/entry.ts"), (0, path.resolve)(ROOT_DIR$2, "iframe"), (0, path.resolve)(ROOT_DIR$2, "iframe/iframe.html"), (0, path.resolve)(ROOT_DIR$2, "iframe/iframe-eblock.html"), (0, path.resolve)(ROOT_DIR$2, "public"), (0, path.resolve)(ROOT_DIR$2, "src/pluginExamples"), (0, path.resolve)(ROOT_DIR$2, "src/extensions"), (0, path.resolve)(ROOT_DIR$2, "src/tsconfig.json"), (0, path.resolve)(ROOT_DIR$2, "tsconfig.types.json"), (0, path.resolve)(ROOT_DIR$2, "src"), (0, path.resolve)(ROOT_DIR$2, "iframe/tsconfig.json"), (0, path.resolve)(ROOT_DIR$2, "src/extensions/api/src/index.ts"), (0, path.resolve)(ROOT_DIR$2, "src/extensions/react/src/index.ts"), (0, path.resolve)(ROOT_DIR$2, "src/assets/images/atoms"), (0, path.resolve)(ROOT_DIR$2, "src/assets"), (0, path.resolve)(ROOT_DIR$2, "src"), (0, path.resolve)(ROOT_DIR$2, "packages/extensions-core/identifiers"), (0, path.resolve)(ROOT_DIR$2, "src/app/identifiers"), (0, path.resolve)(ROOT_DIR$2, "src/plugin/pluginRegistry"), (0, path.resolve)(ROOT_DIR$2, "src/constants/errors"), (0, path.resolve)(ROOT_DIR$2, "src/helpers/shared/mapHttpStatusToErrorCode"), (0, path.resolve)(ROOT_DIR$2, "src/plugin/const"), (0, path.resolve)(ROOT_DIR$2, "src/helpers/guid"), (0, path.resolve)(ROOT_DIR$2, "src/plugin/utils/waitForElement"), (0, path.resolve)(ROOT_DIR$2, "src/plugin/mixins/auth"), (0, path.resolve)(ROOT_DIR$2, "src/plugin/mixins/base");
|
|
54
|
+
(0, path.resolve)(ROOT_DIR$2, "index.html"), (0, path.resolve)(ROOT_DIR$2, "src/index.tsx"), (0, path.resolve)(ROOT_DIR$2, "src/plugin/loader/index.ts"), (0, path.resolve)(ROOT_DIR$2, "src/plugin/core/entry.ts"), (0, path.resolve)(ROOT_DIR$2, "packages/po/index.ts"), (0, path.resolve)(ROOT_DIR$2, "iframe"), (0, path.resolve)(ROOT_DIR$2, "iframe/iframe.html"), (0, path.resolve)(ROOT_DIR$2, "iframe/iframe-eblock.html"), (0, path.resolve)(ROOT_DIR$2, "public"), (0, path.resolve)(ROOT_DIR$2, "src/pluginExamples"), (0, path.resolve)(ROOT_DIR$2, "src/extensions"), (0, path.resolve)(ROOT_DIR$2, "src/tsconfig.json"), (0, path.resolve)(ROOT_DIR$2, "tsconfig.types.json"), (0, path.resolve)(ROOT_DIR$2, "src"), (0, path.resolve)(ROOT_DIR$2, "iframe/tsconfig.json"), (0, path.resolve)(ROOT_DIR$2, "src/extensions/api/src/index.ts"), (0, path.resolve)(ROOT_DIR$2, "src/extensions/react/src/index.ts"), (0, path.resolve)(ROOT_DIR$2, "src/assets/images/atoms"), (0, path.resolve)(ROOT_DIR$2, "src/assets"), (0, path.resolve)(ROOT_DIR$2, "src"), (0, path.resolve)(ROOT_DIR$2, "packages/extensions-core/identifiers"), (0, path.resolve)(ROOT_DIR$2, "src/app/identifiers"), (0, path.resolve)(ROOT_DIR$2, "src/plugin/pluginRegistry"), (0, path.resolve)(ROOT_DIR$2, "src/constants/errors"), (0, path.resolve)(ROOT_DIR$2, "src/helpers/shared/mapHttpStatusToErrorCode"), (0, path.resolve)(ROOT_DIR$2, "src/plugin/const"), (0, path.resolve)(ROOT_DIR$2, "src/helpers/guid"), (0, path.resolve)(ROOT_DIR$2, "src/plugin/utils/waitForElement"), (0, path.resolve)(ROOT_DIR$2, "src/plugin/mixins/auth"), (0, path.resolve)(ROOT_DIR$2, "src/plugin/mixins/base");
|
|
55
55
|
(0, path.resolve)(ROOT_DIR$2, "apps/widget/saas/index.tsx"), (0, path.resolve)(ROOT_DIR$2, "apps/widget/lib/entries/loader.ts"), (0, path.resolve)(ROOT_DIR$2, "apps/widget/lib/entries/core.ts"), (0, path.resolve)(ROOT_DIR$2, "iframe"), (0, path.resolve)(ROOT_DIR$2, "iframe/iframe.html"), (0, path.resolve)(ROOT_DIR$2, "iframe/iframe-eblock.html"), (0, path.resolve)(ROOT_DIR$2, "apps/widget/public"), (0, path.resolve)(ROOT_DIR$2, "apps/widget/lib/pluginExamples"), (0, path.resolve)(ROOT_DIR$2, "apps/widget/extensions"), (0, path.resolve)(ROOT_DIR$2, "apps/widget"), (0, path.resolve)(ROOT_DIR$2, "apps/widget/lib/tsconfig.json"), (0, path.resolve)(ROOT_DIR$2, "apps/widget/tsconfig.json"), (0, path.resolve)(ROOT_DIR$2, "apps/widget"), (0, path.resolve)(ROOT_DIR$2, "iframe/tsconfig.json"), (0, path.resolve)(ROOT_DIR$2, "apps/widget/extensions/api/src/index.ts"), (0, path.resolve)(ROOT_DIR$2, "apps/widget/src/assets"), (0, path.resolve)(ROOT_DIR$2, "apps/widget/src"), (0, path.resolve)(ROOT_DIR$2, "apps/widget/lib/pluginRuntime");
|
|
56
56
|
(0, path.resolve)(ROOT_DIR$2, "iframe/js/extensions/api/src/index.ts"), (0, path.resolve)(ROOT_DIR$2, "packages/ui-kit/src"), (0, path.resolve)(ROOT_DIR$2, "packages/ui-kit/src/index.ts"), (0, path.resolve)(ROOT_DIR$2, "packages/ui-kit/public"), (0, path.resolve)(ROOT_DIR$2, "build-tools/config/runtime"), (0, path.resolve)(ROOT_DIR$2, "packages/core-loader/src"), (0, path.resolve)(ROOT_DIR$2, "build-tools/plugins/loaders/loaders/amd-loader.js");
|
|
57
57
|
path.default.resolve(__dirname, "../../..");
|
|
@@ -63,7 +63,8 @@ var ENV_MODES = [
|
|
|
63
63
|
"demo",
|
|
64
64
|
"prod",
|
|
65
65
|
"global",
|
|
66
|
-
"global-dev"
|
|
66
|
+
"global-dev",
|
|
67
|
+
"billing"
|
|
67
68
|
];
|
|
68
69
|
/**
|
|
69
70
|
* Mode to .env file mapping
|
|
@@ -73,9 +74,10 @@ var ENV_FILES = {
|
|
|
73
74
|
"demo": ".env.demo",
|
|
74
75
|
"prod": ".env.prod",
|
|
75
76
|
"global": ".env.global",
|
|
76
|
-
"global-dev": ".env.global.dev"
|
|
77
|
+
"global-dev": ".env.global.dev",
|
|
78
|
+
"billing": ".env.dev.billing"
|
|
77
79
|
};
|
|
78
|
-
/** Pipeline defaults to dev when --envMode omitted; forward explicit mode for
|
|
80
|
+
/** Pipeline defaults to dev when --envMode omitted; forward explicit mode for non-dev profiles. */
|
|
79
81
|
function pipelineEnvModeArgs(envMode) {
|
|
80
82
|
return envMode === "dev" ? [] : ["--envMode", envMode];
|
|
81
83
|
}
|
|
@@ -418,9 +420,9 @@ var DEFAULT_EXTENSIONS_API_PACKAGE = "useblocks-extensions-api";
|
|
|
418
420
|
var DEFAULT_EXTENSIONS_REACT_PACKAGE = "useblocks-extensions-react";
|
|
419
421
|
var DEFAULT_EXTENSIONS_SANDBOX_PACKAGE = "useblocks-extensions-sandbox";
|
|
420
422
|
var DEFAULT_CLI_PACKAGE = "useblocks-cli";
|
|
421
|
-
var DEFAULT_VERSION = "1.1.
|
|
422
|
-
var DEFAULT_UI_KIT_VERSION = "1.1.
|
|
423
|
-
var DEFAULT_CLI_VERSION = "1.1.
|
|
423
|
+
var DEFAULT_VERSION = "1.1.70";
|
|
424
|
+
var DEFAULT_UI_KIT_VERSION = "1.1.70";
|
|
425
|
+
var DEFAULT_CLI_VERSION = "1.1.70";
|
|
424
426
|
var DEFAULT_OPENAPI_BASE_URL = "https://app.useblocks.io/api";
|
|
425
427
|
var DEFAULT_CDN_URL = "https://cdn.useblocks.io";
|
|
426
428
|
var DEFAULT_BACKEND_DOMAIN = "api.useblocks.io";
|
|
@@ -1462,7 +1464,7 @@ var ROOT_PKG = {
|
|
|
1462
1464
|
packageManager: "pnpm@11.4.0",
|
|
1463
1465
|
dependencies: {
|
|
1464
1466
|
"@easylogic/colorpicker": "1.10.7",
|
|
1465
|
-
"@emailmaker/filemanager": "
|
|
1467
|
+
"@emailmaker/filemanager": "workspace:*",
|
|
1466
1468
|
"@emailmaker/ui-kit": "workspace:*",
|
|
1467
1469
|
"@emailmaker/extensions-api": "workspace:*",
|
|
1468
1470
|
"@emailmaker/extensions-react": "workspace:*",
|
|
@@ -1471,6 +1473,7 @@ var ROOT_PKG = {
|
|
|
1471
1473
|
"@internal/core-loader": "workspace:*",
|
|
1472
1474
|
"app-core": "workspace:*",
|
|
1473
1475
|
"browserExtensionSanitizer": "workspace:*",
|
|
1476
|
+
"cssVars": "workspace:*",
|
|
1474
1477
|
"di": "workspace:*",
|
|
1475
1478
|
"disposable": "workspace:*",
|
|
1476
1479
|
"dom2Html": "workspace:*",
|
|
@@ -1520,10 +1523,10 @@ var ROOT_PKG = {
|
|
|
1520
1523
|
"deepmerge-ts": "^5.1.0",
|
|
1521
1524
|
"deepmerge": "^4.3.1",
|
|
1522
1525
|
"effection": "^3.0.3",
|
|
1523
|
-
"eml-parse-js": "^1.1.1",
|
|
1524
1526
|
"emmet": "^2.3.6",
|
|
1525
1527
|
"emmet-monaco-es": "file:local_modules/emmet-monaco-es",
|
|
1526
1528
|
"event-source-polyfill": "^1.0.31",
|
|
1529
|
+
"fflate": "^0.8.3",
|
|
1527
1530
|
"file-saver": "^2.0.5",
|
|
1528
1531
|
"html-react-parser": "6.1.4",
|
|
1529
1532
|
"html2pdf.js": "^0.9.3",
|
|
@@ -1532,7 +1535,6 @@ var ROOT_PKG = {
|
|
|
1532
1535
|
"immer": "^11.1.11",
|
|
1533
1536
|
"js-cookie": "^3.0.1",
|
|
1534
1537
|
"js-sha256": "^0.11.0",
|
|
1535
|
-
"jszip": "^3.10.1",
|
|
1536
1538
|
"lodash.isequal": "^4.5.0",
|
|
1537
1539
|
"mailparser": "^3.6.9",
|
|
1538
1540
|
"md5": "^2.3.0",
|
|
@@ -1543,7 +1545,7 @@ var ROOT_PKG = {
|
|
|
1543
1545
|
"mutation-summary": "^1.0.0",
|
|
1544
1546
|
"path-browserify": "^1.0.1",
|
|
1545
1547
|
"pixie": "file:local_modules/pixie",
|
|
1546
|
-
"
|
|
1548
|
+
"postal-mime": "^3.0.0",
|
|
1547
1549
|
"process": "^0.11.10",
|
|
1548
1550
|
"prop-types": "^15.8.1",
|
|
1549
1551
|
"react": "19.2.7",
|
|
@@ -1558,6 +1560,7 @@ var ROOT_PKG = {
|
|
|
1558
1560
|
"react-sticky-box": "^1.0.1",
|
|
1559
1561
|
"react-transition-group": "^4.4.5",
|
|
1560
1562
|
"regenerator-runtime": "^0.14.1",
|
|
1563
|
+
"recharts": "^2.15.4",
|
|
1561
1564
|
"sass": "^1.44.0",
|
|
1562
1565
|
"save": "^2.9.0",
|
|
1563
1566
|
"selderee": "^0.11.0",
|
|
@@ -1591,6 +1594,7 @@ var ROOT_PKG = {
|
|
|
1591
1594
|
"cli:browser-smoke:plugins": "tsx build-tools/cli/scripts/e2e/browser-smoke.ts --only-plugins",
|
|
1592
1595
|
"cli:vite-plugin-matrix": "tsx build-tools/cli/scripts/e2e/vite-plugin-version-matrix.ts",
|
|
1593
1596
|
"start": "tsx build-tools/pipeline.ts --serve",
|
|
1597
|
+
"start:billing": "tsx build-tools/pipeline.ts --serve --envMode=billing",
|
|
1594
1598
|
"prepare": "husky && tsx build-tools/scripts/dev/setup-dev-cert.ts --hook",
|
|
1595
1599
|
"setup:dev-cert": "tsx build-tools/scripts/dev/setup-dev-cert.ts",
|
|
1596
1600
|
"publish:npm": "node build-tools/scripts/publish/publish-from-manifest.mjs",
|
|
@@ -1601,9 +1605,9 @@ var ROOT_PKG = {
|
|
|
1601
1605
|
"start:proxy": "env-cmd -f .env.dev tsx build-tools/proxy/client/server.ts --mountPath=/proxy",
|
|
1602
1606
|
"start:proxy:debug": "env-cmd -f .env.dev tsx build-tools/proxy/debug/server.ts --mountPath=/__debug-resource-proxy",
|
|
1603
1607
|
"test": "pnpm run test:jest && pnpm run test:build-tools",
|
|
1604
|
-
"test:jest": "jest",
|
|
1608
|
+
"test:jest": "tsx build-tools/scripts/build/ensure-file-manager.ts && jest",
|
|
1605
1609
|
"test:build-tools": "jest --config jest.build-tools.config.cjs && pnpm run test:build-tools:node",
|
|
1606
|
-
"test:build-tools:node": "tsx
|
|
1610
|
+
"test:build-tools:node": "tsx build-tools/scripts/test/run-node-tests.ts",
|
|
1607
1611
|
"clear:babel-cache": "rimraf -rf ./node_modules/.cache/babel-loader/*",
|
|
1608
1612
|
"delete-maps": "find ./build -name '*.map' -delete && find ./build -regex '.*\\.\\(js\\|css\\)' -exec sed -i -E '\\/[\\*\\/]#\\ssourceMappingURL=main(\\.[0-9a-f]+)?\\.(css|js)\\.map(\\*\\/)?/g' {} +",
|
|
1609
1613
|
"delete-map-files": "find ./build -name '*.map' -delete",
|
|
@@ -1621,13 +1625,17 @@ var ROOT_PKG = {
|
|
|
1621
1625
|
"ui-kit:test:unit:coverage": "tsx build-tools/scripts/run-ui-kit.ts vitest --config vitest.unit.config.ts --run --coverage",
|
|
1622
1626
|
"ui-kit:test:unit:ui": "tsx build-tools/scripts/run-ui-kit.ts vitest --config vitest.unit.config.ts --ui",
|
|
1623
1627
|
"ui-kit:test:all": "tsx build-tools/scripts/run-ui-kit.ts vitest --config vitest.unit.config.ts --run && cross-env A11Y_ENFORCE=true tsx build-tools/scripts/run-ui-kit.ts vitest --config vitest.config.ts --run",
|
|
1624
|
-
"
|
|
1628
|
+
"file-manager:start": "vite --config build-tools/config/presets/serve.file-manager.ts --mode dev",
|
|
1629
|
+
"file-manager:build": "tsx build-tools/scripts/build/build-file-manager.ts",
|
|
1630
|
+
"file-manager:test": "tsx build-tools/scripts/run-file-manager.ts jest",
|
|
1631
|
+
"type-check": "tsx build-tools/scripts/build/ensure-file-manager.ts && tsx build-tools/scripts/typecheck/run-entry-type-check.ts",
|
|
1625
1632
|
"type-check:tsc": "tsc -p src/tsconfig.json --noEmit",
|
|
1626
1633
|
"type-check:watch": "tsc -p src/tsconfig.json --noEmit --watch",
|
|
1627
|
-
"lint:types": "tsc --noEmit && tsc -p build-tools/tsconfig.tooling.json",
|
|
1628
|
-
"test:typecheck": "npm run lint:types && tsc -p iframe/tsconfig.json --noEmit",
|
|
1634
|
+
"lint:types": "tsx build-tools/scripts/build/ensure-file-manager.ts && tsc --noEmit && tsc -p build-tools/tsconfig.tooling.json",
|
|
1635
|
+
"test:typecheck": "npm run lint:types && tsc -p iframe/tsconfig.json --noEmit && tsc -p packages/po/tsconfig.json --noEmit",
|
|
1629
1636
|
"type-check:tooling": "tsc -p build-tools/tsconfig.tooling.json",
|
|
1630
1637
|
"lint:new": "tsx build-tools/scripts/lint/diffAwareLint.ts",
|
|
1638
|
+
"test:plugin-matrix": "tsx build-tools/scripts/dev/run-plugin-matrix.ts",
|
|
1631
1639
|
"lint:ci": "tsx build-tools/scripts/lint/diffAwareLint.ts",
|
|
1632
1640
|
"test:lint": "oxlint --config .oxlintrc.json .",
|
|
1633
1641
|
"lint:css": "stylelint \"**/*.{css,scss,sass}\" --fix",
|
|
@@ -1650,6 +1658,7 @@ var ROOT_PKG = {
|
|
|
1650
1658
|
]
|
|
1651
1659
|
},
|
|
1652
1660
|
devDependencies: {
|
|
1661
|
+
"po": "workspace:*",
|
|
1653
1662
|
"@chromatic-com/storybook": "^5.1.1",
|
|
1654
1663
|
"@oxc-project/types": "0.139.0",
|
|
1655
1664
|
"@react-buddy/ide-toolbox": "^2.4.0",
|
|
@@ -1701,6 +1710,7 @@ var ROOT_PKG = {
|
|
|
1701
1710
|
"rolldown-plugin-dts": "^0.28.0",
|
|
1702
1711
|
"rollup": "^4.61.1",
|
|
1703
1712
|
"sass-cast": "^0.5.6",
|
|
1713
|
+
"sirv": "^3.0.2",
|
|
1704
1714
|
"string-width": "^4.2.3",
|
|
1705
1715
|
"stylelint": "^16.14.1",
|
|
1706
1716
|
"stylelint-config-recommended-scss": "^14.1.0",
|
|
@@ -1794,16 +1804,10 @@ function extractPinned(version) {
|
|
|
1794
1804
|
if (!match) throw new Error(`[cli] Cannot extract pinned version from ${JSON.stringify(version)}`);
|
|
1795
1805
|
return `${match[1]}.${match[2]}.${match[3]}`;
|
|
1796
1806
|
}
|
|
1797
|
-
/** Pinned antd on major.minor line (patch 0) so plugin devDeps align with ui-kit peer floor. */
|
|
1798
|
-
function extractMajorMinor(version) {
|
|
1799
|
-
const match = version.trim().match(/(\d+)\.(\d+)/);
|
|
1800
|
-
if (!match) throw new Error(`[cli] Cannot extract major.minor from ${JSON.stringify(version)}`);
|
|
1801
|
-
return `${match[1]}.${match[2]}.0`;
|
|
1802
|
-
}
|
|
1803
1807
|
var LEGACY_REACT_DEPENDENCIES = {
|
|
1804
1808
|
react: extractPinned(getRootDependencyVersion("react")),
|
|
1805
1809
|
"react-dom": extractPinned(getRootDependencyVersion("react-dom")),
|
|
1806
|
-
antd:
|
|
1810
|
+
antd: extractPinned(getRootDependencyVersion("antd")),
|
|
1807
1811
|
"@types/react": extractPinned(getRootDependencyVersion("@types/react")),
|
|
1808
1812
|
"@types/react-dom": extractPinned(getRootDependencyVersion("@types/react-dom"))
|
|
1809
1813
|
};
|
|
@@ -3528,7 +3532,7 @@ var rawTemplateModules = /* #__PURE__ */ Object.assign({
|
|
|
3528
3532
|
"../../project-templates/plugin/shared-base/scripts/build-types.ts": "import fs from 'node:fs';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { isExecutedAsScript } from './scriptRuntime.ts';\n\nconst scriptDir = path.dirname(fileURLToPath(import.meta.url));\nconst sourcePath = path.resolve(scriptDir, '..', 'src', 'public-types.d.ts');\nconst targetPath = path.resolve(scriptDir, '..', 'dist', 'public-types.d.ts');\n\nexport function copyPublicTypes(): void {\n fs.mkdirSync(path.dirname(targetPath), { recursive: true });\n fs.copyFileSync(sourcePath, targetPath);\n}\n\nif (isExecutedAsScript(import.meta.url)) {\n copyPublicTypes();\n}\n",
|
|
3529
3533
|
"../../project-templates/plugin/shared-base/scripts/clean.ts": "import fs from 'node:fs';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { isExecutedAsScript } from './scriptRuntime.ts';\n\nconst scriptDir = path.dirname(fileURLToPath(import.meta.url));\n\nexport function cleanBuildArtifacts(): void {\n for (const target of ['dist', path.join('public', 'sandbox.js')]) {\n fs.rmSync(path.resolve(scriptDir, '..', target), { force: true, recursive: true });\n }\n}\n\nif (isExecutedAsScript(import.meta.url)) {\n cleanBuildArtifacts();\n}\n",
|
|
3530
3534
|
"../../project-templates/plugin/shared-base/scripts/dev-runner.ts": "import fs from 'node:fs';\nimport path from 'node:path';\nimport type { ChildProcess } from 'node:child_process';\nimport { runScript, runScriptSync } from './runScript.ts';\nimport { resolvePluginDevHostArgs } from './resolvePluginDevPort.ts';\n\nfunction waitForFile(filePath: string, timeoutMs = 30_000, pollMs = 250): Promise<void> {\n const startedAt = Date.now();\n\n return new Promise((resolve, reject) => {\n const check = (): void => {\n if (fs.existsSync(filePath)) {\n resolve();\n return;\n }\n\n if (Date.now() - startedAt >= timeoutMs) {\n reject(new Error(`Timed out waiting for file: ${filePath}`));\n return;\n }\n\n setTimeout(check, pollMs);\n };\n\n check();\n });\n}\n\nfunction hasLegacyPluginDevScripts(): boolean {\n try {\n const packageJsonPath = path.resolve(process.cwd(), 'package.json');\n const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')) as {\n scripts?: Record<string, string>;\n };\n return typeof packageJson.scripts?.['dev:plugin:once'] === 'string';\n } catch {\n return false;\n }\n}\n\nasync function main(): Promise<void> {\n const forwardedArgs = process.argv.slice(2);\n const sandboxFilePath = path.resolve(process.cwd(), 'public', 'sandbox.js');\n const pluginDistPath = path.resolve(process.cwd(), 'dist', 'index.js');\n let sandbox: ChildProcess | undefined;\n let plugin: ChildProcess | undefined;\n let app: ChildProcess | undefined;\n\n const shutdown = (): void => {\n sandbox?.kill('SIGINT');\n plugin?.kill('SIGINT');\n app?.kill('SIGINT');\n };\n\n process.on('SIGINT', shutdown);\n process.on('SIGTERM', shutdown);\n\n try {\n runScriptSync('dev:sandbox:once');\n await waitForFile(sandboxFilePath, 5_000);\n\n if (hasLegacyPluginDevScripts()) {\n runScriptSync('dev:plugin:once');\n await waitForFile(pluginDistPath, 60_000);\n plugin = runScript('dev:plugin');\n }\n\n sandbox = runScript('dev:sandbox');\n const { port, hostArgs } = await resolvePluginDevHostArgs(forwardedArgs);\n console.log(`[dev] http://localhost:${port}/`);\n app = runScript('dev:host', {\n args: hostArgs,\n env: { PLUGIN_DEV_PORT: String(port) },\n });\n } catch (error) {\n shutdown();\n const message = error instanceof Error ? error.message : String(error);\n console.error(message);\n process.exit(1);\n }\n}\n\nvoid main();\n",
|
|
3531
|
-
"../../project-templates/plugin/shared-base/scripts/findFreePort.ts": "import net from 'node:net';\n\nconst DEV_BIND_HOSTS: readonly string[] = ['0.0.0.0', '127.0.0.1'];\n\nexport const DEFAULT_PLUGIN_DEV_PORT = 3000;\n\nfunction
|
|
3535
|
+
"../../project-templates/plugin/shared-base/scripts/findFreePort.ts": "import net from 'node:net';\n\n/**\n * Hosts a dev server may bind to. `::` comes first: on Windows a second bind to an IPv4\n * address of a busy port still succeeds, so only the IPv6 socket reports the conflict.\n */\nconst DEV_BIND_HOSTS: readonly string[] = ['::', '0.0.0.0', '127.0.0.1'];\n\n/** The port cannot be bound on this host: taken by another process or denied by the OS. */\nconst PORT_UNAVAILABLE_CODES = new Set(['EADDRINUSE', 'EACCES']);\n\n/** The address family is unavailable (no IPv6 and such) — says nothing about the port, so skip the host. */\nconst HOST_UNSUPPORTED_CODES = new Set(['EAFNOSUPPORT', 'EADDRNOTAVAIL', 'EINVAL', 'ENOTFOUND']);\n\nexport const DEFAULT_PLUGIN_DEV_PORT = 3000;\n\ntype PortProbeResult = 'free' | 'taken' | 'host-unsupported';\n\n/**\n * Tries to bind the port on one host. An unknown error code counts as unusable:\n * moving to the next port is cheaper than crashing the dev server on EADDRINUSE.\n */\nfunction probePort(port: number, host: string): Promise<PortProbeResult> {\n return new Promise((resolve) => {\n const server = net.createServer();\n\n server.once('error', (err: NodeJS.ErrnoException) => {\n const code = err.code ?? '';\n if (HOST_UNSUPPORTED_CODES.has(code)) {\n resolve('host-unsupported');\n return;\n }\n if (!PORT_UNAVAILABLE_CODES.has(code)) {\n console.log(`[findFreePort] ${host}:${port} — unexpected bind error (${code || err.message})`);\n }\n resolve('taken');\n });\n\n server.once('listening', () => {\n server.close(() => resolve('free'));\n });\n\n server.listen({ port, host, exclusive: true });\n });\n}\n\nexport async function isDevListenPortTaken(port: number): Promise<boolean> {\n for (const host of DEV_BIND_HOSTS) {\n if ((await probePort(port, host)) === 'taken') {\n return true;\n }\n }\n return false;\n}\n\nexport async function findFreePort(\n startPort: number,\n maxAttempts = 50,\n): Promise<number | null> {\n for (let i = 0; i < maxAttempts; i++) {\n const port = startPort + i;\n if (!(await isDevListenPortTaken(port))) {\n return port;\n }\n console.log(`[findFreePort] Port ${port} is in use, trying ${port + 1}...`);\n }\n return null;\n}\n",
|
|
3532
3536
|
"../../project-templates/plugin/shared-base/scripts/hostDevServerHeaders.ts.eta": "<%~ include('stand-host-dev-server-webpack', it) %>\n",
|
|
3533
3537
|
"../../project-templates/plugin/shared-base/scripts/release-runner.ts": "import fs from 'node:fs';\nimport path from 'node:path';\nimport { buildProject } from './build-runner.ts';\nimport { runScript } from './runScript.ts';\nimport { resolvePluginDevHostArgs } from './resolvePluginDevPort.ts';\n\nfunction assertReleaseArtifacts(): void {\n const requiredFiles = [\n path.resolve(process.cwd(), 'dist', 'index.js'),\n path.resolve(process.cwd(), 'dist', 'sandbox.js'),\n ];\n\n for (const filePath of requiredFiles) {\n if (!fs.existsSync(filePath)) {\n throw new Error(`[release] Expected build artifact is missing: ${filePath}`);\n }\n }\n}\n\n/**\n * `--bundler-runtime-strict` — CLI выставляет этот флаг только при локальной\n * сборке плагина из нашего репо (`--local-test`). Переключает defensive\n * детекторы host plugin + PluginDev в throw-режим: дублирование React'а или\n * bare-импорт runtime-пакета валит сборку с диагностикой вместо тихого warn'а.\n *\n * Production-CLI (опубликованный npm) этот аргумент не подставляет, поэтому\n * integrator'ские sandbox'ы не падают из-за heuristic-сигнала. См.\n * `docs/build-architecture/RUNTIME_DELIVERY_CR.md` §12.\n */\nfunction consumeStrictFlag(args: string[]): string[] {\n const idx = args.indexOf('--bundler-runtime-strict');\n if (idx < 0) {\n return args;\n }\n process.env.BUNDLER_RUNTIME_STRICT ??= '1';\n return [...args.slice(0, idx), ...args.slice(idx + 1)];\n}\n\nasync function main(): Promise<void> {\n const forwardedArgs = consumeStrictFlag(process.argv.slice(2));\n buildProject();\n assertReleaseArtifacts();\n if (process.env.BUNDLER_RUNTIME_STRICT === '1') {\n console.log('[release] BUNDLER_RUNTIME_STRICT=1 (local CLI build) — defensive checks fail-fast');\n }\n\n try {\n const { port, hostArgs } = await resolvePluginDevHostArgs(forwardedArgs);\n console.log(`[release] http://localhost:${port}/release.html`);\n const app = runScript('dev:release-host', {\n args: hostArgs,\n env: { PLUGIN_DEV_PORT: String(port) },\n });\n\n const shutdown = (): void => {\n app.kill('SIGINT');\n };\n\n process.on('SIGINT', shutdown);\n process.on('SIGTERM', shutdown);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n console.error(message);\n process.exit(1);\n }\n}\n\nvoid main();\n",
|
|
3534
3538
|
"../../project-templates/plugin/shared-base/scripts/resolvePluginDevPort.test.ts": "import test from 'node:test';\nimport assert from 'node:assert/strict';\nimport { parsePortFromArgs } from './resolvePluginDevPort.ts';\n\ntest('parsePortFromArgs extracts --port and keeps other args', () => {\n assert.deepEqual(parsePortFromArgs(['--port', '3005', '--open']), {\n explicitPort: 3005,\n restArgs: ['--open'],\n });\n});\n\ntest('parsePortFromArgs supports --port= syntax', () => {\n assert.deepEqual(parsePortFromArgs(['--port=3010']), {\n explicitPort: 3010,\n restArgs: [],\n });\n});\n\ntest('parsePortFromArgs rejects invalid port', () => {\n assert.throws(() => parsePortFromArgs(['--port', '0']), /Invalid --port value/);\n});\n",
|
package/package.json
CHANGED