@kuafucloud/product-build 0.2.2-alpha.4 → 0.2.2-alpha.5
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/src/generate/scaffolds.js +0 -13
- package/dist/src/product/build/extension/packaging/public-code.d.ts +1 -0
- package/dist/src/product/build/extension/packaging/public-code.js +7 -2
- package/dist/src/product/build/extension/packaging/public-services.js +2 -1
- package/dist/src/templates/verification/register-extension-verification.mjs +1 -0
- package/dist/templates/runtime/static-runtime-bootstrap.mjs +1 -1
- package/package.json +2 -2
|
@@ -224,19 +224,6 @@ async function generateE2eTest(codebaseDir, options) {
|
|
|
224
224
|
...(options.dryRun ? { notes: ["dry-run: no files were written."] } : {}),
|
|
225
225
|
};
|
|
226
226
|
}
|
|
227
|
-
function resolveProductPlaywrightConfig(codebaseDir, productRoot) {
|
|
228
|
-
const configName = [
|
|
229
|
-
"playwright.config.ts",
|
|
230
|
-
"playwright.config.mts",
|
|
231
|
-
"playwright.config.cts",
|
|
232
|
-
"playwright.config.js",
|
|
233
|
-
"playwright.config.mjs",
|
|
234
|
-
"playwright.config.cjs",
|
|
235
|
-
].find((candidate) => existsSync(path.join(productRoot, candidate)));
|
|
236
|
-
return configName
|
|
237
|
-
? toWorkspaceRelative(codebaseDir, path.join(productRoot, configName))
|
|
238
|
-
: undefined;
|
|
239
|
-
}
|
|
240
227
|
async function runAndPrint(command, result) {
|
|
241
228
|
printCliResult(command, result);
|
|
242
229
|
}
|
|
@@ -21,6 +21,7 @@ export async function readPublicDependency(require, name) {
|
|
|
21
21
|
export async function compilePublicEntry(source, target, dependencies, peers, owner) {
|
|
22
22
|
const require = createRequire(source);
|
|
23
23
|
const result = await build({ absWorkingDir: path.dirname(source), entryPoints: [source], bundle: true, packages: "external",
|
|
24
|
+
external: Object.keys(owner.dependencies),
|
|
24
25
|
format: "esm", platform: "neutral", target: "es2022", write: false, metafile: true, sourcemap: false, legalComments: "none", logLevel: "silent" });
|
|
25
26
|
for (const imported of Object.values(result.metafile.outputs).flatMap(output => output.imports).filter(item => item.external)) {
|
|
26
27
|
await registerPublicImport(require, imported.path, dependencies, peers, owner);
|
|
@@ -40,7 +41,11 @@ export async function registerPublicImport(require, specifier, dependencies, pee
|
|
|
40
41
|
const dependency = await readPublicDependency(require, name);
|
|
41
42
|
if (name.startsWith("@kuafucloud/") && dependency.kuafucloud?.classification !== "publishable")
|
|
42
43
|
throw new Error(`公开扩展仍依赖内部包 ${name},请先迁移其实现。`);
|
|
43
|
-
|
|
44
|
+
// 精确依赖沿用源码包声明;本机联调安装的临时版本不属于公开包的依赖合同。
|
|
45
|
+
// workspace 或范围声明在打包时解析为实际包版本,与 npm 打包语义一致。
|
|
46
|
+
const declared = owner.dependencies[name];
|
|
47
|
+
const version = declared && /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u.test(declared) ? declared : dependency.version;
|
|
48
|
+
addPublicDependency(dependency.kuafucloud?.kind === "product-runtime-client" ? peers : dependencies, name, version);
|
|
44
49
|
}
|
|
45
50
|
/** 保留声明文件内部相对引用;所有声明都由公开 src 闭包产生。 */
|
|
46
51
|
export function emitPublicDeclarations(sourceRoot, entries) {
|
|
@@ -55,7 +60,7 @@ export function emitPublicDeclarations(sourceRoot, entries) {
|
|
|
55
60
|
const files = [];
|
|
56
61
|
const program = ts.createProgram([...entries], { ...options, target: ts.ScriptTarget.ES2022, module: ts.ModuleKind.ESNext,
|
|
57
62
|
moduleResolution: ts.ModuleResolutionKind.Bundler, declaration: true, emitDeclarationOnly: true, noEmit: false,
|
|
58
|
-
declarationMap: false, sourceMap: false, skipLibCheck: true, rootDir: sourceRoot, outDir, types: options.types ?? [] });
|
|
63
|
+
declarationMap: false, sourceMap: false, skipLibCheck: true, paths: {}, rootDir: sourceRoot, outDir, types: options.types ?? [] });
|
|
59
64
|
const result = program.emit(undefined, (file, bytes) => {
|
|
60
65
|
const relative = path.relative(outDir, file);
|
|
61
66
|
if (relative.startsWith("..") || path.isAbsolute(relative) || !relative.endsWith(".d.ts"))
|
|
@@ -16,7 +16,8 @@ export async function compilePublicExtensionServices(publicSourceRoot, publicati
|
|
|
16
16
|
const packageJson = JSON.parse(await readFile(path.join(publicSourceRoot, "package.json"), "utf8"));
|
|
17
17
|
const publicEntries = packageJson.kuafucloud?.publicEntries ?? {};
|
|
18
18
|
const serviceClients = packageJson.kuafucloud?.serviceClients ?? {};
|
|
19
|
-
const owner = { packageName: publication.packageName, exportPaths: new Set(["./server", ...Object.keys(publicEntries)])
|
|
19
|
+
const owner = { packageName: publication.packageName, exportPaths: new Set(["./server", ...Object.keys(publicEntries)]),
|
|
20
|
+
dependencies: { ...packageJson.peerDependencies, ...packageJson.dependencies } };
|
|
20
21
|
for (const exportPath of Object.values(serviceClients)) {
|
|
21
22
|
if (typeof exportPath !== "string" || !(exportPath in publicEntries))
|
|
22
23
|
throw new Error("Service Client 必须声明对应的公开源码入口。");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* global URL, Event, PopStateEvent, AbortController, AbortSignal */
|
|
1
|
+
/* global URL, URLSearchParams, Event, PopStateEvent, AbortController, AbortSignal */
|
|
2
2
|
// 静态 Runtime 的实际初始化器;平台和已装载模块由生成入口显式注入。
|
|
3
3
|
export async function initializeStaticRuntimeBootstrap(input, ports) {
|
|
4
4
|
const { runtimeArtifact, productArtifact, moduleLeases, mode } = input;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kuafucloud/product-build",
|
|
3
|
-
"version": "0.2.2-alpha.
|
|
3
|
+
"version": "0.2.2-alpha.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"type": "module",
|
|
@@ -373,7 +373,7 @@
|
|
|
373
373
|
"classification": "publishable",
|
|
374
374
|
"nativeVerification": {
|
|
375
375
|
"source": {
|
|
376
|
-
"platformInstanceId": "
|
|
376
|
+
"platformInstanceId": "prod",
|
|
377
377
|
"projectId": "10000",
|
|
378
378
|
"repositoryId": "github-1303756583"
|
|
379
379
|
},
|