useblocks-cli 1.1.62 → 1.1.65
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 +6 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -418,9 +418,9 @@ var DEFAULT_EXTENSIONS_API_PACKAGE = "useblocks-extensions-api";
|
|
|
418
418
|
var DEFAULT_EXTENSIONS_REACT_PACKAGE = "useblocks-extensions-react";
|
|
419
419
|
var DEFAULT_EXTENSIONS_SANDBOX_PACKAGE = "useblocks-extensions-sandbox";
|
|
420
420
|
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.
|
|
421
|
+
var DEFAULT_VERSION = "1.1.65";
|
|
422
|
+
var DEFAULT_UI_KIT_VERSION = "1.1.65";
|
|
423
|
+
var DEFAULT_CLI_VERSION = "1.1.65";
|
|
424
424
|
var DEFAULT_OPENAPI_BASE_URL = "https://app.useblocks.io/api";
|
|
425
425
|
var DEFAULT_CDN_URL = "https://cdn.useblocks.io";
|
|
426
426
|
var DEFAULT_BACKEND_DOMAIN = "api.useblocks.io";
|
|
@@ -1603,7 +1603,7 @@ var ROOT_PKG = {
|
|
|
1603
1603
|
"test": "pnpm run test:jest && pnpm run test:build-tools",
|
|
1604
1604
|
"test:jest": "jest",
|
|
1605
1605
|
"test:build-tools": "jest --config jest.build-tools.config.cjs && pnpm run test:build-tools:node",
|
|
1606
|
-
"test:build-tools:node": "tsx --tsconfig build-tools/cli/tsconfig.json --test build-tools/bundler-plugins/src/shared/__tests__/hostPackageEntryMatch.test.ts build-tools/bundler-plugins/src/shared/__tests__/hostPluginDiagnostics.test.ts build-tools/bundler-plugins/src/shared/__tests__/externalizedPackageDetect.test.ts build-tools/bundler-plugins/src/vite/__tests__/vitePluginPublicPath.diagnostics.test.ts build-tools/bundler-plugins/src/webpack/__tests__/webpackPluginMissingPackage.test.ts build-tools/bundler-plugins/src/vite/__tests__/vitePluginMissingPackage.test.ts build-tools/bundler-plugins/src/shared/__tests__/resolvePublishedPackage.test.ts build-tools/bundler-plugins/src/shared/__tests__/facadeSentinel.test.ts build-tools/bundler-plugins/src/shared/__tests__/joinHostPublicPath.test.ts build-tools/bundler-plugins/src/shared/__tests__/hostBootstrapRuntime.test.ts build-tools/plugins/loaders/plugins/__tests__/publicPath.test.ts build-tools/plugins/shared/__tests__/publicPathResolve.test.ts build-tools/plugins/shared-runtime/__tests__/publishBootstrapShim.test.ts build-tools/bundler-plugins/src/vite/__tests__/vitePluginPublicPath.test.ts build-tools/bundler-plugins/src/webpack/__tests__/webpackPluginPublicPath.test.ts build-tools/bundler-plugins/src/webpack/__tests__/webpackPluginPublicPath.concat.integration.test.ts build-tools/bundler-plugins/src/shared/__tests__/webpackModuleSource.test.ts build-tools/bundler-plugins/src/shared/__tests__/hostPackageEntryMatch.hypothesis.test.ts build-tools/bundler-plugins/src/webpack/__tests__/webpackPluginPublicPath.hypothesis.test.ts build-tools/cli/lib/__tests__/localTestDirectoryLock.test.ts build-tools/cli/lib/cli/__tests__/normalizeProjectOptions.test.ts build-tools/cli/lib/cli/__tests__/postCreateRunCommands.test.ts build-tools/cli/lib/cli/__tests__/suggestProjectName.test.ts build-tools/cli/lib/template-engine/__tests__/standLayers.test.ts build-tools/cli/lib/template-engine/context/__tests__/assertDistReady.test.ts build-tools/cli/lib/template-engine/context/__tests__/prepareDist.test.ts build-tools/cli/lib/template-engine/context/__tests__/serveDist.test.ts build-tools/cli/lib/template-engine/context/__tests__/standAngularEsbuildPackageJsonData.test.ts build-tools/cli/lib/template-engine/context/__tests__/standAngularPackageJsonData.test.ts build-tools/cli/lib/template-engine/context/__tests__/standReadmeStrings.test.ts build-tools/cli/lib/template-engine/context/__tests__/standScripts.test.ts build-tools/cli/lib/template-engine/emitEtaTree.test.ts build-tools/cli/lib/template-engine/resolveVariantDir.test.ts build-tools/cli/lib/template-engine/context/buildResourceProxyStandPolicy.test.ts build-tools/cli/lib/template-engine/standResourceProxyViteDevHostEta.test.ts build-tools/cli/lib/template-engine/standDevStorageMiddleware.test.ts build-tools/cli/lib/template-engine/standHostDevServerWebpack.test.ts build-tools/cli/project-templates/stand/resource-proxy/vite/config/lib/proxy/__tests__/core.test.ts build-tools/cli/lib/templates/shared/__tests__/legacyReactDependencies.test.ts build-tools/cli/project-templates/plugin/shared-base/scripts/resolvePluginDevPort.test.ts build-tools/config/__tests__/runtimeCoreBuildDefine.test.ts build-tools/config/utils/__tests__/treeshakeConfig.test.ts build-tools/utils/__tests__/normalizeScriptArgv.test.ts build-tools/utils/__tests__/pipelineConcurrency.test.ts build-tools/utils/__tests__/taskResourceMetrics.test.ts",
|
|
1606
|
+
"test:build-tools:node": "tsx --tsconfig build-tools/cli/tsconfig.json --test build-tools/bundler-plugins/src/shared/__tests__/hostPackageEntryMatch.test.ts build-tools/bundler-plugins/src/shared/__tests__/hostPluginDiagnostics.test.ts build-tools/bundler-plugins/src/shared/__tests__/externalizedPackageDetect.test.ts build-tools/bundler-plugins/src/vite/__tests__/vitePluginPublicPath.diagnostics.test.ts build-tools/bundler-plugins/src/webpack/__tests__/webpackPluginMissingPackage.test.ts build-tools/bundler-plugins/src/vite/__tests__/vitePluginMissingPackage.test.ts build-tools/bundler-plugins/src/shared/__tests__/resolvePublishedPackage.test.ts build-tools/bundler-plugins/src/shared/__tests__/facadeSentinel.test.ts build-tools/bundler-plugins/src/shared/__tests__/joinHostPublicPath.test.ts build-tools/bundler-plugins/src/shared/__tests__/hostBootstrapRuntime.test.ts build-tools/plugins/loaders/plugins/__tests__/publicPath.test.ts build-tools/plugins/shared/__tests__/publicPathResolve.test.ts build-tools/plugins/shared-runtime/__tests__/publishBootstrapShim.test.ts build-tools/bundler-plugins/src/vite/__tests__/vitePluginPublicPath.test.ts build-tools/bundler-plugins/src/webpack/__tests__/webpackPluginPublicPath.test.ts build-tools/bundler-plugins/src/webpack/__tests__/webpackPluginPublicPath.concat.integration.test.ts build-tools/bundler-plugins/src/shared/__tests__/webpackModuleSource.test.ts build-tools/bundler-plugins/src/shared/__tests__/hostPackageEntryMatch.hypothesis.test.ts build-tools/bundler-plugins/src/webpack/__tests__/webpackPluginPublicPath.hypothesis.test.ts build-tools/cli/lib/__tests__/localTestDirectoryLock.test.ts build-tools/cli/lib/cli/__tests__/normalizeProjectOptions.test.ts build-tools/cli/lib/cli/__tests__/postCreateRunCommands.test.ts build-tools/cli/lib/cli/__tests__/suggestProjectName.test.ts build-tools/cli/lib/template-engine/__tests__/standLayers.test.ts build-tools/cli/lib/template-engine/context/__tests__/assertDistReady.test.ts build-tools/cli/lib/template-engine/context/__tests__/prepareDist.test.ts build-tools/cli/lib/template-engine/context/__tests__/serveDist.test.ts build-tools/cli/lib/template-engine/context/__tests__/standAngularEsbuildPackageJsonData.test.ts build-tools/cli/lib/template-engine/context/__tests__/standAngularPackageJsonData.test.ts build-tools/cli/lib/template-engine/context/__tests__/standReadmeStrings.test.ts build-tools/cli/lib/template-engine/context/__tests__/standScripts.test.ts build-tools/cli/lib/template-engine/emitEtaTree.test.ts build-tools/cli/lib/template-engine/resolveVariantDir.test.ts build-tools/cli/lib/template-engine/context/buildResourceProxyStandPolicy.test.ts build-tools/cli/lib/template-engine/standResourceProxyViteDevHostEta.test.ts build-tools/cli/lib/template-engine/standDevStorageMiddleware.test.ts build-tools/cli/lib/template-engine/standHostDevServerWebpack.test.ts build-tools/cli/project-templates/stand/resource-proxy/vite/config/lib/proxy/__tests__/core.test.ts build-tools/cli/lib/templates/shared/__tests__/legacyReactDependencies.test.ts build-tools/cli/project-templates/plugin/shared-base/scripts/resolvePluginDevPort.test.ts build-tools/config/__tests__/runtimeCoreBuildDefine.test.ts build-tools/config/utils/__tests__/treeshakeConfig.test.ts build-tools/utils/__tests__/findFreePort.test.ts build-tools/utils/__tests__/normalizeScriptArgv.test.ts build-tools/utils/__tests__/pipelineConcurrency.test.ts build-tools/utils/__tests__/taskResourceMetrics.test.ts",
|
|
1607
1607
|
"clear:babel-cache": "rimraf -rf ./node_modules/.cache/babel-loader/*",
|
|
1608
1608
|
"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
1609
|
"delete-map-files": "find ./build -name '*.map' -delete",
|
|
@@ -1628,6 +1628,7 @@ var ROOT_PKG = {
|
|
|
1628
1628
|
"test:typecheck": "npm run lint:types && tsc -p iframe/tsconfig.json --noEmit",
|
|
1629
1629
|
"type-check:tooling": "tsc -p build-tools/tsconfig.tooling.json",
|
|
1630
1630
|
"lint:new": "tsx build-tools/scripts/lint/diffAwareLint.ts",
|
|
1631
|
+
"test:plugin-matrix": "tsx build-tools/scripts/dev/run-plugin-matrix.ts",
|
|
1631
1632
|
"lint:ci": "tsx build-tools/scripts/lint/diffAwareLint.ts",
|
|
1632
1633
|
"test:lint": "oxlint --config .oxlintrc.json .",
|
|
1633
1634
|
"lint:css": "stylelint \"**/*.{css,scss,sass}\" --fix",
|
|
@@ -3528,7 +3529,7 @@ var rawTemplateModules = /* #__PURE__ */ Object.assign({
|
|
|
3528
3529
|
"../../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
3530
|
"../../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
3531
|
"../../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
|
|
3532
|
+
"../../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
3533
|
"../../project-templates/plugin/shared-base/scripts/hostDevServerHeaders.ts.eta": "<%~ include('stand-host-dev-server-webpack', it) %>\n",
|
|
3533
3534
|
"../../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
3535
|
"../../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