@steambrew/ttc 1.0.4 → 1.0.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/Compiler.ts +35 -27
- package/dist/index.js +29 -25
- package/package.json +1 -1
package/Compiler.ts
CHANGED
|
@@ -3,7 +3,7 @@ import json from '@rollup/plugin-json';
|
|
|
3
3
|
import commonjs from '@rollup/plugin-commonjs';
|
|
4
4
|
import replace from '@rollup/plugin-replace';
|
|
5
5
|
import typescript from '@rollup/plugin-typescript';
|
|
6
|
-
import
|
|
6
|
+
import resolve from '@rollup/plugin-node-resolve';
|
|
7
7
|
import terser from '@rollup/plugin-terser';
|
|
8
8
|
import babel from '@rollup/plugin-babel';
|
|
9
9
|
|
|
@@ -110,12 +110,19 @@ function InsertWebkitMillennium(props: TranspilerProps)
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
function GetPluginComponents(props: TranspilerProps) {
|
|
113
|
+
|
|
114
|
+
let tsConfigPath = `./${GetFrontEndDirectory()}/tsconfig.json`
|
|
115
|
+
|
|
116
|
+
if (!fs.existsSync(tsConfigPath)) {
|
|
117
|
+
tsConfigPath = './tsconfig.json'
|
|
118
|
+
}
|
|
119
|
+
|
|
113
120
|
const pluginList = [
|
|
114
121
|
InsertMillennium(props),
|
|
115
122
|
typescript({
|
|
116
|
-
tsconfig:
|
|
123
|
+
tsconfig: tsConfigPath
|
|
117
124
|
}),
|
|
118
|
-
|
|
125
|
+
resolve(), commonjs(), json(),
|
|
119
126
|
replace({
|
|
120
127
|
delimiters: ['', ''],
|
|
121
128
|
preventAssignment: true,
|
|
@@ -139,7 +146,7 @@ function GetWebkitPluginComponents(props: TranspilerProps) {
|
|
|
139
146
|
typescript({
|
|
140
147
|
tsconfig: './webkit/tsconfig.json'
|
|
141
148
|
}),
|
|
142
|
-
|
|
149
|
+
resolve(), commonjs(), json(),
|
|
143
150
|
replace({
|
|
144
151
|
delimiters: ['', ''],
|
|
145
152
|
preventAssignment: true,
|
|
@@ -193,29 +200,6 @@ export const TranspilerPluginComponent = async (props: TranspilerProps) => {
|
|
|
193
200
|
}
|
|
194
201
|
}
|
|
195
202
|
|
|
196
|
-
const webkitRollupConfig: RollupOptions = {
|
|
197
|
-
input: `./webkit/index.tsx`,
|
|
198
|
-
plugins: GetWebkitPluginComponents(props),
|
|
199
|
-
context: 'window',
|
|
200
|
-
external: (id) => {
|
|
201
|
-
if (id === '@steambrew/client') {
|
|
202
|
-
Logger.Error('The @steambrew/client module should not be included in the webkit module, use @steambrew/webkit instead. Please remove it from the webkit module and try again.')
|
|
203
|
-
process.exit(1)
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
return id === '@steambrew/webkit'
|
|
207
|
-
},
|
|
208
|
-
output: {
|
|
209
|
-
name: "millennium_main",
|
|
210
|
-
file: ".millennium/Dist/webkit.js",
|
|
211
|
-
exports: 'named',
|
|
212
|
-
format: 'iife',
|
|
213
|
-
globals: {
|
|
214
|
-
"@steambrew/webkit": "window.MILLENNIUM_API"
|
|
215
|
-
},
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
203
|
Logger.Info("Starting build; this may take a few moments...")
|
|
220
204
|
|
|
221
205
|
try {
|
|
@@ -223,6 +207,30 @@ export const TranspilerPluginComponent = async (props: TranspilerProps) => {
|
|
|
223
207
|
|
|
224
208
|
if (fs.existsSync(`./webkit/index.tsx`)) {
|
|
225
209
|
Logger.Info("Compiling webkit module...")
|
|
210
|
+
|
|
211
|
+
const webkitRollupConfig: RollupOptions = {
|
|
212
|
+
input: `./webkit/index.tsx`,
|
|
213
|
+
plugins: GetWebkitPluginComponents(props),
|
|
214
|
+
context: 'window',
|
|
215
|
+
external: (id) => {
|
|
216
|
+
if (id === '@steambrew/client') {
|
|
217
|
+
Logger.Error('The @steambrew/client module should not be included in the webkit module, use @steambrew/webkit instead. Please remove it from the webkit module and try again.')
|
|
218
|
+
process.exit(1)
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return id === '@steambrew/webkit'
|
|
222
|
+
},
|
|
223
|
+
output: {
|
|
224
|
+
name: "millennium_main",
|
|
225
|
+
file: ".millennium/Dist/webkit.js",
|
|
226
|
+
exports: 'named',
|
|
227
|
+
format: 'iife',
|
|
228
|
+
globals: {
|
|
229
|
+
"@steambrew/webkit": "window.MILLENNIUM_API"
|
|
230
|
+
},
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
226
234
|
await (await rollup(webkitRollupConfig)).write(webkitRollupConfig.output as OutputOptions);
|
|
227
235
|
}
|
|
228
236
|
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import json from '@rollup/plugin-json';
|
|
|
9
9
|
import commonjs from '@rollup/plugin-commonjs';
|
|
10
10
|
import replace from '@rollup/plugin-replace';
|
|
11
11
|
import typescript from '@rollup/plugin-typescript';
|
|
12
|
-
import
|
|
12
|
+
import resolve from '@rollup/plugin-node-resolve';
|
|
13
13
|
import terser from '@rollup/plugin-terser';
|
|
14
14
|
import babel from '@rollup/plugin-babel';
|
|
15
15
|
import { performance as performance$1 } from 'perf_hooks';
|
|
@@ -236,12 +236,16 @@ function InsertWebkitMillennium(props) {
|
|
|
236
236
|
return { name: String(), generateBundle };
|
|
237
237
|
}
|
|
238
238
|
function GetPluginComponents(props) {
|
|
239
|
+
let tsConfigPath = `./${GetFrontEndDirectory()}/tsconfig.json`;
|
|
240
|
+
if (!fs.existsSync(tsConfigPath)) {
|
|
241
|
+
tsConfigPath = './tsconfig.json';
|
|
242
|
+
}
|
|
239
243
|
const pluginList = [
|
|
240
244
|
InsertMillennium(props),
|
|
241
245
|
typescript({
|
|
242
|
-
tsconfig:
|
|
246
|
+
tsconfig: tsConfigPath
|
|
243
247
|
}),
|
|
244
|
-
|
|
248
|
+
resolve(), commonjs(), json(),
|
|
245
249
|
replace({
|
|
246
250
|
delimiters: ['', ''],
|
|
247
251
|
preventAssignment: true,
|
|
@@ -263,7 +267,7 @@ function GetWebkitPluginComponents(props) {
|
|
|
263
267
|
typescript({
|
|
264
268
|
tsconfig: './webkit/tsconfig.json'
|
|
265
269
|
}),
|
|
266
|
-
|
|
270
|
+
resolve(), commonjs(), json(),
|
|
267
271
|
replace({
|
|
268
272
|
delimiters: ['', ''],
|
|
269
273
|
preventAssignment: true,
|
|
@@ -311,32 +315,32 @@ const TranspilerPluginComponent = async (props) => {
|
|
|
311
315
|
format: 'iife'
|
|
312
316
|
}
|
|
313
317
|
};
|
|
314
|
-
const webkitRollupConfig = {
|
|
315
|
-
input: `./webkit/index.tsx`,
|
|
316
|
-
plugins: GetWebkitPluginComponents(props),
|
|
317
|
-
context: 'window',
|
|
318
|
-
external: (id) => {
|
|
319
|
-
if (id === '@steambrew/client') {
|
|
320
|
-
Logger.Error('The @steambrew/client module should not be included in the webkit module, use @steambrew/webkit instead. Please remove it from the webkit module and try again.');
|
|
321
|
-
process.exit(1);
|
|
322
|
-
}
|
|
323
|
-
return id === '@steambrew/webkit';
|
|
324
|
-
},
|
|
325
|
-
output: {
|
|
326
|
-
name: "millennium_main",
|
|
327
|
-
file: ".millennium/Dist/webkit.js",
|
|
328
|
-
exports: 'named',
|
|
329
|
-
format: 'iife',
|
|
330
|
-
globals: {
|
|
331
|
-
"@steambrew/webkit": "window.MILLENNIUM_API"
|
|
332
|
-
},
|
|
333
|
-
}
|
|
334
|
-
};
|
|
335
318
|
Logger.Info("Starting build; this may take a few moments...");
|
|
336
319
|
try {
|
|
337
320
|
await (await rollup(frontendRollupConfig)).write(frontendRollupConfig.output);
|
|
338
321
|
if (fs.existsSync(`./webkit/index.tsx`)) {
|
|
339
322
|
Logger.Info("Compiling webkit module...");
|
|
323
|
+
const webkitRollupConfig = {
|
|
324
|
+
input: `./webkit/index.tsx`,
|
|
325
|
+
plugins: GetWebkitPluginComponents(props),
|
|
326
|
+
context: 'window',
|
|
327
|
+
external: (id) => {
|
|
328
|
+
if (id === '@steambrew/client') {
|
|
329
|
+
Logger.Error('The @steambrew/client module should not be included in the webkit module, use @steambrew/webkit instead. Please remove it from the webkit module and try again.');
|
|
330
|
+
process.exit(1);
|
|
331
|
+
}
|
|
332
|
+
return id === '@steambrew/webkit';
|
|
333
|
+
},
|
|
334
|
+
output: {
|
|
335
|
+
name: "millennium_main",
|
|
336
|
+
file: ".millennium/Dist/webkit.js",
|
|
337
|
+
exports: 'named',
|
|
338
|
+
format: 'iife',
|
|
339
|
+
globals: {
|
|
340
|
+
"@steambrew/webkit": "window.MILLENNIUM_API"
|
|
341
|
+
},
|
|
342
|
+
}
|
|
343
|
+
};
|
|
340
344
|
await (await rollup(webkitRollupConfig)).write(webkitRollupConfig.output);
|
|
341
345
|
}
|
|
342
346
|
Logger.Info('Build succeeded!', Number((performance.now() - global.PerfStartTime).toFixed(3)), 'ms elapsed.');
|