transone-cli 0.6.3 → 0.10.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.
Files changed (56) hide show
  1. package/README.md +20 -3
  2. package/README.zh-CN.md +31 -0
  3. package/dist/app/analyze.d.ts +2 -1
  4. package/dist/app/components.d.ts +4 -0
  5. package/dist/app/types.d.ts +3 -0
  6. package/dist/{build-mp-vk5ap2cw.js → build-mp-y5pwahsy.js} +824 -271
  7. package/dist/build-mp-y5pwahsy.js.map +24 -0
  8. package/dist/build.d.ts +3 -1
  9. package/dist/bundle-inputs.d.ts +6 -0
  10. package/dist/cli.d.ts +4 -2
  11. package/dist/cli.js +49 -16
  12. package/dist/cli.js.map +3 -3
  13. package/dist/components/discovery.d.ts +5 -0
  14. package/dist/components/index.d.ts +4 -0
  15. package/dist/components/report.d.ts +48 -0
  16. package/dist/components/resolution.d.ts +7 -0
  17. package/dist/components/types.d.ts +56 -0
  18. package/dist/components/web.d.ts +11 -0
  19. package/dist/config-inputs.d.ts +4 -0
  20. package/dist/create.d.ts +4 -4
  21. package/dist/document-styles.d.ts +7 -0
  22. package/dist/index-2g3e5sjt.js +3388 -0
  23. package/dist/index-2g3e5sjt.js.map +32 -0
  24. package/dist/index-d51tp4y9.js +1402 -0
  25. package/dist/index-d51tp4y9.js.map +11 -0
  26. package/dist/index-j4h0wd27.js +489 -0
  27. package/dist/index-j4h0wd27.js.map +14 -0
  28. package/dist/index-xgn9fbc6.js +298 -0
  29. package/dist/index-xgn9fbc6.js.map +13 -0
  30. package/dist/index.d.ts +5 -2
  31. package/dist/index.js +12 -4
  32. package/dist/index.js.map +2 -2
  33. package/dist/mp/inheritance.d.ts +17 -0
  34. package/dist/mp/inline.d.ts +22 -0
  35. package/dist/mp/methods.d.ts +1 -0
  36. package/dist/mp/source.d.ts +11 -0
  37. package/dist/mp/types.d.ts +8 -0
  38. package/dist/output-transaction.d.ts +19 -0
  39. package/dist/{project-ybacfze8.js → project-6tft5e77.js} +38 -6
  40. package/dist/{project-ybacfze8.js.map → project-6tft5e77.js.map} +3 -3
  41. package/dist/project.d.ts +2 -1
  42. package/dist/safe-path.d.ts +1 -0
  43. package/dist/scaffold.d.ts +6 -0
  44. package/dist/target/types.d.ts +7 -6
  45. package/dist/target/web-target.d.ts +1 -0
  46. package/dist/types.d.ts +13 -1
  47. package/dist/web-bundle.d.ts +17 -0
  48. package/dist/web-styles.d.ts +9 -0
  49. package/package.json +2 -2
  50. package/dist/build-mp-vk5ap2cw.js.map +0 -22
  51. package/dist/index-8k9x2k6m.js +0 -2288
  52. package/dist/index-8k9x2k6m.js.map +0 -27
  53. package/dist/index-k1qfvp0y.js +0 -19
  54. package/dist/index-k1qfvp0y.js.map +0 -10
  55. package/dist/index-yb2wsc7f.js +0 -7
  56. package/dist/index-yb2wsc7f.js.map +0 -9
package/dist/build.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { BuildOptions, BuildResult } from './types';
1
+ import type { BuildOptions, BuildResult, ResolvedConfig } from './types';
2
2
  /**
3
3
  * TransOne 构建入口:解析配置后按 Target 分发到对应编译目标。
4
4
  *
@@ -6,3 +6,5 @@ import type { BuildOptions, BuildResult } from './types';
6
6
  * (positioning 1:一份源码,多端原生产物,零运行时桥接)。
7
7
  */
8
8
  export declare function build(options?: BuildOptions): Promise<BuildResult>;
9
+ /** Use the same resolved configuration for inspection and output generation. */
10
+ export declare function buildConfigured(config: ResolvedConfig, options?: BuildOptions): Promise<BuildResult>;
@@ -0,0 +1,6 @@
1
+ import type { BunPlugin, BuildOutput } from 'bun';
2
+ /** Observe the real bundler graph, including JS, styles, assets and side effects. */
3
+ export declare function createBundleInputTracker(): {
4
+ plugin: BunPlugin;
5
+ paths(result: Pick<BuildOutput, "metafile">): string[];
6
+ };
package/dist/cli.d.ts CHANGED
@@ -1,9 +1,10 @@
1
- import type { TargetType } from './target/types';
1
+ import type { TargetInput } from './types';
2
2
  export interface CreateCliArgs {
3
3
  command: 'create';
4
4
  }
5
5
  export interface DevCliArgs {
6
6
  command: 'dev';
7
+ target?: TargetInput;
7
8
  host?: string;
8
9
  port?: number;
9
10
  base?: string;
@@ -11,10 +12,11 @@ export interface DevCliArgs {
11
12
  }
12
13
  export interface BuildCliArgs {
13
14
  command: 'build';
14
- target?: TargetType;
15
+ target?: TargetInput;
15
16
  outDir?: string;
16
17
  base?: string;
17
18
  library?: boolean;
19
+ reportComponents?: boolean;
18
20
  }
19
21
  export type CliArgs = CreateCliArgs | DevCliArgs | BuildCliArgs;
20
22
  export declare function parseCliArgs(argv: string[]): CliArgs;
package/dist/cli.js CHANGED
@@ -2,24 +2,37 @@
2
2
  import {
3
3
  TARGET_TYPES,
4
4
  build,
5
+ buildConfigured,
5
6
  createProject,
6
- isTargetType,
7
+ formatComponentSelectionReport,
8
+ reportConfiguredComponents,
9
+ resolveConfig,
7
10
  startDevServer
8
- } from "./index-8k9x2k6m.js";
9
- import"./index-k1qfvp0y.js";
10
- import"./index-yb2wsc7f.js";
11
+ } from "./index-2g3e5sjt.js";
12
+ import"./index-d51tp4y9.js";
13
+ import"./index-xgn9fbc6.js";
14
+ import {
15
+ PLATFORM_DEFINITIONS,
16
+ getPlatformDefinition,
17
+ normalizePlatform
18
+ } from "./index-j4h0wd27.js";
11
19
 
12
20
  // src/cli.ts
13
21
  var USAGE = [
14
22
  "Usage:",
15
23
  " transone create",
16
- " transone dev [--host <host>] [--port <port>] [--base <path>] [--no-watch]",
17
- " transone build [--target <target>] [--out-dir <path>] [--base <path>] [--library]",
24
+ " transone dev [--target <web|web-mobile|web-pc>] [--host <host>] [--port <port>] [--base <path>] [--no-watch]",
25
+ " transone build [--target <target>] [--out-dir <path>] [--base <path>] [--library] [--report-components]",
18
26
  "",
19
- `Targets: ${TARGET_TYPES.join(", ")} (default: web)`
27
+ `Targets: ${PLATFORM_DEFINITIONS.map((definition) => definition.platform).join(", ")} (default: web)`,
28
+ `Compatible backend aliases: ${TARGET_TYPES.filter((target) => target !== "web").join(", ")}`
20
29
  ].join(`
21
30
  `);
22
- var FLAG_OPTIONS = new Set(["--no-watch", "--library"]);
31
+ var FLAG_OPTIONS = new Set([
32
+ "--no-watch",
33
+ "--library",
34
+ "--report-components"
35
+ ]);
23
36
  function parseCliArgs(argv) {
24
37
  const command = argv[0];
25
38
  if (command !== "create" && command !== "dev" && command !== "build") {
@@ -38,6 +51,8 @@ function parseCliArgs(argv) {
38
51
  throw parseError(`Duplicate option: ${name}`);
39
52
  }
40
53
  if (FLAG_OPTIONS.has(name)) {
54
+ if (inlineValue !== undefined)
55
+ throw parseError(`Option ${name} does not accept a value`);
41
56
  options.set(name, "true");
42
57
  continue;
43
58
  }
@@ -55,20 +70,29 @@ function parseCliArgs(argv) {
55
70
  }
56
71
  if (command === "dev") {
57
72
  const port = options.get("--port");
73
+ const target = options.has("--target") ? parseTarget(options.get("--target")) : undefined;
74
+ if (target !== undefined && getPlatformDefinition(normalizePlatform(target)).family !== "web") {
75
+ throw parseError("Development server only supports Web targets: web, web-mobile, web-pc");
76
+ }
58
77
  return {
59
78
  command,
79
+ ...target === undefined ? {} : { target },
60
80
  ...options.has("--host") ? { host: options.get("--host") } : {},
61
81
  ...port === undefined ? {} : { port: parsePort(port) },
62
82
  ...options.has("--base") ? { base: options.get("--base") } : {},
63
83
  ...options.has("--no-watch") ? { noWatch: true } : {}
64
84
  };
65
85
  }
86
+ if (options.has("--library") && options.has("--report-components")) {
87
+ throw parseError("Option --report-components is not supported for library builds");
88
+ }
66
89
  return {
67
90
  command,
68
91
  ...options.has("--target") ? { target: parseTarget(options.get("--target")) } : {},
69
92
  ...options.has("--out-dir") ? { outDir: options.get("--out-dir") } : {},
70
93
  ...options.has("--base") ? { base: options.get("--base") } : {},
71
- ...options.has("--library") ? { library: true } : {}
94
+ ...options.has("--library") ? { library: true } : {},
95
+ ...options.has("--report-components") ? { reportComponents: true } : {}
72
96
  };
73
97
  }
74
98
  async function runCli(argv = process.argv.slice(2)) {
@@ -80,6 +104,7 @@ async function runCli(argv = process.argv.slice(2)) {
80
104
  }
81
105
  if (args.command === "dev") {
82
106
  const devOptions = {
107
+ ...args.target === undefined ? {} : { target: args.target },
83
108
  ...args.host === undefined ? {} : { host: args.host },
84
109
  ...args.port === undefined ? {} : { port: args.port },
85
110
  ...args.base === undefined ? {} : { base: args.base },
@@ -89,12 +114,20 @@ async function runCli(argv = process.argv.slice(2)) {
89
114
  console.log(`TransOne dev server listening at http://${server.hostname}:${server.port}`);
90
115
  return;
91
116
  }
92
- const result = await build(args.outDir === undefined && args.base === undefined && !args.library && args.target === undefined ? {} : {
117
+ const buildOptions = args.outDir === undefined && args.base === undefined && !args.library && args.target === undefined ? {} : {
93
118
  target: args.target,
94
119
  outDir: args.outDir,
95
120
  base: args.base,
96
121
  library: args.library
97
- });
122
+ };
123
+ let result;
124
+ if (args.reportComponents) {
125
+ const config = await resolveConfig(buildOptions);
126
+ console.log(formatComponentSelectionReport(reportConfiguredComponents(config)));
127
+ result = await buildConfigured(config, buildOptions);
128
+ } else {
129
+ result = await build(buildOptions);
130
+ }
98
131
  console.log(`TransOne build completed: ${result.outDir} (${result.assetsBuilt.length} assets)`);
99
132
  }
100
133
  function splitOption(token) {
@@ -108,21 +141,21 @@ function splitOption(token) {
108
141
  };
109
142
  }
110
143
  function assertKnownOption(name) {
111
- if (name === "--host" || name === "--port" || name === "--out-dir" || name === "--no-watch" || name === "--library" || name === "--base" || name === "--target") {
144
+ if (name === "--host" || name === "--port" || name === "--out-dir" || name === "--no-watch" || name === "--library" || name === "--report-components" || name === "--base" || name === "--target") {
112
145
  return;
113
146
  }
114
147
  throw parseError(`Unknown option: ${name}`);
115
148
  }
116
149
  function assertSupportedOption(command, name) {
117
- const supported = command === "create" && false || command === "dev" && (name === "--host" || name === "--port" || name === "--base" || name === "--no-watch") || command === "build" && (name === "--target" || name === "--out-dir" || name === "--base" || name === "--library");
150
+ const supported = command === "create" && false || command === "dev" && (name === "--host" || name === "--target" || name === "--port" || name === "--base" || name === "--no-watch") || command === "build" && (name === "--target" || name === "--out-dir" || name === "--base" || name === "--library" || name === "--report-components");
118
151
  if (!supported) {
119
152
  throw parseError(`Option ${name} is not supported for ${command}`);
120
153
  }
121
154
  }
122
155
  function parseTarget(value) {
123
- if (value === undefined || !isTargetType(value)) {
156
+ if (value === undefined || normalizePlatform(value) === undefined) {
124
157
  throw parseError(`Unknown target: ${value ?? ""}
125
- Available targets: ${TARGET_TYPES.join(", ")}`);
158
+ Available targets: ${PLATFORM_DEFINITIONS.map((definition) => definition.platform).join(", ")}`);
126
159
  }
127
160
  return value;
128
161
  }
@@ -146,5 +179,5 @@ export {
146
179
  runCli
147
180
  };
148
181
 
149
- //# debugId=AAC1608F58B0DF0964756E2164756E21
182
+ //# debugId=FF6E231C05920CCB64756E2164756E21
150
183
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/cli.ts"],
4
4
  "sourcesContent": [
5
- "import { build } from './build';\nimport { createProject } from './create';\nimport { startDevServer } from './server';\nimport { isTargetType, TARGET_TYPES } from './target/types';\nimport type { TargetType } from './target/types';\n\nconst USAGE = [\n 'Usage:',\n ' transone create',\n ' transone dev [--host <host>] [--port <port>] [--base <path>] [--no-watch]',\n ' transone build [--target <target>] [--out-dir <path>] [--base <path>] [--library]',\n '',\n `Targets: ${TARGET_TYPES.join(', ')} (default: web)`,\n].join('\\n');\n\nconst FLAG_OPTIONS = new Set(['--no-watch', '--library']);\n\nexport interface CreateCliArgs {\n command: 'create';\n}\n\nexport interface DevCliArgs {\n command: 'dev';\n host?: string;\n port?: number;\n base?: string;\n noWatch?: boolean;\n}\n\nexport interface BuildCliArgs {\n command: 'build';\n target?: TargetType;\n outDir?: string;\n base?: string;\n library?: boolean;\n}\n\nexport type CliArgs = CreateCliArgs | DevCliArgs | BuildCliArgs;\n\nexport function parseCliArgs(argv: string[]): CliArgs {\n const command = argv[0];\n if (command !== 'create' && command !== 'dev' && command !== 'build') {\n throw parseError(\n command === undefined ? 'Missing command' : `Unknown command: ${command}`\n );\n }\n\n const options = new Map<string, string>();\n for (let index = 1; index < argv.length; index += 1) {\n const token = argv[index];\n if (!token.startsWith('--')) {\n throw parseError(`Unexpected positional argument: ${token}`);\n }\n\n const { name, inlineValue } = splitOption(token);\n assertKnownOption(name);\n assertSupportedOption(command, name);\n if (options.has(name)) {\n throw parseError(`Duplicate option: ${name}`);\n }\n if (FLAG_OPTIONS.has(name)) {\n options.set(name, 'true');\n continue;\n }\n\n const value = inlineValue ?? argv[index + 1];\n if (value === undefined || value === '' || value.startsWith('--')) {\n throw parseError(`Missing value for option: ${name}`);\n }\n if (inlineValue === undefined) {\n index += 1;\n }\n options.set(name, value);\n }\n\n if (command === 'create') {\n return { command };\n }\n\n if (command === 'dev') {\n const port = options.get('--port');\n return {\n command,\n ...(options.has('--host') ? { host: options.get('--host') } : {}),\n ...(port === undefined ? {} : { port: parsePort(port) }),\n ...(options.has('--base') ? { base: options.get('--base') } : {}),\n ...(options.has('--no-watch') ? { noWatch: true } : {}),\n };\n }\n\n return {\n command,\n ...(options.has('--target')\n ? { target: parseTarget(options.get('--target')) }\n : {}),\n ...(options.has('--out-dir') ? { outDir: options.get('--out-dir') } : {}),\n ...(options.has('--base') ? { base: options.get('--base') } : {}),\n ...(options.has('--library') ? { library: true } : {}),\n };\n}\n\nexport async function runCli(\n argv: string[] = process.argv.slice(2)\n): Promise<void> {\n const args = parseCliArgs(argv);\n\n if (args.command === 'create') {\n const result = createProject();\n console.log(\n `TransOne project created at ${result.root} (${result.files.length} files)`\n );\n return;\n }\n\n if (args.command === 'dev') {\n const devOptions = {\n ...(args.host === undefined ? {} : { host: args.host }),\n ...(args.port === undefined ? {} : { port: args.port }),\n ...(args.base === undefined ? {} : { base: args.base }),\n watch: !args.noWatch,\n };\n const server = await startDevServer(devOptions);\n console.log(\n `TransOne dev server listening at http://${server.hostname}:${server.port}`\n );\n return;\n }\n\n const result = await build(\n args.outDir === undefined &&\n args.base === undefined &&\n !args.library &&\n args.target === undefined\n ? {}\n : {\n target: args.target,\n outDir: args.outDir,\n base: args.base,\n library: args.library,\n }\n );\n console.log(\n `TransOne build completed: ${result.outDir} (${result.assetsBuilt.length} assets)`\n );\n}\n\nfunction splitOption(token: string): { name: string; inlineValue?: string } {\n const equalsIndex = token.indexOf('=');\n if (equalsIndex === -1) {\n return { name: token };\n }\n\n return {\n name: token.slice(0, equalsIndex),\n inlineValue: token.slice(equalsIndex + 1),\n };\n}\n\nfunction assertKnownOption(name: string): void {\n if (\n name === '--host' ||\n name === '--port' ||\n name === '--out-dir' ||\n name === '--no-watch' ||\n name === '--library' ||\n name === '--base' ||\n name === '--target'\n ) {\n return;\n }\n\n throw parseError(`Unknown option: ${name}`);\n}\n\nfunction assertSupportedOption(\n command: CliArgs['command'],\n name: string\n): void {\n const supported =\n (command === 'create' && false) ||\n (command === 'dev' &&\n (name === '--host' ||\n name === '--port' ||\n name === '--base' ||\n name === '--no-watch')) ||\n (command === 'build' &&\n (name === '--target' ||\n name === '--out-dir' ||\n name === '--base' ||\n name === '--library'));\n\n if (!supported) {\n throw parseError(`Option ${name} is not supported for ${command}`);\n }\n}\n\nfunction parseTarget(value: string | undefined): TargetType {\n if (value === undefined || !isTargetType(value)) {\n throw parseError(\n `Unknown target: ${value ?? ''}\\nAvailable targets: ${TARGET_TYPES.join(\n ', '\n )}`\n );\n }\n return value;\n}\n\nfunction parsePort(value: string): number {\n if (!/^\\d+$/.test(value)) {\n throw parseError('Port must be an integer between 0 and 65535');\n }\n\n const port = Number(value);\n if (!Number.isInteger(port) || port < 0 || port > 65535) {\n throw parseError('Port must be an integer between 0 and 65535');\n }\n\n return port;\n}\n\nfunction parseError(message: string): Error {\n return new Error(`${message}\\n\\n${USAGE}`);\n}\n"
5
+ "import { build, buildConfigured } from './build';\nimport {\n reportConfiguredComponents,\n formatComponentSelectionReport,\n} from './components/report';\nimport { resolveConfig } from './config';\nimport { createProject } from './create';\nimport { startDevServer } from './server';\nimport {\n getPlatformDefinition,\n normalizePlatform,\n PLATFORM_DEFINITIONS,\n} from 'transone/platform';\nimport { TARGET_TYPES } from './target/types';\nimport type { BuildOptions, BuildResult, TargetInput } from './types';\n\nconst USAGE = [\n 'Usage:',\n ' transone create',\n ' transone dev [--target <web|web-mobile|web-pc>] [--host <host>] [--port <port>] [--base <path>] [--no-watch]',\n ' transone build [--target <target>] [--out-dir <path>] [--base <path>] [--library] [--report-components]',\n '',\n `Targets: ${PLATFORM_DEFINITIONS.map((definition) => definition.platform).join(', ')} (default: web)`,\n `Compatible backend aliases: ${TARGET_TYPES.filter((target) => target !== 'web').join(', ')}`,\n].join('\\n');\n\nconst FLAG_OPTIONS = new Set([\n '--no-watch',\n '--library',\n '--report-components',\n]);\n\nexport interface CreateCliArgs {\n command: 'create';\n}\n\nexport interface DevCliArgs {\n command: 'dev';\n target?: TargetInput;\n host?: string;\n port?: number;\n base?: string;\n noWatch?: boolean;\n}\n\nexport interface BuildCliArgs {\n command: 'build';\n target?: TargetInput;\n outDir?: string;\n base?: string;\n library?: boolean;\n reportComponents?: boolean;\n}\n\nexport type CliArgs = CreateCliArgs | DevCliArgs | BuildCliArgs;\n\nexport function parseCliArgs(argv: string[]): CliArgs {\n const command = argv[0];\n if (command !== 'create' && command !== 'dev' && command !== 'build') {\n throw parseError(\n command === undefined ? 'Missing command' : `Unknown command: ${command}`\n );\n }\n\n const options = new Map<string, string>();\n for (let index = 1; index < argv.length; index += 1) {\n const token = argv[index];\n if (!token.startsWith('--')) {\n throw parseError(`Unexpected positional argument: ${token}`);\n }\n\n const { name, inlineValue } = splitOption(token);\n assertKnownOption(name);\n assertSupportedOption(command, name);\n if (options.has(name)) {\n throw parseError(`Duplicate option: ${name}`);\n }\n if (FLAG_OPTIONS.has(name)) {\n if (inlineValue !== undefined)\n throw parseError(`Option ${name} does not accept a value`);\n options.set(name, 'true');\n continue;\n }\n\n const value = inlineValue ?? argv[index + 1];\n if (value === undefined || value === '' || value.startsWith('--')) {\n throw parseError(`Missing value for option: ${name}`);\n }\n if (inlineValue === undefined) {\n index += 1;\n }\n options.set(name, value);\n }\n\n if (command === 'create') {\n return { command };\n }\n\n if (command === 'dev') {\n const port = options.get('--port');\n const target = options.has('--target')\n ? parseTarget(options.get('--target'))\n : undefined;\n if (\n target !== undefined &&\n getPlatformDefinition(normalizePlatform(target)!).family !== 'web'\n ) {\n throw parseError(\n 'Development server only supports Web targets: web, web-mobile, web-pc'\n );\n }\n return {\n command,\n ...(target === undefined ? {} : { target }),\n ...(options.has('--host') ? { host: options.get('--host') } : {}),\n ...(port === undefined ? {} : { port: parsePort(port) }),\n ...(options.has('--base') ? { base: options.get('--base') } : {}),\n ...(options.has('--no-watch') ? { noWatch: true } : {}),\n };\n }\n\n if (options.has('--library') && options.has('--report-components')) {\n throw parseError(\n 'Option --report-components is not supported for library builds'\n );\n }\n\n return {\n command,\n ...(options.has('--target')\n ? { target: parseTarget(options.get('--target')) }\n : {}),\n ...(options.has('--out-dir') ? { outDir: options.get('--out-dir') } : {}),\n ...(options.has('--base') ? { base: options.get('--base') } : {}),\n ...(options.has('--library') ? { library: true } : {}),\n ...(options.has('--report-components') ? { reportComponents: true } : {}),\n };\n}\n\nexport async function runCli(\n argv: string[] = process.argv.slice(2)\n): Promise<void> {\n const args = parseCliArgs(argv);\n\n if (args.command === 'create') {\n const result = createProject();\n console.log(\n `TransOne project created at ${result.root} (${result.files.length} files)`\n );\n return;\n }\n\n if (args.command === 'dev') {\n const devOptions = {\n ...(args.target === undefined ? {} : { target: args.target }),\n ...(args.host === undefined ? {} : { host: args.host }),\n ...(args.port === undefined ? {} : { port: args.port }),\n ...(args.base === undefined ? {} : { base: args.base }),\n watch: !args.noWatch,\n };\n const server = await startDevServer(devOptions);\n console.log(\n `TransOne dev server listening at http://${server.hostname}:${server.port}`\n );\n return;\n }\n\n const buildOptions: BuildOptions =\n args.outDir === undefined &&\n args.base === undefined &&\n !args.library &&\n args.target === undefined\n ? {}\n : {\n target: args.target,\n outDir: args.outDir,\n base: args.base,\n library: args.library,\n };\n let result: BuildResult;\n if (args.reportComponents) {\n const config = await resolveConfig(buildOptions);\n console.log(\n formatComponentSelectionReport(reportConfiguredComponents(config))\n );\n result = await buildConfigured(config, buildOptions);\n } else {\n result = await build(buildOptions);\n }\n console.log(\n `TransOne build completed: ${result.outDir} (${result.assetsBuilt.length} assets)`\n );\n}\n\nfunction splitOption(token: string): { name: string; inlineValue?: string } {\n const equalsIndex = token.indexOf('=');\n if (equalsIndex === -1) {\n return { name: token };\n }\n\n return {\n name: token.slice(0, equalsIndex),\n inlineValue: token.slice(equalsIndex + 1),\n };\n}\n\nfunction assertKnownOption(name: string): void {\n if (\n name === '--host' ||\n name === '--port' ||\n name === '--out-dir' ||\n name === '--no-watch' ||\n name === '--library' ||\n name === '--report-components' ||\n name === '--base' ||\n name === '--target'\n ) {\n return;\n }\n\n throw parseError(`Unknown option: ${name}`);\n}\n\nfunction assertSupportedOption(\n command: CliArgs['command'],\n name: string\n): void {\n const supported =\n (command === 'create' && false) ||\n (command === 'dev' &&\n (name === '--host' ||\n name === '--target' ||\n name === '--port' ||\n name === '--base' ||\n name === '--no-watch')) ||\n (command === 'build' &&\n (name === '--target' ||\n name === '--out-dir' ||\n name === '--base' ||\n name === '--library' ||\n name === '--report-components'));\n\n if (!supported) {\n throw parseError(`Option ${name} is not supported for ${command}`);\n }\n}\n\nfunction parseTarget(value: string | undefined): TargetInput {\n if (value === undefined || normalizePlatform(value) === undefined) {\n throw parseError(\n `Unknown target: ${value ?? ''}\\nAvailable targets: ${PLATFORM_DEFINITIONS.map((definition) => definition.platform).join(', ')}`\n );\n }\n return value as TargetInput;\n}\n\nfunction parsePort(value: string): number {\n if (!/^\\d+$/.test(value)) {\n throw parseError('Port must be an integer between 0 and 65535');\n }\n\n const port = Number(value);\n if (!Number.isInteger(port) || port < 0 || port > 65535) {\n throw parseError('Port must be an integer between 0 and 65535');\n }\n\n return port;\n}\n\nfunction parseError(message: string): Error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EAEA,OAAO;AAAA;AAGT,SAAS,UAAU,CAAC,SAAwB;AAAA,EAC1C,OAAO,IAAI,MAAM,GAAG;AAAA;AAAA,EAAc,OAAO;AAAA;",
8
+ "debugId": "FF6E231C05920CCB64756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -0,0 +1,5 @@
1
+ import ts from 'typescript';
2
+ import type { ComponentIndexOptions } from './types';
3
+ export declare function canonicalPath(path: string): string;
4
+ /** Discovery only reads source. Imported files are loaded by TypeScript, never executed. */
5
+ export declare function createComponentProgram(options: ComponentIndexOptions): ts.Program;
@@ -0,0 +1,4 @@
1
+ import type { ComponentIndex, ComponentIndexOptions } from './types';
2
+ export type * from './types';
3
+ /** A fresh checker, selection table and source ownership graph for each build. */
4
+ export declare function createComponentIndex(options: ComponentIndexOptions): ComponentIndex;
@@ -0,0 +1,48 @@
1
+ import { type ComponentPlatform, type Platform } from 'transone/platform';
2
+ import type { ResolveConfigOptions, ResolvedConfig } from '../types';
3
+ import type { ComponentSelectionReason } from './types';
4
+ /** JSON-safe source identity. Paths are relative to the project root. */
5
+ export interface ComponentReportLocation {
6
+ source: string;
7
+ className: string;
8
+ /** One-based declaration start, including decorators where present. */
9
+ line: number;
10
+ column: number;
11
+ }
12
+ export interface ComponentReportCandidate extends ComponentReportLocation {
13
+ platforms: readonly ComponentPlatform[];
14
+ }
15
+ export interface ComponentSelectionReportRow {
16
+ /**
17
+ * Relative entrypoints sharing this selection index. Web pages have independent
18
+ * indexes, so one logical component can have a separate row for each page.
19
+ */
20
+ entrypoints: readonly string[];
21
+ component: ComponentReportLocation;
22
+ /** Null means an abstract logical component has no matching implementation. */
23
+ implementation: ComponentReportLocation | null;
24
+ reason: Exclude<ComponentSelectionReason, 'explicit'>;
25
+ candidates: readonly ComponentReportCandidate[];
26
+ }
27
+ /**
28
+ * Static discovered logical-component mappings, including unused components.
29
+ * These rows do not establish runtime constructor usage or application reachability.
30
+ * Explicit implementation references retain their own identities and are not rows.
31
+ * Web mappings are scoped to each page entry; MiniProgram and App mappings retain
32
+ * the configured shared page entrypoints.
33
+ */
34
+ export interface ComponentSelectionReport {
35
+ platform: Platform;
36
+ scope: 'discovered-logical-components';
37
+ components: readonly ComponentSelectionReportRow[];
38
+ }
39
+ /**
40
+ * Resolve normal project configuration and inspect sources with the build matcher.
41
+ * The project config is loaded as usual; component modules are read by TypeScript,
42
+ * never imported or evaluated by this API. No build output is written.
43
+ */
44
+ export declare function reportComponents(options?: ResolveConfigOptions): Promise<ComponentSelectionReport>;
45
+ /** Inspect an already resolved application config without loading it again. */
46
+ export declare function reportConfiguredComponents(config: ResolvedConfig): ComponentSelectionReport;
47
+ /** Human-readable rendering of the same structured, static mapping report. */
48
+ export declare function formatComponentSelectionReport(report: ComponentSelectionReport): string;
@@ -0,0 +1,7 @@
1
+ import ts from 'typescript';
2
+ export declare function unalias(checker: ts.TypeChecker, symbol: ts.Symbol | undefined): ts.Symbol | undefined;
3
+ /** Map a parser-owned node back into the Program without losing its source scope. */
4
+ export declare function sourceNode(node: ts.Node, source: ts.SourceFile): ts.Node | undefined;
5
+ export declare function classDeclaration(symbol: ts.Symbol | undefined): ts.ClassLikeDeclaration | undefined;
6
+ /** Find actual framework modules independently of consumer import spelling. */
7
+ export declare function frameworkSourceFiles(program: ts.Program, root: string): readonly ts.SourceFile[];
@@ -0,0 +1,56 @@
1
+ import type ts from 'typescript';
2
+ import type { ComponentPlatform, Platform } from 'transone/platform';
3
+ export interface ClassReference {
4
+ id: string;
5
+ filePath: string;
6
+ source: ts.SourceFile;
7
+ declaration: ts.ClassLikeDeclaration;
8
+ className: string;
9
+ exportName?: string;
10
+ }
11
+ export interface OwnedMember {
12
+ owner: ClassReference;
13
+ declaration: ts.ClassElement;
14
+ }
15
+ export interface ComponentMetadata {
16
+ /** Declared by the framework package rather than a business component module. */
17
+ framework: boolean;
18
+ parent?: ClassReference;
19
+ family: ClassReference;
20
+ platforms: readonly ComponentPlatform[];
21
+ abstract: boolean;
22
+ }
23
+ export type ComponentSelectionReason = 'exact' | 'family' | 'base' | 'missing' | 'explicit';
24
+ /** The shared matcher's static decision; missing abstract bases are inspectable. */
25
+ export interface ComponentSelectionDecision {
26
+ component: ClassReference;
27
+ implementation?: ClassReference;
28
+ reason: ComponentSelectionReason;
29
+ candidates: readonly ClassReference[];
30
+ }
31
+ export interface ComponentIndex {
32
+ readonly platform: Platform;
33
+ readonly classes: readonly ClassReference[];
34
+ readonly sources: readonly ts.SourceFile[];
35
+ resolve(expression: ts.Expression, source: ts.SourceFile): ClassReference | undefined;
36
+ findClass(filePath: string, className: string): ClassReference | undefined;
37
+ isComponent(reference: ClassReference): boolean;
38
+ select(reference: ClassReference): ClassReference;
39
+ /** Does not reject a missing abstract implementation; conflicts still throw. */
40
+ decision(reference: ClassReference): ComponentSelectionDecision;
41
+ hierarchy(reference: ClassReference): readonly ClassReference[];
42
+ members(reference: ClassReference): readonly OwnedMember[];
43
+ bindings(): readonly {
44
+ base: ClassReference;
45
+ implementation: ClassReference;
46
+ }[];
47
+ metadata(reference: ClassReference): ComponentMetadata;
48
+ symbolAt(node: ts.Node, source?: ts.SourceFile): ts.Symbol | undefined;
49
+ }
50
+ export interface ComponentIndexOptions {
51
+ root: string;
52
+ entrypoints: readonly string[];
53
+ platform: Platform;
54
+ include?: readonly string[];
55
+ exclude?: readonly string[];
56
+ }
@@ -0,0 +1,11 @@
1
+ import type { BunPlugin } from 'bun';
2
+ import type { ResolvedConfig } from '../types';
3
+ /** One immutable selection shared by the browser and document bundles. No user code executes here. */
4
+ export declare function createWebComponentContext(config: ResolvedConfig, entry: string): {
5
+ active: boolean;
6
+ sourcePaths: string[];
7
+ entrypoint: string;
8
+ plugin: BunPlugin;
9
+ transform: (_path: string, contents: string, _definitions?: boolean) => string;
10
+ };
11
+ export type WebComponentContext = ReturnType<typeof createWebComponentContext>;
@@ -0,0 +1,4 @@
1
+ /** Read config inheritance/references without enumerating sources or making a checker. */
2
+ export declare function typeScriptConfigInputs(root: string, sources: readonly string[], explicitConfigs?: readonly string[]): string[];
3
+ /** Statically declared config modules are inputs too; never import/re-execute them. */
4
+ export declare function transoneConfigInputs(configFile: string | undefined): string[];
package/dist/create.d.ts CHANGED
@@ -8,9 +8,9 @@ export interface CreateProjectResult {
8
8
  root: string;
9
9
  files: string[];
10
10
  }
11
- /** Published framework version referenced by generated projects. */
12
- export declare const TRANSONE_FRAMEWORK_VERSION = "0.4.0";
13
- /** Published CLI version referenced by generated projects. */
14
- export declare const TRANSONE_CLI_VERSION = "0.6.3";
11
+ /** Framework version required by the generated component-family example. */
12
+ export declare const TRANSONE_FRAMEWORK_VERSION = "0.9.0";
13
+ /** CLI version required by generated platform scripts. */
14
+ export declare const TRANSONE_CLI_VERSION = "0.10.0";
15
15
  export declare const GITHUB_URL = "https://github.com/geektech-team/transone";
16
16
  export declare function createProject(options?: CreateProjectOptions): CreateProjectResult;
@@ -0,0 +1,7 @@
1
+ export interface DocumentStylesResult {
2
+ html: string;
3
+ assets: string[];
4
+ }
5
+ /** Externalize the document shell's CSS without changing stylesheet order. */
6
+ export declare function emitDocumentStyles(html: string, outDir: string, assetUrl: (path: string) => string, stylesheets: string[], componentStylesheets?: string[]): Promise<DocumentStylesResult>;
7
+ export declare function emitComponentStyles(styles: ReadonlyMap<string, string>, outDir: string): Promise<string[]>;