@brookesia/pipeline 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle-config.d.ts +13 -0
- package/dist/bundle-config.d.ts.map +1 -0
- package/dist/bundle-config.js +70 -0
- package/dist/bundle-config.js.map +1 -0
- package/dist/bundle-config.test.d.ts +2 -0
- package/dist/bundle-config.test.d.ts.map +1 -0
- package/dist/bundle-config.test.js +33 -0
- package/dist/bundle-config.test.js.map +1 -0
- package/dist/context.d.ts +6 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +2 -0
- package/dist/context.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/lane.d.ts +4 -0
- package/dist/lane.d.ts.map +1 -0
- package/dist/lane.js +34 -0
- package/dist/lane.js.map +1 -0
- package/dist/lvgl-image-assets.d.ts +22 -0
- package/dist/lvgl-image-assets.d.ts.map +1 -0
- package/dist/lvgl-image-assets.js +165 -0
- package/dist/lvgl-image-assets.js.map +1 -0
- package/dist/lvgl-image-assets.test.d.ts +2 -0
- package/dist/lvgl-image-assets.test.d.ts.map +1 -0
- package/dist/lvgl-image-assets.test.js +56 -0
- package/dist/lvgl-image-assets.test.js.map +1 -0
- package/dist/package-exclude.d.ts +16 -0
- package/dist/package-exclude.d.ts.map +1 -0
- package/dist/package-exclude.js +42 -0
- package/dist/package-exclude.js.map +1 -0
- package/dist/package-exclude.test.d.ts +2 -0
- package/dist/package-exclude.test.d.ts.map +1 -0
- package/dist/package-exclude.test.js +30 -0
- package/dist/package-exclude.test.js.map +1 -0
- package/dist/steps/bundle-js.d.ts +3 -0
- package/dist/steps/bundle-js.d.ts.map +1 -0
- package/dist/steps/bundle-js.js +49 -0
- package/dist/steps/bundle-js.js.map +1 -0
- package/dist/steps/compile-wasm.d.ts +3 -0
- package/dist/steps/compile-wasm.d.ts.map +1 -0
- package/dist/steps/compile-wasm.js +37 -0
- package/dist/steps/compile-wasm.js.map +1 -0
- package/dist/steps/compile-wasm.test.d.ts +2 -0
- package/dist/steps/compile-wasm.test.d.ts.map +1 -0
- package/dist/steps/compile-wasm.test.js +33 -0
- package/dist/steps/compile-wasm.test.js.map +1 -0
- package/dist/steps/mirror-to-build.d.ts +3 -0
- package/dist/steps/mirror-to-build.d.ts.map +1 -0
- package/dist/steps/mirror-to-build.js +44 -0
- package/dist/steps/mirror-to-build.js.map +1 -0
- package/dist/steps/pack-gui-images.d.ts +7 -0
- package/dist/steps/pack-gui-images.d.ts.map +1 -0
- package/dist/steps/pack-gui-images.js +185 -0
- package/dist/steps/pack-gui-images.js.map +1 -0
- package/dist/steps/pack-gui-images.test.d.ts +2 -0
- package/dist/steps/pack-gui-images.test.d.ts.map +1 -0
- package/dist/steps/pack-gui-images.test.js +29 -0
- package/dist/steps/pack-gui-images.test.js.map +1 -0
- package/dist/steps/pack.d.ts +3 -0
- package/dist/steps/pack.d.ts.map +1 -0
- package/dist/steps/pack.js +19 -0
- package/dist/steps/pack.js.map +1 -0
- package/dist/steps/sync-settings-assets.d.ts +6 -0
- package/dist/steps/sync-settings-assets.d.ts.map +1 -0
- package/dist/steps/sync-settings-assets.js +31 -0
- package/dist/steps/sync-settings-assets.js.map +1 -0
- package/dist/steps/validate.d.ts +3 -0
- package/dist/steps/validate.d.ts.map +1 -0
- package/dist/steps/validate.js +12 -0
- package/dist/steps/validate.js.map +1 -0
- package/package.json +43 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type BundleTool = 'rspack' | 'webpack';
|
|
2
|
+
export declare function resolveBundlerBin(projectRoot: string, tool: BundleTool): string;
|
|
3
|
+
export declare function assertBundlePaths(entry: string, output: string): void;
|
|
4
|
+
export declare function writeDefaultBundleConfig(options: {
|
|
5
|
+
projectRoot: string;
|
|
6
|
+
tool: BundleTool;
|
|
7
|
+
mode: 'development' | 'production';
|
|
8
|
+
entryAbs: string;
|
|
9
|
+
outputDirAbs: string;
|
|
10
|
+
outputFilename: string;
|
|
11
|
+
}): Promise<string>;
|
|
12
|
+
export declare function bundlerCliArgs(tool: BundleTool, configPath: string, extra?: string[]): string[];
|
|
13
|
+
//# sourceMappingURL=bundle-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-config.d.ts","sourceRoot":"","sources":["../src/bundle-config.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE9C,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,CAkB/E;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAOrE;AAED,wBAAsB,wBAAwB,CAAC,OAAO,EAAE;IACtD,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,aAAa,GAAG,YAAY,CAAC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;CACxB,GAAG,OAAO,CAAC,MAAM,CAAC,CAiClB;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAM/F"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { isSafeRelativePath } from '@brookesia/config-schema';
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
export function resolveBundlerBin(projectRoot, tool) {
|
|
5
|
+
const binName = tool === 'rspack' ? 'rspack' : 'webpack';
|
|
6
|
+
let dir = path.resolve(projectRoot);
|
|
7
|
+
while (true) {
|
|
8
|
+
const candidate = path.join(dir, 'node_modules', '.bin', binName);
|
|
9
|
+
if (fs.existsSync(candidate)) {
|
|
10
|
+
return candidate;
|
|
11
|
+
}
|
|
12
|
+
const parent = path.dirname(dir);
|
|
13
|
+
if (parent === dir) {
|
|
14
|
+
break;
|
|
15
|
+
}
|
|
16
|
+
dir = parent;
|
|
17
|
+
}
|
|
18
|
+
const pkg = tool === 'rspack' ? '@rspack/cli' : 'webpack webpack-cli';
|
|
19
|
+
throw new Error(`bundle-js: "${binName}" not found in ${projectRoot} or ancestor node_modules/.bin — install ${pkg} in the app or esp-brookesia-toolkit root`);
|
|
20
|
+
}
|
|
21
|
+
export function assertBundlePaths(entry, output) {
|
|
22
|
+
if (!isSafeRelativePath(entry)) {
|
|
23
|
+
throw new Error(`js.bundle.entry must be a safe relative path: ${entry}`);
|
|
24
|
+
}
|
|
25
|
+
if (!isSafeRelativePath(output)) {
|
|
26
|
+
throw new Error(`js.bundle.output must be a safe relative path: ${output}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export async function writeDefaultBundleConfig(options) {
|
|
30
|
+
const cacheDir = path.join(options.projectRoot, '.brookesia');
|
|
31
|
+
await fs.ensureDir(cacheDir);
|
|
32
|
+
const configPath = path.join(cacheDir, `bundle.${options.tool}.mjs`);
|
|
33
|
+
const body = `/** Generated by @brookesia/pipeline — do not edit; set js.bundle.configFile in brookesia.config.js instead. */
|
|
34
|
+
const entry = ${JSON.stringify(options.entryAbs)};
|
|
35
|
+
const outputPath = ${JSON.stringify(options.outputDirAbs)};
|
|
36
|
+
const outputFilename = ${JSON.stringify(options.outputFilename)};
|
|
37
|
+
|
|
38
|
+
export default {
|
|
39
|
+
mode: ${JSON.stringify(options.mode)},
|
|
40
|
+
entry,
|
|
41
|
+
output: {
|
|
42
|
+
path: outputPath,
|
|
43
|
+
filename: outputFilename,
|
|
44
|
+
library: {
|
|
45
|
+
name: 'brookesia_app',
|
|
46
|
+
type: 'assign',
|
|
47
|
+
export: 'default',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
externals: {
|
|
51
|
+
brookesia: 'brookesia',
|
|
52
|
+
},
|
|
53
|
+
optimization: {
|
|
54
|
+
splitChunks: false,
|
|
55
|
+
runtimeChunk: false,
|
|
56
|
+
},
|
|
57
|
+
devtool: false,
|
|
58
|
+
};
|
|
59
|
+
`;
|
|
60
|
+
await fs.writeFile(configPath, body, 'utf8');
|
|
61
|
+
return configPath;
|
|
62
|
+
}
|
|
63
|
+
export function bundlerCliArgs(tool, configPath, extra) {
|
|
64
|
+
const tail = extra ?? [];
|
|
65
|
+
if (tool === 'rspack') {
|
|
66
|
+
return ['build', '-c', configPath, ...tail];
|
|
67
|
+
}
|
|
68
|
+
return ['--config', configPath, ...tail];
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=bundle-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-config.js","sourceRoot":"","sources":["../src/bundle-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,WAAW,CAAC;AAI7B,MAAM,UAAU,iBAAiB,CAAC,WAAmB,EAAE,IAAgB;IACrE,MAAM,OAAO,GAAG,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;IACzD,IAAI,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACpC,OAAO,IAAI,EAAE,CAAC;QACZ,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAClE,IAAI,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC7B,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,I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AAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAC7C,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAgB,EAAE,UAAkB,EAAE,KAAgB;IACnF,MAAM,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;IACzB,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtB,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO,CAAC,UAAU,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-config.test.d.ts","sourceRoot":"","sources":["../src/bundle-config.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { describe, expect, it } from 'vitest';
|
|
5
|
+
import { assertBundlePaths, bundlerCliArgs, resolveBundlerBin } from './bundle-config.js';
|
|
6
|
+
describe('bundle-config', () => {
|
|
7
|
+
it('bundlerCliArgs matches rspack vs webpack', () => {
|
|
8
|
+
expect(bundlerCliArgs('rspack', '/tmp/c.mjs')).toEqual(['build', '-c', '/tmp/c.mjs']);
|
|
9
|
+
expect(bundlerCliArgs('webpack', '/tmp/c.mjs', ['--stats', 'errors-only'])).toEqual([
|
|
10
|
+
'--config',
|
|
11
|
+
'/tmp/c.mjs',
|
|
12
|
+
'--stats',
|
|
13
|
+
'errors-only',
|
|
14
|
+
]);
|
|
15
|
+
});
|
|
16
|
+
it('assertBundlePaths rejects traversal', () => {
|
|
17
|
+
expect(() => assertBundlePaths('../x.js', 'app/out.js')).toThrow();
|
|
18
|
+
expect(() => assertBundlePaths('src/main.js', '../out.js')).toThrow();
|
|
19
|
+
});
|
|
20
|
+
it('assertBundlePaths accepts normal paths', () => {
|
|
21
|
+
expect(() => assertBundlePaths('src/main.js', 'app/main.js')).not.toThrow();
|
|
22
|
+
});
|
|
23
|
+
it('resolves bundler from ancestor node_modules for toolkit-root installs', async () => {
|
|
24
|
+
const root = await fs.mkdtemp(path.join(os.tmpdir(), 'brookesia-bundler-'));
|
|
25
|
+
const app = path.join(root, 'my-bundle-app');
|
|
26
|
+
const bin = path.join(root, 'node_modules', '.bin', 'rspack');
|
|
27
|
+
await fs.ensureDir(app);
|
|
28
|
+
await fs.ensureDir(path.dirname(bin));
|
|
29
|
+
await fs.writeFile(bin, '#!/bin/sh\n');
|
|
30
|
+
expect(resolveBundlerBin(app, 'rspack')).toBe(bin);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=bundle-config.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-config.test.js","sourceRoot":"","sources":["../src/bundle-config.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE1F,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QAClD,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC;QACtF,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,YAAY,EAAE,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,OAAO,CAA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rD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACrD,IAAI,EAAE,SAAS,CAAC;CACjB"}
|
package/dist/context.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
|
package/dist/lane.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lane.d.ts","sourceRoot":"","sources":["../src/lane.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAQpD,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,YAAY,CAAC;AAWrD,wBAAsB,WAAW,CAAC,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBrE"}
|
package/dist/lane.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { logStep, logSuccess, validateAppProjectForBuild } from '@brookesia/shared-utils';
|
|
2
|
+
import { runBundleJs } from './steps/bundle-js.js';
|
|
3
|
+
import { runMirrorToBuild } from './steps/mirror-to-build.js';
|
|
4
|
+
import { runPackGuiImages } from './steps/pack-gui-images.js';
|
|
5
|
+
import { runPack } from './steps/pack.js';
|
|
6
|
+
import { runSyncSettingsAssets } from './steps/sync-settings-assets.js';
|
|
7
|
+
import { runValidate } from './steps/validate.js';
|
|
8
|
+
function rejectNativeWasmCompileConfig(ctx) {
|
|
9
|
+
const wasm = ctx.config.wasm;
|
|
10
|
+
if (wasm?.sources?.length) {
|
|
11
|
+
throw new Error('wasm.sources is no longer supported. Provide a prebuilt .wasm at manifest.runtime.entry instead.');
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export async function runPipeline(ctx) {
|
|
15
|
+
if (!ctx.config.pack?.skipBuildMirror) {
|
|
16
|
+
validateAppProjectForBuild(ctx.projectRoot, ctx.sourceRoot);
|
|
17
|
+
}
|
|
18
|
+
rejectNativeWasmCompileConfig(ctx);
|
|
19
|
+
const started = Date.now();
|
|
20
|
+
const steps = [
|
|
21
|
+
{ name: 'sync-settings-assets', run: () => runSyncSettingsAssets(ctx) },
|
|
22
|
+
{ name: 'bundle-js', run: () => runBundleJs(ctx) },
|
|
23
|
+
{ name: 'mirror-to-build', run: () => runMirrorToBuild(ctx) },
|
|
24
|
+
{ name: 'validate', run: () => runValidate(ctx) },
|
|
25
|
+
{ name: 'pack-gui-images', run: () => runPackGuiImages(ctx) },
|
|
26
|
+
{ name: 'pack', run: () => runPack(ctx) },
|
|
27
|
+
];
|
|
28
|
+
for (const step of steps) {
|
|
29
|
+
logStep(`pipeline: ${step.name}`);
|
|
30
|
+
await step.run();
|
|
31
|
+
}
|
|
32
|
+
logSuccess(`build success: ${Date.now() - started}ms`);
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=lane.js.map
|
package/dist/lane.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lane.js","sourceRoot":"","sources":["../src/lane.ts"],"names":[],"mappings":"AAAA,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E;QAC7D,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE;QACjD,EAAE,IAAI,EAAE,iBAAiB,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE;QAC7D,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;KAC1C,CAAC;IAEF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,OAAO,CAAC,aAAa,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAClC,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;IACnB,CAAC;IAED,UAAU,CAAC,kBAAkB,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,IAAI,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** LVGL v9 on-disk image header (12 bytes), same layout as LVGLImage.py / brookesia_gui_lvgl. */
|
|
2
|
+
export declare const LVGL_IMAGE_HEADER_MAGIC = 25;
|
|
3
|
+
export interface LvglImageDimensions {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function readLvglBinDimensions(bin: Buffer): LvglImageDimensions;
|
|
8
|
+
export declare function buildLvglBinHeader(cf: number, flags: number, width: number, height: number, stride: number): Buffer;
|
|
9
|
+
export declare function defaultStride(cf: number, width: number): number;
|
|
10
|
+
export declare function imageDescriptorJson(id: string, width: number, height: number): string;
|
|
11
|
+
export interface ParsedLvglCImage {
|
|
12
|
+
cf: number;
|
|
13
|
+
flags: number;
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
stride: number;
|
|
17
|
+
map: Buffer;
|
|
18
|
+
}
|
|
19
|
+
/** Parse LVGL v9 image C sources (LVGLImage.py or https://lvgl.io/tools/imageconverter). */
|
|
20
|
+
export declare function parseLvglImageCSource(source: string): ParsedLvglCImage;
|
|
21
|
+
export declare function lvglCSourceToBin(source: string): Buffer;
|
|
22
|
+
//# sourceMappingURL=lvgl-image-assets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lvgl-image-assets.d.ts","sourceRoot":"","sources":["../src/lvgl-image-assets.ts"],"names":[],"mappings":"AAMA,iGAAiG;AACjG,eAAO,MAAM,uBAAuB,KAAO,CAAC;AA2C5C,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,mBAAmB,CAatE;AAED,wBAAgB,kBAAkB,CAChC,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACb,MAAM,CAUR;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAM/D;AAED,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAQrF;AA2DD,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb;AAED,4FAA4F;AAC5F,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAmBtE;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAUvD"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/** LVGL v9 on-disk image header (12 bytes), same layout as LVGLImage.py / brookesia_gui_lvgl. */
|
|
7
|
+
export const LVGL_IMAGE_HEADER_MAGIC = 0x19;
|
|
8
|
+
/** Matches LVGLImage.py ColorFormat enum values used by the online converter. */
|
|
9
|
+
const COLOR_FORMAT_BY_NAME = {
|
|
10
|
+
L8: 0x06,
|
|
11
|
+
I1: 0x07,
|
|
12
|
+
I2: 0x08,
|
|
13
|
+
I4: 0x09,
|
|
14
|
+
I8: 0x0a,
|
|
15
|
+
A1: 0x0b,
|
|
16
|
+
A2: 0x0c,
|
|
17
|
+
A4: 0x0d,
|
|
18
|
+
A8: 0x0e,
|
|
19
|
+
RGB888: 0x0f,
|
|
20
|
+
ARGB8888: 0x10,
|
|
21
|
+
XRGB8888: 0x11,
|
|
22
|
+
RGB565: 0x12,
|
|
23
|
+
ARGB8565: 0x13,
|
|
24
|
+
RGB565A8: 0x14,
|
|
25
|
+
RGB565_SWAPPED: 0x1b,
|
|
26
|
+
ARGB8888_PREMULTIPLIED: 0x1a,
|
|
27
|
+
};
|
|
28
|
+
const BPP_BY_CF = {
|
|
29
|
+
0x06: 8,
|
|
30
|
+
0x07: 1,
|
|
31
|
+
0x08: 2,
|
|
32
|
+
0x09: 4,
|
|
33
|
+
0x0a: 8,
|
|
34
|
+
0x0b: 1,
|
|
35
|
+
0x0c: 2,
|
|
36
|
+
0x0d: 4,
|
|
37
|
+
0x0e: 8,
|
|
38
|
+
0x0f: 24,
|
|
39
|
+
0x10: 32,
|
|
40
|
+
0x11: 32,
|
|
41
|
+
0x12: 16,
|
|
42
|
+
0x13: 24,
|
|
43
|
+
0x14: 16,
|
|
44
|
+
0x1a: 32,
|
|
45
|
+
0x1b: 16,
|
|
46
|
+
};
|
|
47
|
+
export function readLvglBinDimensions(bin) {
|
|
48
|
+
if (bin.length < 12) {
|
|
49
|
+
throw new Error('Invalid LVGL image bin: header too short');
|
|
50
|
+
}
|
|
51
|
+
if (bin[0] !== LVGL_IMAGE_HEADER_MAGIC) {
|
|
52
|
+
throw new Error(`Invalid LVGL image bin magic 0x${bin[0].toString(16)}`);
|
|
53
|
+
}
|
|
54
|
+
const width = bin.readUInt16LE(4);
|
|
55
|
+
const height = bin.readUInt16LE(6);
|
|
56
|
+
if (width <= 0 || height <= 0) {
|
|
57
|
+
throw new Error(`Invalid LVGL image bin size ${width}x${height}`);
|
|
58
|
+
}
|
|
59
|
+
return { width, height };
|
|
60
|
+
}
|
|
61
|
+
export function buildLvglBinHeader(cf, flags, width, height, stride) {
|
|
62
|
+
const header = Buffer.alloc(12);
|
|
63
|
+
header[0] = LVGL_IMAGE_HEADER_MAGIC;
|
|
64
|
+
header[1] = cf & 0x1f;
|
|
65
|
+
header.writeUInt16LE(flags & 0xffff, 2);
|
|
66
|
+
header.writeUInt16LE(width & 0xffff, 4);
|
|
67
|
+
header.writeUInt16LE(height & 0xffff, 6);
|
|
68
|
+
header.writeUInt16LE(stride & 0xffff, 8);
|
|
69
|
+
header.writeUInt16LE(0, 10);
|
|
70
|
+
return header;
|
|
71
|
+
}
|
|
72
|
+
export function defaultStride(cf, width) {
|
|
73
|
+
const bpp = BPP_BY_CF[cf];
|
|
74
|
+
if (!bpp) {
|
|
75
|
+
throw new Error(`Cannot infer stride for color format 0x${cf.toString(16)}; set .stride in the C descriptor`);
|
|
76
|
+
}
|
|
77
|
+
return Math.ceil((width * bpp) / 8);
|
|
78
|
+
}
|
|
79
|
+
export function imageDescriptorJson(id, width, height) {
|
|
80
|
+
return `${JSON.stringify({
|
|
81
|
+
type: 'image',
|
|
82
|
+
id,
|
|
83
|
+
src: `${id}.bin`,
|
|
84
|
+
width,
|
|
85
|
+
height,
|
|
86
|
+
}, null, 4)}\n`;
|
|
87
|
+
}
|
|
88
|
+
function parseColorFormat(source) {
|
|
89
|
+
const named = source.match(/LV_COLOR_FORMAT_([A-Z0-9_]+)/);
|
|
90
|
+
if (named) {
|
|
91
|
+
const cf = COLOR_FORMAT_BY_NAME[named[1]];
|
|
92
|
+
if (cf === undefined) {
|
|
93
|
+
throw new Error(`Unsupported LV_COLOR_FORMAT_${named[1]} in image C source`);
|
|
94
|
+
}
|
|
95
|
+
return cf;
|
|
96
|
+
}
|
|
97
|
+
const numeric = source.match(/\b(0x[0-9a-fA-F]+|\d+)\b/);
|
|
98
|
+
if (numeric) {
|
|
99
|
+
return Number(numeric[1]);
|
|
100
|
+
}
|
|
101
|
+
throw new Error('Could not parse color format from lv_image_dsc_t');
|
|
102
|
+
}
|
|
103
|
+
function parseFlags(source) {
|
|
104
|
+
const trimmed = source.trim();
|
|
105
|
+
if (trimmed === '0') {
|
|
106
|
+
return 0;
|
|
107
|
+
}
|
|
108
|
+
let flags = 0;
|
|
109
|
+
if (trimmed.includes('LV_IMAGE_FLAGS_COMPRESSED')) {
|
|
110
|
+
flags |= 0x08;
|
|
111
|
+
}
|
|
112
|
+
if (trimmed.includes('LV_IMAGE_FLAGS_PREMULTIPLIED')) {
|
|
113
|
+
flags |= 0x01;
|
|
114
|
+
}
|
|
115
|
+
if (flags === 0 && /^\d+$/.test(trimmed)) {
|
|
116
|
+
return Number(trimmed);
|
|
117
|
+
}
|
|
118
|
+
if (flags === 0 && /^0x[0-9a-f]+$/i.test(trimmed)) {
|
|
119
|
+
return Number(trimmed);
|
|
120
|
+
}
|
|
121
|
+
if (flags === 0 && trimmed !== '') {
|
|
122
|
+
throw new Error(`Unsupported image flags expression: ${trimmed}`);
|
|
123
|
+
}
|
|
124
|
+
return flags;
|
|
125
|
+
}
|
|
126
|
+
function parseMapBytes(source) {
|
|
127
|
+
const mapMatch = source.match(/uint8_t\s+\w+_map\s*\[\s*\]\s*=\s*\{([\s\S]*?)\};/);
|
|
128
|
+
if (!mapMatch) {
|
|
129
|
+
throw new Error('Could not find uint8_t *_map[] byte array in image C source');
|
|
130
|
+
}
|
|
131
|
+
const bytes = [];
|
|
132
|
+
const hexRe = /0x([0-9a-fA-F]{1,2})/g;
|
|
133
|
+
let m;
|
|
134
|
+
while ((m = hexRe.exec(mapMatch[1])) !== null) {
|
|
135
|
+
bytes.push(Number.parseInt(m[1], 16));
|
|
136
|
+
}
|
|
137
|
+
if (bytes.length === 0) {
|
|
138
|
+
throw new Error('Image map array is empty or not in 0xNN hex form');
|
|
139
|
+
}
|
|
140
|
+
return Buffer.from(bytes);
|
|
141
|
+
}
|
|
142
|
+
/** Parse LVGL v9 image C sources (LVGLImage.py or https://lvgl.io/tools/imageconverter). */
|
|
143
|
+
export function parseLvglImageCSource(source) {
|
|
144
|
+
const cfMatch = source.match(/(?:\.header)?\.cf\s*=\s*([^,;\n]+)/);
|
|
145
|
+
const wMatch = source.match(/(?:\.header)?\.w\s*=\s*(\d+)/);
|
|
146
|
+
const hMatch = source.match(/(?:\.header)?\.h\s*=\s*(\d+)/);
|
|
147
|
+
const strideMatch = source.match(/(?:\.header)?\.stride\s*=\s*(\d+)/);
|
|
148
|
+
const flagsMatch = source.match(/(?:\.header)?\.flags\s*=\s*([^,;\n]+)/);
|
|
149
|
+
if (!cfMatch || !wMatch || !hMatch) {
|
|
150
|
+
throw new Error('lv_image_dsc_t must define .header.cf, .header.w, and .header.h');
|
|
151
|
+
}
|
|
152
|
+
const cf = parseColorFormat(cfMatch[1]);
|
|
153
|
+
const width = Number(wMatch[1]);
|
|
154
|
+
const height = Number(hMatch[1]);
|
|
155
|
+
const flags = flagsMatch ? parseFlags(flagsMatch[1]) : 0;
|
|
156
|
+
const stride = strideMatch ? Number(strideMatch[1]) : defaultStride(cf, width);
|
|
157
|
+
const map = parseMapBytes(source);
|
|
158
|
+
return { cf, flags, width, height, stride, map };
|
|
159
|
+
}
|
|
160
|
+
export function lvglCSourceToBin(source) {
|
|
161
|
+
const parsed = parseLvglImageCSource(source);
|
|
162
|
+
const header = buildLvglBinHeader(parsed.cf, parsed.flags, parsed.width, parsed.height, parsed.stride);
|
|
163
|
+
return Buffer.concat([header, parsed.map]);
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=lvgl-image-assets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lvgl-image-assets.js","sourceRoot":"","sources":["../src/lvgl-image-assets.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,iGAAiG;AACjG,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAE5C,iFAAiF;AACjF,MAAM,oBAAoB,GAA2B;IACnD,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,MAAM,EAAE,IAAI;IACZ,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,IAAI;IACd,MAAM,EAAE,IAAI;IACZ,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,IAAI;IACd,cAAc,EAAE,IAAI;IACpB,sBAAsB,EAAE,IAAI;CAC7B,CAAC;AAEF,MAAM,SAAS,GAAoC;IACjD,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,EAAE;IACR,IAAI,EAAE,EAAE;IACR,IAAI,EAAE,EAAE;IACR,IAAI,EAAE,EAAE;IACR,IAAI,EAAE,EAAE;IACR,IAAI,EAAE,EAAE;IACR,IAAI,EAAE,EAAE;IACR,IAAI,EAAE,EAAE;CACT,CAAC;AAOF,MAAM,UAAU,qBAAqB,CAAC,GAAW;IAC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CAAC,CAAC,CAAC,CAAC;IAC1D,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IAC/E,MAAM,GAAG,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IAElC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,MAAM,MAAM,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,kBAAkB,CAC/B,MAAM,CAAC,EAAE,EACT,MAAM,CAAC,KAAK,EACZ,MAAM,CAAC,KAAK,EACZ,MAAM,CAAC,MAAM,EACb,MAAM,CAAC,MAAM,CACd,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lvgl-image-assets.test.d.ts","sourceRoot":"","sources":["../src/lvgl-image-assets.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import fs from 'fs-extra';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
import { describe, expect, it } from 'vitest';
|
|
10
|
+
import { buildLvglBinHeader, lvglCSourceToBin, parseLvglImageCSource, readLvglBinDimensions, } from './lvgl-image-assets.js';
|
|
11
|
+
const FIXTURE_C = `uint8_t icon_map[] = {
|
|
12
|
+
0x11, 0x22, 0x33, 0x44,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const lv_image_dsc_t icon = {
|
|
16
|
+
.header = {
|
|
17
|
+
.magic = LV_IMAGE_HEADER_MAGIC,
|
|
18
|
+
.cf = LV_COLOR_FORMAT_ARGB8888,
|
|
19
|
+
.flags = 0,
|
|
20
|
+
.w = 1,
|
|
21
|
+
.h = 1,
|
|
22
|
+
.stride = 4,
|
|
23
|
+
.reserved_2 = 0,
|
|
24
|
+
},
|
|
25
|
+
.data_size = sizeof(icon_map),
|
|
26
|
+
.data = icon_map,
|
|
27
|
+
};
|
|
28
|
+
`;
|
|
29
|
+
describe('lvgl-image-assets', () => {
|
|
30
|
+
it('builds bin header and payload from C source', () => {
|
|
31
|
+
const bin = lvglCSourceToBin(FIXTURE_C);
|
|
32
|
+
expect(bin.length).toBe(16);
|
|
33
|
+
expect(bin[0]).toBe(0x19);
|
|
34
|
+
expect(bin[1]).toBe(0x10);
|
|
35
|
+
expect(readLvglBinDimensions(bin)).toEqual({ width: 1, height: 1 });
|
|
36
|
+
expect([...bin.subarray(12)]).toEqual([0x11, 0x22, 0x33, 0x44]);
|
|
37
|
+
});
|
|
38
|
+
it('reads dimensions from an existing flappybird bin', async () => {
|
|
39
|
+
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../../esp-brookesia');
|
|
40
|
+
const binPath = path.join(repoRoot, 'simulator/gui/general_test/assets/apps/brookesia.app.flappybird.js/res/images/bird_img1.bin');
|
|
41
|
+
if (!(await fs.pathExists(binPath))) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const bin = await fs.readFile(binPath);
|
|
45
|
+
expect(readLvglBinDimensions(bin)).toEqual({ width: 57, height: 41 });
|
|
46
|
+
});
|
|
47
|
+
it('matches LVGLImage.py header layout', () => {
|
|
48
|
+
const header = buildLvglBinHeader(0x10, 0, 57, 41, 228);
|
|
49
|
+
expect(header.toString('hex')).toBe('1910000039002900e4000000');
|
|
50
|
+
});
|
|
51
|
+
it('rejects C sources without stride for indexed formats when needed', () => {
|
|
52
|
+
const parsed = parseLvglImageCSource(FIXTURE_C);
|
|
53
|
+
expect(parsed.stride).toBe(4);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=lvgl-image-assets.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lvgl-image-assets.test.js","sourceRoot":"","sources":["../src/lvgl-image-assets.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;CAiBjB,CAAC;AAEF,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;QACrD,MAAM,GAAG,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;QACxC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC5B,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1B,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1B,MAAM,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,C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AAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Paths relative to sourceRoot excluded from mirror-to-build (not shipped in .bpk).
|
|
3
|
+
*/
|
|
4
|
+
export declare function matchExcludePattern(rel: string, pattern: string): boolean;
|
|
5
|
+
export declare function matchesAnyExclude(rel: string, patterns: string[]): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* When JS bundle is enabled: omit every .js under sourceRoot except the bundle output,
|
|
8
|
+
* plus optional excludeFromPackage globs.
|
|
9
|
+
*/
|
|
10
|
+
export declare function shouldMirrorPath(opts: {
|
|
11
|
+
rel: string;
|
|
12
|
+
bundleOutputJs?: string;
|
|
13
|
+
omitSourceJs: boolean;
|
|
14
|
+
excludePatterns: string[];
|
|
15
|
+
}): boolean;
|
|
16
|
+
//# sourceMappingURL=package-exclude.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-exclude.d.ts","sourceRoot":"","sources":["../src/package-exclude.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAqBzE;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAG1E;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B,GAAG,OAAO,CAeV"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Paths relative to sourceRoot excluded from mirror-to-build (not shipped in .bpk).
|
|
3
|
+
*/
|
|
4
|
+
export function matchExcludePattern(rel, pattern) {
|
|
5
|
+
const normalized = rel.replace(/\\/g, '/');
|
|
6
|
+
const pat = pattern.replace(/\\/g, '/');
|
|
7
|
+
if (pat.endsWith('/**')) {
|
|
8
|
+
const prefix = pat.slice(0, -3);
|
|
9
|
+
return normalized === prefix || normalized.startsWith(`${prefix}/`);
|
|
10
|
+
}
|
|
11
|
+
if (pat.includes('*')) {
|
|
12
|
+
const re = new RegExp(`^${pat
|
|
13
|
+
.replace(/[.+?^${}()|[\]\\]/g, '\\$&')
|
|
14
|
+
.replace(/\*\*/g, '<<<GLOBSTAR>>>')
|
|
15
|
+
.replace(/\*/g, '[^/]*')
|
|
16
|
+
.replace(/<<<GLOBSTAR>>>/g, '.*')}$`);
|
|
17
|
+
return re.test(normalized);
|
|
18
|
+
}
|
|
19
|
+
return normalized === pat;
|
|
20
|
+
}
|
|
21
|
+
export function matchesAnyExclude(rel, patterns) {
|
|
22
|
+
const normalized = rel.replace(/\\/g, '/');
|
|
23
|
+
return patterns.some((p) => matchExcludePattern(normalized, p));
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* When JS bundle is enabled: omit every .js under sourceRoot except the bundle output,
|
|
27
|
+
* plus optional excludeFromPackage globs.
|
|
28
|
+
*/
|
|
29
|
+
export function shouldMirrorPath(opts) {
|
|
30
|
+
const rel = opts.rel.replace(/\\/g, '/');
|
|
31
|
+
if (opts.excludePatterns.length > 0 && matchesAnyExclude(rel, opts.excludePatterns)) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
if (opts.omitSourceJs && opts.bundleOutputJs && rel.endsWith('.js')) {
|
|
35
|
+
const out = opts.bundleOutputJs.replace(/\\/g, '/');
|
|
36
|
+
if (rel !== out) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=package-exclude.js.map
|
|
@@ -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C;AAClE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAKhC;IACC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAEzC,IAAI,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,IAAI,iBAAiB,CAAC,GAAG,EAAE,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC;QACpF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,cAAc,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACpE,MAAM,GAAG,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QACpD,IAAI,GAAG,KAAK,GAAG,EAAE,CAAC;YAChB,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-exclude.test.d.ts","sourceRoot":"","sources":["../src/package-exclude.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { matchExcludePattern, shouldMirrorPath } from './package-exclude.js';
|
|
3
|
+
describe('package-exclude', () => {
|
|
4
|
+
it('matches ** globs', () => {
|
|
5
|
+
expect(matchExcludePattern('js/hello.entry.js', 'js/**')).toBe(true);
|
|
6
|
+
expect(matchExcludePattern('app/app.js', 'js/**')).toBe(false);
|
|
7
|
+
});
|
|
8
|
+
it('omits all .js except bundle output by default', () => {
|
|
9
|
+
const out = 'app/app.js';
|
|
10
|
+
expect(shouldMirrorPath({
|
|
11
|
+
rel: 'js/math.js',
|
|
12
|
+
bundleOutputJs: out,
|
|
13
|
+
omitSourceJs: true,
|
|
14
|
+
excludePatterns: [],
|
|
15
|
+
})).toBe(false);
|
|
16
|
+
expect(shouldMirrorPath({
|
|
17
|
+
rel: out,
|
|
18
|
+
bundleOutputJs: out,
|
|
19
|
+
omitSourceJs: true,
|
|
20
|
+
excludePatterns: [],
|
|
21
|
+
})).toBe(true);
|
|
22
|
+
expect(shouldMirrorPath({
|
|
23
|
+
rel: 'manifest.json',
|
|
24
|
+
bundleOutputJs: out,
|
|
25
|
+
omitSourceJs: true,
|
|
26
|
+
excludePatterns: [],
|
|
27
|
+
})).toBe(true);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=package-exclude.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-exclude.test.js","sourceRoot":"","sources":["../src/package-exclude.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7E,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAC1B,MAAM,CAAC,mBAAmB,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrE,MAAM,CAAC,mBAAmB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACvD,MAAM,GAAG,GAAG,YAAY,CAAC;QACzB,MAAM,CACJ,gBAAgB,CAAC;YACf,GAAG,EAAE,YAAY;YACjB,cAAc,EAAE,GAAG;YACnB,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,EAAE;SACpB,CAAC,CACH,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACd,MAAM,CACJ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