ttmg-pack 0.2.5 → 0.2.7-requirePlugin.6

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.
@@ -1,2 +1,3 @@
1
1
  import { BuildConfig } from '../../typings';
2
2
  export declare function buildPkgs(originConfig: BuildConfig): Promise<void>;
3
+ export declare function buildPlugin(originConfig: BuildConfig): Promise<void>;
@@ -0,0 +1,2 @@
1
+ import { BuildConfig } from '../../typings';
2
+ export declare function buildPlugins(config: BuildConfig): Promise<void>;
@@ -0,0 +1 @@
1
+ export declare function addDepsToPackages(gameEntry: string, outputDir: string, allDeps: Record<string, string[]>): Promise<void>;
@@ -1 +1,4 @@
1
- export declare function collectDeps(gameEntry: any, packages: any): any;
1
+ export declare function collectDeps(gameEntry: any, packages: any): {
2
+ packageDeps: Record<string, Record<string, string>>;
3
+ pluginDeps: Record<string, string[]>;
4
+ };
@@ -2,3 +2,4 @@ export declare function flattenMaps(allMaps: any): any[];
2
2
  export declare function collectMaps(entryDir: any, packages: Record<string, {
3
3
  root: string;
4
4
  }>): {};
5
+ export declare function collectPluginMaps(gameDir: any, entryDir: any, name: string): {};
@@ -4,3 +4,8 @@ export declare function makePkgs({ gameEntry, gameOutput, config, }: {
4
4
  gameOutput: string;
5
5
  config: BuildConfig;
6
6
  }): Promise<{}>;
7
+ export declare function makePlugin({ gameEntry, gameOutput, config, }: {
8
+ gameEntry: string;
9
+ gameOutput: string;
10
+ config: BuildConfig;
11
+ }): Promise<void>;
@@ -2,7 +2,7 @@ import { BuildConfig } from '../../typings';
2
2
  export declare function pack({ gameEntry, pkgName, allDeps, allMaps, pkgConfig, destRoot, config, }: {
3
3
  gameEntry: string;
4
4
  pkgName: string;
5
- allDeps: Record<string, string[]>;
5
+ allDeps: any;
6
6
  allMaps: Record<string, Record<string, string[]>>;
7
7
  pkgConfig: {
8
8
  main: string;
@@ -27,6 +27,7 @@ export interface BuildConfig {
27
27
  inlineSourcemap?: boolean;
28
28
  };
29
29
  build: {
30
+ type?: 'game' | 'plugin';
30
31
  pkgSizeLimit: number;
31
32
  mainPkgSizeLimit: number;
32
33
  subPkgSizeLimit?: number;
@@ -0,0 +1 @@
1
+ export declare function copyDirectory(src: any, dest: any): void;
@@ -22,3 +22,4 @@ export { overrideConfig } from './overrideConfig';
22
22
  export { buildOpenDataContext, getOpenDataContextEntry, } from './openDataContext';
23
23
  export { safeBuild } from './safeBuild';
24
24
  export { assertSyntax } from './assertSyntax';
25
+ export { copyDirectory } from './cpDir';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ttmg-pack",
3
3
  "author": "ttmg",
4
- "version": "0.2.5",
4
+ "version": "0.2.7-requirePlugin.6",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {
@@ -9,7 +9,8 @@
9
9
  "prepublishOnly": "npm run build",
10
10
  "watch": "rollup -c --watch",
11
11
  "test": "npm run build && node __TEST__/index.js",
12
- "debug": "npm run build && node __TEST__/debug.js"
12
+ "debug": "npm run build && node __TEST__/debug.js",
13
+ "testPlugin": "npm run build && node __TEST__/testPlugin.js"
13
14
  },
14
15
  "files": [
15
16
  "dist"
package/CHANGELOG.md DELETED
@@ -1,300 +0,0 @@
1
- ## 0.0.1
2
-
3
- 发布第一个版本,将分包逻辑单独维护
4
-
5
- ## 0.0.3
6
-
7
- - 增加类型导出
8
- - 修改入参格式
9
-
10
- ## 0.0.4
11
-
12
- - 支持自定义输出 log
13
- - 打包产物支持 banner 注释
14
-
15
- ## 0.0.5
16
-
17
- - 调整包大小校验限制,主包 30MB,子包 4MB
18
-
19
- ## 0.0.6
20
-
21
- 优化入口接口
22
-
23
- ```
24
- export interface BuildConfig {
25
- entry: string;
26
- output: string;
27
- rules?: {
28
- mainPackageSizeLimit: number;
29
- projectSizeLimit: number;
30
- subpackageSizeLimit?: number;
31
- };
32
- enableDev?: boolean;
33
- enableCheck?: boolean;
34
- enableLog?: boolean;
35
- }
36
-
37
- ```
38
-
39
- ## 0.0.7
40
-
41
- 支持类型文件导出
42
-
43
- ## 0.0.8
44
-
45
- ODR 相关功能
46
-
47
- - 支持 ODR 打包
48
- - 支持 ODR 下载
49
- - 支持 ODR 配置写入
50
-
51
- ## 0.0.9
52
-
53
- 拆分 debug 功能 和 build 功能
54
-
55
- ## 0.0.10
56
-
57
- fix buildPkgs 日志输出问题
58
-
59
- ## 0.0.11
60
-
61
- 移除 console.log 日志
62
-
63
- ## 0.0.12
64
-
65
- 支持校验 project.config.json,appid 不能为空,开发调试环节强依赖
66
-
67
- ## 0.0.13
68
-
69
- 移除无效 log
70
-
71
- ## 0.0.14
72
-
73
- 导出 packageConfig.json,调试环节使用
74
-
75
- ## 0.0.15
76
-
77
- fix: 修复 生成 projectConfig.json
78
-
79
- ## 0.0.16
80
-
81
- 调试模式不做大小校验,只做警告
82
-
83
- ## 0.0.17
84
-
85
- 支持 sourcemap
86
-
87
- ## 0.0.18
88
-
89
- 支持 sourcemap 配置
90
-
91
- ## 0.0.19
92
-
93
- 支持自定义 sourcemap 文件名
94
-
95
- ## 0.0.20
96
-
97
- 1. 支持多种 sourcemap 输出方案
98
- 2. 优化打包配置接口
99
-
100
- ## 0.0.21
101
-
102
- 1. 优化生产 sourcemap 生成逻辑
103
-
104
- ## 0.0.22
105
-
106
- 修复 sourcemap
107
-
108
- ## 0.0.23
109
-
110
- 优化 pack 逻辑,降低耗时
111
-
112
- ## 0.0.24
113
-
114
- 优化 buildPkgs 逻辑
115
-
116
- ## 0.0.25
117
-
118
- fix: odr 下载逻辑,Array buffer 读写
119
-
120
- ## 0.0.26
121
-
122
- 1. fix: source map 写入 bug
123
- 2. 支持 esmodule 打包
124
-
125
- ## 0.0.27
126
-
127
- 1. 修复循环依赖问题
128
-
129
- ## 0.0.28
130
-
131
- 回滚 支持 esmodule 打包,止损加密后解密失败的问题
132
-
133
- ## 0.0.29
134
-
135
- 支持 es module 打包
136
-
137
- ## 0.0.30
138
-
139
- 修改类型定义文件
140
-
141
- ## 0.0.31
142
-
143
- 1. 修复 打包逻辑,移除 subpackages 逻辑,基于 root 进行分包拆解
144
- 2. 修复 debugPkgs 逻辑,合并代码出问题,导致 wasmcode 代码丢失
145
-
146
- ## 0.0.32
147
-
148
- 1. 移除日志
149
- 2. 移除 subpackages 常量
150
-
151
- ## 0.0.33
152
-
153
- 修复打包 BUG
154
-
155
- ## 0.0.34
156
-
157
- 1. pack remove file not work
158
- 2. merge remove file not work
159
-
160
- ## 0.0.35
161
-
162
- fix main path error
163
-
164
- ## 0.0.36
165
-
166
- remove useless log
167
-
168
- ## 0.0.37
169
-
170
- 支持调试模式校验日志导出
171
-
172
- ## 0.0.38
173
-
174
- 导出 checkPkgs 函数
175
-
176
- ## 0.0.39
177
-
178
- 1. 导出 getPkgs 函数
179
- 2. 修复校验主包大小 BUG
180
-
181
- ## 0.0.40
182
-
183
- 1. 导出 GAME_MAIN_PACKAGE_NAME 常量
184
- 2. 修复校验主包大小 BUG
185
-
186
- ## 0.0.41/42
187
-
188
- 优化校验逻辑提示文案
189
-
190
- ## 0.0.43
191
-
192
- 调整 log 结构
193
-
194
- ## 0.0.44
195
-
196
- 移除日志空格
197
-
198
- ## 0.0.45
199
-
200
- 优化打包类型
201
-
202
- ## 0.0.46
203
-
204
- 包大小限制提示大小显示问题优化,避免 0MB 展示效果
205
-
206
- ## 0.0.47
207
-
208
- 修复校验主包大小 BUG
209
-
210
- ## 0.0.48
211
-
212
- 优化校验逻辑提示文案
213
-
214
- ## 0.0.49
215
-
216
- 优化校验逻辑提示文案
217
-
218
- ## 0.0.50
219
-
220
- 优化校验逻辑提示文案,移除废弃 log
221
-
222
- ## 0.0.51
223
-
224
- 支持 fyf packages 导出
225
-
226
- ## 0.0.52
227
-
228
- 支持必接 API 预检查,校验必接 API 是否被调用,但是否生效不在检查范畴内
229
-
230
- ## 0.0.53
231
-
232
- 移除非必要日志
233
-
234
- ## 0.0.54
235
-
236
- 修复 require 路径解析问题
237
-
238
- ## 0.0.55
239
-
240
- 支持 unity 游戏引擎,对于 unity 游戏引擎的游戏,不限制主包和独立分包大小
241
-
242
- ## 0.0.56
243
-
244
- 补充必接 API 校验范围
245
-
246
- ## 0.1.0
247
-
248
- 发布 0.1.0 版本,更新后续平台升级
249
-
250
- ## 0.1.1
251
-
252
- 移除 project.config.json 校验
253
-
254
- ## 0.1.2-0.1.5
255
-
256
- 开发 unity 相关
257
-
258
- ## 0.1.6
259
-
260
- 修复 esbuild 构建编码问题,导致部分 JS 语法不符合预期
261
-
262
- ## 0.1.7
263
-
264
- 调整 esbuild 构建目标为 esnext,避免部分语法不符合预期
265
-
266
- ## 0.1.8
267
-
268
- 调整 esbuild 构建目标为 es2015,避免部分语法不符合预期
269
-
270
- ## 0.1.9
271
-
272
- 支持开放数据域
273
-
274
- ## 0.2.0
275
-
276
- fix: 修复 esbuild 构建编码问题
277
-
278
- ## 0.2.0-beta.1
279
-
280
- 切换成 esbuild 更稳定的 build
281
-
282
- ## 0.2.1
283
-
284
- 完善编译, 修复 open data context 编译问题
285
-
286
- ## 0.2.2
287
-
288
- 补充对 分包名称名称为中文类型字符的校验支持,避免打包失败
289
-
290
- ## 0.2.3
291
-
292
- esbuild 构建目标调整为 es2020,避免部分语法不符合预期,和安卓 vmsdk 支持最低版本保持一致
293
-
294
- ## 0.2.4
295
-
296
- 修复 open data context 编译问题
297
-
298
- ## 0.2.5
299
-
300
- 修复 open data context 编译问题
@@ -1 +0,0 @@
1
- export declare function checkPkgPath(path: string): boolean;
@@ -1 +0,0 @@
1
- export declare function hasAnyNodeModulesShallow(root: string): boolean;
@@ -1,6 +0,0 @@
1
- export declare function extractPkgs(params: {
2
- entryDir: string;
3
- outputDir: string;
4
- }): Promise<{
5
- extractOutputDir: string;
6
- }>;
@@ -1,39 +0,0 @@
1
- export declare class NodeModuleExtractor {
2
- srcDir: string;
3
- distDir: string;
4
- miniprogramNpmDir: string;
5
- addedFiles: Set<string>;
6
- pendingTransforms: Array<{
7
- srcRelativePath: string;
8
- distRelativePath: string;
9
- isNodeModuleFile: boolean;
10
- }>;
11
- sourceMaps: Map<string, any>;
12
- enableReport: boolean;
13
- constructor(srcDir: any, distDir: any);
14
- customRequireHook(modulePath: any, relativePath: any): Promise<boolean>;
15
- findInNodeModules(moduleName: any, relativePath: any): string;
16
- transformModulePath(originalPath: any): any;
17
- transformRequirePath(moduleName: any, srcRelativePath: any, srcModuleRelativePath: any, distModuleRelativePath: any): string;
18
- isCodeFile(filePath: any): boolean;
19
- ensureDirForFile(filePath: any): void;
20
- processCodeFile(srcRelativePath: any, distRelativePath: any, isNodeModuleFile: any): Promise<void>;
21
- copyNonCodeFile(srcRelativePath: any, distRelativePath: any): void;
22
- collectFiles(rootDir: any, relativeDir?: any): void;
23
- addTransform(srcRelativePath: any, distRelativePath: any, isNodeModuleFile: any): void;
24
- processTransforms(): Promise<void>;
25
- generateReport(): {
26
- srcDir: string;
27
- distDir: string;
28
- processedFiles: string[];
29
- sourceMaps: [string, any][];
30
- totalFiles: number;
31
- totalSourceMaps: number;
32
- timestamp: string;
33
- };
34
- extract(): Promise<void>;
35
- }
36
- export declare function extract(params: {
37
- srcDir: string;
38
- distDir: string;
39
- }): Promise<void>;
@@ -1 +0,0 @@
1
- export declare function hasAnyNodeModulesShallow(root: string): boolean;
@@ -1,6 +0,0 @@
1
- export declare function extract(params: {
2
- entryDir: string;
3
- outputDir: string;
4
- }): Promise<{
5
- extractOutputDir: string;
6
- }>;
@@ -1,4 +0,0 @@
1
- export declare function extract(params: {
2
- srcDir: string;
3
- distDir: string;
4
- }): Promise<void>;
@@ -1,38 +0,0 @@
1
- export declare class NodeModuleExtractor {
2
- srcDir: string;
3
- distDir: string;
4
- miniprogramNpmDir: string;
5
- addedFiles: Set<string>;
6
- pendingTransforms: Array<{
7
- srcRelativePath: string;
8
- distRelativePath: string;
9
- isNodeModuleFile: boolean;
10
- }>;
11
- sourceMaps: Map<string, any>;
12
- constructor(srcDir: any, distDir: any);
13
- customRequireHook(modulePath: any, relativePath: any): Promise<boolean>;
14
- findInNodeModules(moduleName: any, relativePath: any): string;
15
- transformModulePath(originalPath: any): any;
16
- transformRequirePath(moduleName: any, srcRelativePath: any, srcModuleRelativePath: any, distModuleRelativePath: any): string;
17
- isCodeFile(filePath: any): boolean;
18
- ensureDirForFile(filePath: any): void;
19
- processCodeFile(srcRelativePath: any, distRelativePath: any, isNodeModuleFile: any): Promise<void>;
20
- copyNonCodeFile(srcRelativePath: any, distRelativePath: any): void;
21
- collectFiles(rootDir: any, relativeDir?: any): void;
22
- addTransform(srcRelativePath: any, distRelativePath: any, isNodeModuleFile: any): void;
23
- processTransforms(): Promise<void>;
24
- generateReport(): {
25
- srcDir: string;
26
- distDir: string;
27
- processedFiles: string[];
28
- sourceMaps: [string, any][];
29
- totalFiles: number;
30
- totalSourceMaps: number;
31
- timestamp: string;
32
- };
33
- extract(): Promise<void>;
34
- }
35
- export declare function extract(params: {
36
- srcDir: string;
37
- distDir: string;
38
- }): Promise<void>;
@@ -1,3 +0,0 @@
1
- export declare function getWasmBrCodeMd5({ entryDir }: {
2
- entryDir: string;
3
- }): string;
@@ -1,3 +0,0 @@
1
- export declare function getWasmBrCodePath({ entryDir, }: {
2
- entryDir: string;
3
- }): string;
@@ -1 +0,0 @@
1
- export declare function getWasmCode(outputDir: string, filePath: string): string;
@@ -1 +0,0 @@
1
- export declare function hasWasmBrCode(gameEntry: string): boolean;
@@ -1,6 +0,0 @@
1
- export { getWasmBrCodePath } from './getWasmBrCodePath';
2
- export { getWasmCode } from './getWasmCode';
3
- export { replaceWasmCode } from './replaceWasmCode';
4
- export { isUnityEngine } from './isUnityEngine';
5
- export { hasWasmBrCode } from './hasWasmBrCode';
6
- export { getWasmBrCodeMd5 } from './getWasmBrCodeMd5';
@@ -1 +0,0 @@
1
- export declare function isUnityEngine(gameEntry: string): boolean;
@@ -1,5 +0,0 @@
1
- export declare function replaceWasmCode(params: {
2
- outputDir: string;
3
- filePath: string;
4
- content: string;
5
- }): void;