@steambrew/ttc 1.0.0 → 1.0.2

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 CHANGED
@@ -5,6 +5,7 @@ import replace from '@rollup/plugin-replace';
5
5
  import typescript from '@rollup/plugin-typescript';
6
6
  import { nodeResolve } from '@rollup/plugin-node-resolve';
7
7
  import terser from '@rollup/plugin-terser';
8
+ import babel from '@rollup/plugin-babel';
8
9
 
9
10
  import chalk from 'chalk'
10
11
  import { Logger } from "./Logger";
@@ -66,81 +67,62 @@ function InitializePlugins() {
66
67
  }
67
68
  }
68
69
 
70
+ const ContructFunctions = (parts: any) => { return parts.join('\n'); }
71
+
69
72
  function InsertMillennium(props: TranspilerProps)
70
73
  {
71
- const ContructFunctions = (parts: any) => { return parts.join('\n'); }
72
-
73
74
  const generateBundle = (_: unknown, bundle: any) => {
74
-
75
- for (const fileName in bundle)
76
- {
77
- if (bundle[fileName].type != 'chunk') {
78
- continue
79
- }
75
+ for (const fileName in bundle) {
76
+ if (bundle[fileName].type != 'chunk') continue
77
+
80
78
  Logger.Info("Injecting Millennium shims into module... " + chalk.green.bold("okay"))
81
79
 
82
80
  bundle[fileName].code = ContructFunctions([
83
81
  `const pluginName = "${props.strPluginInternalName}";`,
84
- // insert the bootstrap function and call it
85
82
  InitializePlugins.toString(), InitializePlugins.name + "()",
86
- WrappedCallServerMethod,
87
- WrappedCallable,
88
- bundle[fileName].code,
83
+ WrappedCallServerMethod, WrappedCallable, bundle[fileName].code,
89
84
  ExecutePluginModule.toString(), ExecutePluginModule.name + "()"
90
85
  ])
91
86
  }
92
87
  }
93
88
 
94
- return {
95
- name: 'add-plugin-main', generateBundle
96
- };
89
+ return { name: String(), generateBundle };
97
90
  }
98
91
 
99
92
  function InsertWebkitMillennium(props: TranspilerProps)
100
93
  {
101
- const ContructFunctions = (parts: any) => { return parts.join('\n'); }
102
-
103
94
  const generateBundle = (_: unknown, bundle: any) => {
104
-
105
- for (const fileName in bundle)
106
- {
107
- if (bundle[fileName].type != 'chunk') {
108
- continue
109
- }
95
+ for (const fileName in bundle) {
96
+ if (bundle[fileName].type != 'chunk') continue
97
+
110
98
  Logger.Info("Injecting Millennium shims into webkit module... " + chalk.green.bold("okay"))
111
99
 
112
100
  bundle[fileName].code = ContructFunctions([
113
- // define the plugin name at the top of the bundle, so it can be used in wrapped functions
114
101
  `const pluginName = "${props.strPluginInternalName}";`,
115
- // insert the bootstrap function and call it
116
102
  InitializePlugins.toString(), InitializePlugins.name + "()",
117
- // TODO
118
103
  WrappedCallServerMethod, WrappedCallable, bundle[fileName].code,
119
104
  ExecuteWebkitModule.toString(), ExecuteWebkitModule.name + "()"
120
105
  ])
121
106
  }
122
107
  }
123
108
 
124
- return {
125
- name: 'add-plugin-main', generateBundle
126
- };
109
+ return { name: String(), generateBundle };
127
110
  }
128
111
 
129
112
  function GetPluginComponents(props: TranspilerProps) {
130
113
  const pluginList = [
131
- /**
132
- * @brief resolve millennium, edit the exported bundle to work with millennium
133
- */
134
114
  InsertMillennium(props),
135
- typescript(), nodeResolve(), commonjs(), json(),
115
+ typescript({
116
+ tsconfig: `./${GetFrontEndDirectory()}/tsconfig.json`
117
+ }),
118
+ nodeResolve(), commonjs(), json(),
136
119
  replace({
137
- preventAssignment: true,
138
- 'process.env.NODE_ENV': JSON.stringify('production'),
139
- // replace callServerMethod with wrapped replacement function.
140
- 'Millennium.callServerMethod': `__call_server_method__`,
141
- 'client.callable': `__wrapped_callable__`,
142
120
  delimiters: ['', ''],
143
- 'client.pluginSelf': 'window.PLUGIN_LIST[pluginName]',
121
+ preventAssignment: true,
122
+ 'process.env.NODE_ENV' : JSON.stringify('production'),
123
+ 'Millennium.callServerMethod' : `__call_server_method__`,
124
+ 'client.callable' : `__wrapped_callable__`,
125
+ 'client.pluginSelf' : 'window.PLUGIN_LIST[pluginName]',
144
126
  'client.Millennium.exposeObj(': 'client.Millennium.exposeObj(exports, '
145
127
  }),
146
128
  ]
@@ -153,30 +135,31 @@ function GetPluginComponents(props: TranspilerProps) {
153
135
 
154
136
  function GetWebkitPluginComponents(props: TranspilerProps) {
155
137
  const pluginList = [
156
- InsertWebkitMillennium(props), typescript(), nodeResolve(), commonjs(), json(),
138
+ InsertWebkitMillennium(props),
139
+ typescript({
140
+ tsconfig: './webkit/tsconfig.json'
141
+ }),
142
+ nodeResolve(), commonjs(), json(),
157
143
  replace({
144
+ delimiters: ['', ''],
158
145
  preventAssignment: true,
159
- // replace callServerMethod with wrapped replacement function.
160
146
  'Millennium.callServerMethod': `__call_server_method__`,
161
- 'client.callable': `__wrapped_callable__`,
162
- delimiters: ['', ''],
147
+ 'webkit.callable': `__wrapped_callable__`,
163
148
  }),
149
+ babel({
150
+ presets: ['@babel/preset-env', '@babel/preset-react'],
151
+ babelHelpers: 'bundled',
152
+ })
164
153
  ]
165
154
 
166
- if (props.bTersePlugin) {
167
- pluginList.push(terser())
168
- }
155
+ props.bTersePlugin && pluginList.push(terser())
169
156
  return pluginList
170
157
  }
171
158
 
172
159
  const GetFrontEndDirectory = () => {
173
160
  const pluginJsonPath = './plugin.json';
174
-
175
161
  try {
176
- const pluginJson = JSON.parse(fs.readFileSync(pluginJsonPath, 'utf8'));
177
- const frontendDirectory = pluginJson?.frontend;
178
-
179
- return frontendDirectory ? frontendDirectory : "frontend";
162
+ return JSON.parse(fs.readFileSync(pluginJsonPath, 'utf8'))?.frontend ?? "frontend";
180
163
  }
181
164
  catch (error) {
182
165
  return "frontend";
@@ -189,13 +172,20 @@ export const TranspilerPluginComponent = async (props: TranspilerProps) => {
189
172
  input: `./${GetFrontEndDirectory()}/index.tsx`,
190
173
  plugins: GetPluginComponents(props),
191
174
  context: 'window',
192
- external: ['react', 'react-dom', '@steambrew/client'],
175
+ external: (id) => {
176
+ if (id === '@steambrew/webkit') {
177
+ Logger.Error('The @steambrew/webkit module should not be included in the frontend module, use @steambrew/client instead. Please remove it from the frontend module and try again.')
178
+ process.exit(1)
179
+ }
180
+
181
+ return id === '@steambrew/client' || id === 'react' || id === 'react-dom'
182
+ },
193
183
  output: {
194
184
  name: "millennium_main",
195
185
  file: ".millennium/Dist/index.js",
196
186
  globals: {
197
- react: "window.SP_REACT",
198
- "react-dom": "window.SP_REACTDOM",
187
+ "react" : "window.SP_REACT",
188
+ "react-dom" : "window.SP_REACTDOM",
199
189
  "@steambrew/client": "window.MILLENNIUM_API"
200
190
  },
201
191
  exports: 'named',
@@ -204,37 +194,36 @@ export const TranspilerPluginComponent = async (props: TranspilerProps) => {
204
194
  }
205
195
 
206
196
  const webkitRollupConfig: RollupOptions = {
207
- input: `./webkit/index.ts`,
197
+ input: `./webkit/index.tsx`,
208
198
  plugins: GetWebkitPluginComponents(props),
209
199
  context: 'window',
210
- external: ['@steambrew/client'],
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
+ },
211
208
  output: {
212
209
  name: "millennium_main",
213
210
  file: ".millennium/Dist/webkit.js",
214
211
  exports: 'named',
215
212
  format: 'iife',
216
213
  globals: {
217
- "@steambrew/client": "window.MILLENNIUM_API"
214
+ "@steambrew/webkit": "window.MILLENNIUM_API"
218
215
  },
219
216
  }
220
217
  }
221
218
 
222
219
  Logger.Info("Starting build; this may take a few moments...")
223
- // Load the Rollup configuration file
220
+
224
221
  try {
225
- const bundle = await rollup(frontendRollupConfig);
226
- const outputOptions = frontendRollupConfig.output as OutputOptions;
227
-
228
- await bundle.write(outputOptions);
222
+ await (await rollup(frontendRollupConfig)).write(frontendRollupConfig.output as OutputOptions);
229
223
 
230
- // check if the webkit file exists
231
- if (fs.existsSync(`./webkit/index.ts`)) {
224
+ if (fs.existsSync(`./webkit/index.tsx`)) {
232
225
  Logger.Info("Compiling webkit module...")
233
-
234
- const bundle1 = await rollup(webkitRollupConfig);
235
- const outputOptions1 = webkitRollupConfig.output as OutputOptions;
236
-
237
- await bundle1.write(outputOptions1);
226
+ await (await rollup(webkitRollupConfig)).write(webkitRollupConfig.output as OutputOptions);
238
227
  }
239
228
 
240
229
  Logger.Info('Build succeeded!', Number((performance.now() - global.PerfStartTime).toFixed(3)), 'ms elapsed.')
package/Logger.ts CHANGED
@@ -3,20 +3,20 @@ import chalk from 'chalk'
3
3
  const Logger = {
4
4
 
5
5
  Info: (...LogMessage: any) => {
6
- console.log(chalk.magenta.bold("[+]"), ...LogMessage)
6
+ console.log(chalk.magenta.bold("++"), ...LogMessage)
7
7
  },
8
8
 
9
9
  Warn: (...LogMessage: any) => {
10
- console.log(chalk.yellow.bold("[*]"), ...LogMessage)
10
+ console.log(chalk.yellow.bold("**"), ...LogMessage)
11
11
  },
12
12
 
13
13
  Error: (...LogMessage: any) => {
14
- console.log(chalk.red.bold("[-]"), ...LogMessage)
14
+ console.log(chalk.red.bold("!!"), ...LogMessage)
15
15
  },
16
16
 
17
17
  Tree: (strTitle: string, LogObject: any) => {
18
18
 
19
- console.log(chalk.magenta.bold("[┬]"), strTitle);
19
+ console.log(chalk.magenta.bold("++"), strTitle);
20
20
 
21
21
  const isLocalPath = (strTestPath: string): boolean => {
22
22
  // Regular expression to match common file path patterns
@@ -29,7 +29,7 @@ const Logger = {
29
29
 
30
30
  for (const [index, [key, value]] of entries.entries()) {
31
31
 
32
- const connector = index === totalEntries - 1 ? "" : ""
32
+ const connector = index === totalEntries - 1 ? " " : " "
33
33
  let color = chalk.white
34
34
 
35
35
  switch (typeof value) {
package/VersionMon.ts CHANGED
@@ -6,21 +6,21 @@ import { Logger } from './Logger';
6
6
 
7
7
  export const CheckForUpdates = async (): Promise<boolean> => {
8
8
  return new Promise<boolean>(async (resolve) => {
9
- const packageJsonPath = path.resolve(dirname(fileURLToPath(import.meta.url)), '../../package.json');
9
+ const packageJsonPath = path.resolve(dirname(fileURLToPath(import.meta.url)), '../package.json');
10
10
  const packageJson = JSON.parse(await readFile(packageJsonPath, 'utf8'));
11
11
 
12
- fetch("https://registry.npmjs.org/millennium-lib").then(response => response.json()).then(json => {
12
+ fetch("https://registry.npmjs.org/@steambrew/ttc").then(response => response.json()).then(json => {
13
13
 
14
14
  if (json?.["dist-tags"]?.latest != packageJson.version) {
15
15
 
16
- Logger.Tree(`millennium-lib@${packageJson.version} requires update to ${json?.["dist-tags"]?.latest}`, {
17
- cmd: "run `npm i millennium-lib` to get latest updates!"
16
+ Logger.Tree(`@steambrew/ttc@${packageJson.version} requires update to ${json?.["dist-tags"]?.latest}`, {
17
+ cmd: `run "npm install @steambrew/ttc@${json?.["dist-tags"]?.latest}" to get latest updates!`
18
18
  })
19
19
 
20
20
  resolve(true)
21
21
  }
22
22
  else {
23
- Logger.Info(`millennium-lib@${packageJson.version} is up-to-date!`)
23
+ Logger.Info(`@steambrew/ttc@${packageJson.version} is up-to-date!`)
24
24
  resolve(false)
25
25
  }
26
26
  })
package/dist/index.js CHANGED
@@ -11,20 +11,21 @@ import replace from '@rollup/plugin-replace';
11
11
  import typescript from '@rollup/plugin-typescript';
12
12
  import { nodeResolve } from '@rollup/plugin-node-resolve';
13
13
  import terser from '@rollup/plugin-terser';
14
+ import babel from '@rollup/plugin-babel';
14
15
  import { performance as performance$1 } from 'perf_hooks';
15
16
 
16
17
  const Logger = {
17
18
  Info: (...LogMessage) => {
18
- console.log(chalk.magenta.bold("[+]"), ...LogMessage);
19
+ console.log(chalk.magenta.bold("++"), ...LogMessage);
19
20
  },
20
21
  Warn: (...LogMessage) => {
21
- console.log(chalk.yellow.bold("[*]"), ...LogMessage);
22
+ console.log(chalk.yellow.bold("**"), ...LogMessage);
22
23
  },
23
24
  Error: (...LogMessage) => {
24
- console.log(chalk.red.bold("[-]"), ...LogMessage);
25
+ console.log(chalk.red.bold("!!"), ...LogMessage);
25
26
  },
26
27
  Tree: (strTitle, LogObject) => {
27
- console.log(chalk.magenta.bold("[┬]"), strTitle);
28
+ console.log(chalk.magenta.bold("++"), strTitle);
28
29
  const isLocalPath = (strTestPath) => {
29
30
  // Regular expression to match common file path patterns
30
31
  const filePathRegex = /^(\/|\.\/|\.\.\/|\w:\/)?([\w-.]+\/)*[\w-.]+\.\w+$/;
@@ -33,7 +34,7 @@ const Logger = {
33
34
  const entries = Object.entries(LogObject);
34
35
  const totalEntries = entries.length;
35
36
  for (const [index, [key, value]] of entries.entries()) {
36
- const connector = index === totalEntries - 1 ? "" : "";
37
+ const connector = index === totalEntries - 1 ? " " : " ";
37
38
  let color = chalk.white;
38
39
  switch (typeof value) {
39
40
  case typeof String(): {
@@ -110,17 +111,17 @@ const ValidateParameters = (args) => {
110
111
 
111
112
  const CheckForUpdates = async () => {
112
113
  return new Promise(async (resolve) => {
113
- const packageJsonPath = path.resolve(dirname(fileURLToPath(import.meta.url)), '../../package.json');
114
+ const packageJsonPath = path.resolve(dirname(fileURLToPath(import.meta.url)), '../package.json');
114
115
  const packageJson = JSON.parse(await readFile(packageJsonPath, 'utf8'));
115
- fetch("https://registry.npmjs.org/millennium-lib").then(response => response.json()).then(json => {
116
+ fetch("https://registry.npmjs.org/@steambrew/ttc").then(response => response.json()).then(json => {
116
117
  if (json?.["dist-tags"]?.latest != packageJson.version) {
117
- Logger.Tree(`millennium-lib@${packageJson.version} requires update to ${json?.["dist-tags"]?.latest}`, {
118
- cmd: "run `npm i millennium-lib` to get latest updates!"
118
+ Logger.Tree(`@steambrew/ttc@${packageJson.version} requires update to ${json?.["dist-tags"]?.latest}`, {
119
+ cmd: `run "npm install @steambrew/ttc@${json?.["dist-tags"]?.latest}" to get latest updates!`
119
120
  });
120
121
  resolve(true);
121
122
  }
122
123
  else {
123
- Logger.Info(`millennium-lib@${packageJson.version} is up-to-date!`);
124
+ Logger.Info(`@steambrew/ttc@${packageJson.version} is up-to-date!`);
124
125
  resolve(false);
125
126
  }
126
127
  });
@@ -201,66 +202,52 @@ function InitializePlugins() {
201
202
  window.PLUGIN_LIST[pluginName] = {};
202
203
  }
203
204
  }
205
+ const ContructFunctions = (parts) => { return parts.join('\n'); };
204
206
  function InsertMillennium(props) {
205
- const ContructFunctions = (parts) => { return parts.join('\n'); };
206
207
  const generateBundle = (_, bundle) => {
207
208
  for (const fileName in bundle) {
208
- if (bundle[fileName].type != 'chunk') {
209
+ if (bundle[fileName].type != 'chunk')
209
210
  continue;
210
- }
211
211
  Logger.Info("Injecting Millennium shims into module... " + chalk.green.bold("okay"));
212
212
  bundle[fileName].code = ContructFunctions([
213
213
  `const pluginName = "${props.strPluginInternalName}";`,
214
- // insert the bootstrap function and call it
215
214
  InitializePlugins.toString(), InitializePlugins.name + "()",
216
- WrappedCallServerMethod,
217
- WrappedCallable,
218
- bundle[fileName].code,
215
+ WrappedCallServerMethod, WrappedCallable, bundle[fileName].code,
219
216
  ExecutePluginModule.toString(), ExecutePluginModule.name + "()"
220
217
  ]);
221
218
  }
222
219
  };
223
- return {
224
- name: 'add-plugin-main', generateBundle
225
- };
220
+ return { name: String(), generateBundle };
226
221
  }
227
222
  function InsertWebkitMillennium(props) {
228
- const ContructFunctions = (parts) => { return parts.join('\n'); };
229
223
  const generateBundle = (_, bundle) => {
230
224
  for (const fileName in bundle) {
231
- if (bundle[fileName].type != 'chunk') {
225
+ if (bundle[fileName].type != 'chunk')
232
226
  continue;
233
- }
234
227
  Logger.Info("Injecting Millennium shims into webkit module... " + chalk.green.bold("okay"));
235
228
  bundle[fileName].code = ContructFunctions([
236
- // define the plugin name at the top of the bundle, so it can be used in wrapped functions
237
229
  `const pluginName = "${props.strPluginInternalName}";`,
238
- // insert the bootstrap function and call it
239
230
  InitializePlugins.toString(), InitializePlugins.name + "()",
240
- // TODO
241
231
  WrappedCallServerMethod, WrappedCallable, bundle[fileName].code,
242
232
  ExecuteWebkitModule.toString(), ExecuteWebkitModule.name + "()"
243
233
  ]);
244
234
  }
245
235
  };
246
- return {
247
- name: 'add-plugin-main', generateBundle
248
- };
236
+ return { name: String(), generateBundle };
249
237
  }
250
238
  function GetPluginComponents(props) {
251
239
  const pluginList = [
252
- /**
253
- * @brief resolve millennium, edit the exported bundle to work with millennium
254
- */
255
240
  InsertMillennium(props),
256
- typescript(), nodeResolve(), commonjs(), json(),
241
+ typescript({
242
+ tsconfig: `./${GetFrontEndDirectory()}/tsconfig.json`
243
+ }),
244
+ nodeResolve(), commonjs(), json(),
257
245
  replace({
246
+ delimiters: ['', ''],
258
247
  preventAssignment: true,
259
248
  'process.env.NODE_ENV': JSON.stringify('production'),
260
- // replace callServerMethod with wrapped replacement function.
261
249
  'Millennium.callServerMethod': `__call_server_method__`,
262
250
  'client.callable': `__wrapped_callable__`,
263
- delimiters: ['', ''],
264
251
  'client.pluginSelf': 'window.PLUGIN_LIST[pluginName]',
265
252
  'client.Millennium.exposeObj(': 'client.Millennium.exposeObj(exports, '
266
253
  }),
@@ -272,26 +259,29 @@ function GetPluginComponents(props) {
272
259
  }
273
260
  function GetWebkitPluginComponents(props) {
274
261
  const pluginList = [
275
- InsertWebkitMillennium(props), typescript(), nodeResolve(), commonjs(), json(),
262
+ InsertWebkitMillennium(props),
263
+ typescript({
264
+ tsconfig: './webkit/tsconfig.json'
265
+ }),
266
+ nodeResolve(), commonjs(), json(),
276
267
  replace({
268
+ delimiters: ['', ''],
277
269
  preventAssignment: true,
278
- // replace callServerMethod with wrapped replacement function.
279
270
  'Millennium.callServerMethod': `__call_server_method__`,
280
- 'client.callable': `__wrapped_callable__`,
281
- delimiters: ['', ''],
271
+ 'webkit.callable': `__wrapped_callable__`,
282
272
  }),
273
+ babel({
274
+ presets: ['@babel/preset-env', '@babel/preset-react'],
275
+ babelHelpers: 'bundled',
276
+ })
283
277
  ];
284
- if (props.bTersePlugin) {
285
- pluginList.push(terser());
286
- }
278
+ props.bTersePlugin && pluginList.push(terser());
287
279
  return pluginList;
288
280
  }
289
281
  const GetFrontEndDirectory = () => {
290
282
  const pluginJsonPath = './plugin.json';
291
283
  try {
292
- const pluginJson = JSON.parse(fs.readFileSync(pluginJsonPath, 'utf8'));
293
- const frontendDirectory = pluginJson?.frontend;
294
- return frontendDirectory ? frontendDirectory : "frontend";
284
+ return JSON.parse(fs.readFileSync(pluginJsonPath, 'utf8'))?.frontend ?? "frontend";
295
285
  }
296
286
  catch (error) {
297
287
  return "frontend";
@@ -302,12 +292,18 @@ const TranspilerPluginComponent = async (props) => {
302
292
  input: `./${GetFrontEndDirectory()}/index.tsx`,
303
293
  plugins: GetPluginComponents(props),
304
294
  context: 'window',
305
- external: ['react', 'react-dom', '@steambrew/client'],
295
+ external: (id) => {
296
+ if (id === '@steambrew/webkit') {
297
+ Logger.Error('The @steambrew/webkit module should not be included in the frontend module, use @steambrew/client instead. Please remove it from the frontend module and try again.');
298
+ process.exit(1);
299
+ }
300
+ return id === '@steambrew/client' || id === 'react' || id === 'react-dom';
301
+ },
306
302
  output: {
307
303
  name: "millennium_main",
308
304
  file: ".millennium/Dist/index.js",
309
305
  globals: {
310
- react: "window.SP_REACT",
306
+ "react": "window.SP_REACT",
311
307
  "react-dom": "window.SP_REACTDOM",
312
308
  "@steambrew/client": "window.MILLENNIUM_API"
313
309
  },
@@ -316,32 +312,32 @@ const TranspilerPluginComponent = async (props) => {
316
312
  }
317
313
  };
318
314
  const webkitRollupConfig = {
319
- input: `./webkit/index.ts`,
315
+ input: `./webkit/index.tsx`,
320
316
  plugins: GetWebkitPluginComponents(props),
321
317
  context: 'window',
322
- external: ['@steambrew/client'],
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
+ },
323
325
  output: {
324
326
  name: "millennium_main",
325
327
  file: ".millennium/Dist/webkit.js",
326
328
  exports: 'named',
327
329
  format: 'iife',
328
330
  globals: {
329
- "@steambrew/client": "window.MILLENNIUM_API"
331
+ "@steambrew/webkit": "window.MILLENNIUM_API"
330
332
  },
331
333
  }
332
334
  };
333
335
  Logger.Info("Starting build; this may take a few moments...");
334
- // Load the Rollup configuration file
335
336
  try {
336
- const bundle = await rollup(frontendRollupConfig);
337
- const outputOptions = frontendRollupConfig.output;
338
- await bundle.write(outputOptions);
339
- // check if the webkit file exists
340
- if (fs.existsSync(`./webkit/index.ts`)) {
337
+ await (await rollup(frontendRollupConfig)).write(frontendRollupConfig.output);
338
+ if (fs.existsSync(`./webkit/index.tsx`)) {
341
339
  Logger.Info("Compiling webkit module...");
342
- const bundle1 = await rollup(webkitRollupConfig);
343
- const outputOptions1 = webkitRollupConfig.output;
344
- await bundle1.write(outputOptions1);
340
+ await (await rollup(webkitRollupConfig)).write(webkitRollupConfig.output);
345
341
  }
346
342
  Logger.Info('Build succeeded!', Number((performance.now() - global.PerfStartTime).toFixed(3)), 'ms elapsed.');
347
343
  }
@@ -361,11 +357,11 @@ const CheckModuleUpdates = async () => {
361
357
  const StartCompilerModule = () => {
362
358
  const parameters = ValidateParameters(process.argv.slice(2));
363
359
  const bTersePlugin = parameters.type == BuildType.ProdBuild;
364
- Logger.Tree("Transpiler config: ", {
365
- target: parameters.targetPlugin,
366
- build: BuildType[parameters.type],
367
- minify: bTersePlugin
368
- });
360
+ // Logger.Tree("Transpiler config: ", {
361
+ // target: parameters.targetPlugin,
362
+ // build: BuildType[parameters.type],
363
+ // minify: bTersePlugin
364
+ // })
369
365
  ValidatePlugin(parameters.targetPlugin).then((json) => {
370
366
  const props = {
371
367
  bTersePlugin: bTersePlugin,
@@ -382,6 +378,11 @@ const StartCompilerModule = () => {
382
378
  };
383
379
  const Initialize = () => {
384
380
  global.PerfStartTime = performance$1.now();
381
+ // Check for --no-update flag
382
+ if (process.argv.includes("--no-update")) {
383
+ StartCompilerModule();
384
+ return;
385
+ }
385
386
  CheckModuleUpdates().then((needsUpdate) => {
386
387
  needsUpdate ? process.exit() : StartCompilerModule();
387
388
  });
package/index.ts CHANGED
@@ -10,7 +10,7 @@ import { CheckForUpdates } from "./VersionMon"
10
10
  import { ValidatePlugin } from './Linter'
11
11
  import { TranspilerPluginComponent, TranspilerProps } from './Compiler'
12
12
  import { performance } from 'perf_hooks';
13
- import { Logger } from './Logger'
13
+ // import { Logger } from './Logger'
14
14
 
15
15
  declare global {
16
16
  var PerfStartTime: number;
@@ -25,11 +25,11 @@ const StartCompilerModule = () => {
25
25
  const parameters = ValidateParameters( process.argv.slice(2) );
26
26
  const bTersePlugin = parameters.type == BuildType.ProdBuild
27
27
 
28
- Logger.Tree("Transpiler config: ", {
29
- target: parameters.targetPlugin,
30
- build: BuildType[parameters.type],
31
- minify: bTersePlugin
32
- })
28
+ // Logger.Tree("Transpiler config: ", {
29
+ // target: parameters.targetPlugin,
30
+ // build: BuildType[parameters.type],
31
+ // minify: bTersePlugin
32
+ // })
33
33
 
34
34
  ValidatePlugin(parameters.targetPlugin).then((json: any) => {
35
35
 
@@ -52,6 +52,12 @@ const StartCompilerModule = () => {
52
52
  const Initialize = () => {
53
53
  global.PerfStartTime = performance.now();
54
54
 
55
+ // Check for --no-update flag
56
+ if (process.argv.includes("--no-update")) {
57
+ StartCompilerModule()
58
+ return
59
+ }
60
+
55
61
  CheckModuleUpdates().then((needsUpdate: boolean) => {
56
62
  needsUpdate ? process.exit() : StartCompilerModule()
57
63
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steambrew/ttc",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -26,10 +26,13 @@
26
26
  "@rollup/plugin-typescript": "^12.1.1",
27
27
  "chalk": "^5.3.0",
28
28
  "fs": "^0.0.1-security",
29
- "rollup": "^4.27.4",
30
29
  "tslib": "^2.8.1"
31
30
  },
32
31
  "devDependencies": {
33
- "@types/node": "^22.10.1"
32
+ "@babel/preset-env": "^7.26.0",
33
+ "@babel/preset-react": "^7.25.9",
34
+ "@rollup/plugin-babel": "^6.0.4",
35
+ "@types/node": "^22.10.1",
36
+ "rollup": "^4.28.0"
34
37
  }
35
38
  }
package/rollup.config.js CHANGED
@@ -23,6 +23,7 @@ export default {
23
23
  "@rollup/plugin-node-resolve",
24
24
  "rollup-plugin-import-css",
25
25
  "@rollup/plugin-terser",
26
+ "@rollup/plugin-babel",
26
27
  "perf_hooks",
27
28
  ]
28
29
  };