miqro 6.2.1 → 6.2.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.
@@ -16,6 +16,7 @@ export interface InflateOptions {
16
16
  embemedJSX: boolean;
17
17
  minify: boolean;
18
18
  useExport: boolean;
19
+ platform?: string;
19
20
  logger?: Logger | Console;
20
21
  }
21
22
  export declare function inflateJSX(inFile: string, options: InflateOptions): Promise<string>;
@@ -49,7 +49,8 @@ export async function inflateJSX(inFile, options) {
49
49
  const { outputFiles: [{ contents }] } = await esBuild({
50
50
  ...DEFAULT_ESOPTION,
51
51
  entryPoints: [inFileTmp],
52
- minify: options.minify
52
+ minify: options.minify,
53
+ platform: options.platform ? options.platform : DEFAULT_ESOPTION.platform
53
54
  });
54
55
  if (CLEAR_JSX_CACHE) {
55
56
  logger?.trace("clearing cache at [%s] to change this behaivor set CLEAR_JSX_CACHE to 0", tmpBuildDir);
@@ -69,7 +70,8 @@ export async function inflateJSX(inFile, options) {
69
70
  const { outputFiles: [{ contents }] } = await esBuild({
70
71
  ...DEFAULT_ESOPTION,
71
72
  entryPoints: [inFileTmp],
72
- minify: options.minify
73
+ minify: options.minify,
74
+ platform: options.platform ? options.platform : DEFAULT_ESOPTION.platform
73
75
  });
74
76
  if (CLEAR_JSX_CACHE) {
75
77
  logger?.trace("clearing cache at [%s] to change this behaivor set CLEAR_JSX_CACHE to 0", tmpBuildDir);
@@ -397,10 +399,12 @@ export async function importJSXFile(inFile, logger) {
397
399
  embemedJSX: false,
398
400
  minify: false,
399
401
  useExport: true,
402
+ platform: "node",
400
403
  logger
401
404
  });
402
405
  const tmpBuildDir = resolve(JSX_TMP_DIR, String(process.pid), "import", Date.now() + "-" + randomUUID());
403
- const inFileTmp = resolve(tmpBuildDir, basename(inFile) + ".mjs");
406
+ //const inFileTmp = resolve(tmpBuildDir, basename(inFile) + ".mjs");
407
+ const inFileTmp = resolve(tmpBuildDir, basename(inFile) + ".cjs");
404
408
  //const logger = getLogger(`${SERVER_IDENTIFIER}_JSX`);
405
409
  mkdirSync(tmpBuildDir, {
406
410
  recursive: true
@@ -410,18 +414,18 @@ export async function importJSXFile(inFile, logger) {
410
414
  assertGlobalTampered();
411
415
  logger?.trace("importing [%s] from [%s]. to change the import folder set JSX_TMP", relative(cwd(), inFile), dirname(relative(JSX_TMP_DIR, inFileTmp)));
412
416
  logger?.debug("importing [%s]", relative(cwd(), inFile));
413
- const module = await import(inFileTmp);
417
+ const module = await import(resolve(inFileTmp));
414
418
  assertGlobalTampered();
415
419
  if (CLEAR_JSX_CACHE) {
416
420
  logger?.trace("clearing cache at [%s]. to change this behaivor set CLEAR_JSX_CACHE to 0", tmpBuildDir);
417
421
  unlinkSync(inFileTmp);
418
422
  rmdirSync(tmpBuildDir);
419
423
  }
420
- return module;
424
+ return module.default;
421
425
  }
422
426
  catch (e) {
423
427
  logger?.error(e);
424
- logger?.error("error with: " + inFile);
428
+ logger?.error("error with2: " + inFile);
425
429
  if (CLEAR_JSX_CACHE) {
426
430
  logger?.trace("clearing cache at [%s] to change this behaivor set CLEAR_JSX_CACHE to 0", tmpBuildDir);
427
431
  unlinkSync(inFileTmp);
@@ -17,7 +17,10 @@ function tryConnection() {
17
17
  const newSocket = getSocket();
18
18
  newSocket.addEventListener("open", (event) => {
19
19
  console.log("reloading");
20
- window.location.reload();
20
+ setTimeout(()=>{
21
+ window.location.reload();
22
+ }, 500);
23
+
21
24
  });
22
25
  newSocket.addEventListener("error", (err) => {
23
26
  console.error(err);
@@ -10,7 +10,7 @@ export class WebSocketManager {
10
10
  this.onUpgrade = this.onUpgrade.bind(this);
11
11
  this.logger = options && options.logger ? options.logger : null;
12
12
  this.name = options && options.name ? options.name : "WebSocketManager";
13
- this.loggerProvider = options.loggerProvider;
13
+ this.loggerProvider = options && options.loggerProvider;
14
14
  this.avoidLogSocket = options && options.avoidLogSocket ? options.avoidLogSocket : false;
15
15
  }
16
16
  deleteWS(path) {
package/build/lib.cjs CHANGED
@@ -9060,7 +9060,7 @@ var WebSocketManager = class {
9060
9060
  this.onUpgrade = this.onUpgrade.bind(this);
9061
9061
  this.logger = options && options.logger ? options.logger : null;
9062
9062
  this.name = options && options.name ? options.name : "WebSocketManager";
9063
- this.loggerProvider = options.loggerProvider;
9063
+ this.loggerProvider = options && options.loggerProvider;
9064
9064
  this.avoidLogSocket = options && options.avoidLogSocket ? options.avoidLogSocket : false;
9065
9065
  }
9066
9066
  deleteWS(path) {
@@ -14343,7 +14343,8 @@ async function inflateJSX(inFile, options) {
14343
14343
  const { outputFiles: [{ contents }] } = await esBuild({
14344
14344
  ...DEFAULT_ESOPTION,
14345
14345
  entryPoints: [inFileTmp],
14346
- minify: options.minify
14346
+ minify: options.minify,
14347
+ platform: options.platform ? options.platform : DEFAULT_ESOPTION.platform
14347
14348
  });
14348
14349
  if (CLEAR_JSX_CACHE) {
14349
14350
  logger?.trace("clearing cache at [%s] to change this behaivor set CLEAR_JSX_CACHE to 0", tmpBuildDir);
@@ -14360,7 +14361,8 @@ async function inflateJSX(inFile, options) {
14360
14361
  const { outputFiles: [{ contents }] } = await esBuild({
14361
14362
  ...DEFAULT_ESOPTION,
14362
14363
  entryPoints: [inFileTmp],
14363
- minify: options.minify
14364
+ minify: options.minify,
14365
+ platform: options.platform ? options.platform : DEFAULT_ESOPTION.platform
14364
14366
  });
14365
14367
  if (CLEAR_JSX_CACHE) {
14366
14368
  logger?.trace("clearing cache at [%s] to change this behaivor set CLEAR_JSX_CACHE to 0", tmpBuildDir);
@@ -14661,10 +14663,11 @@ async function importJSXFile(inFile, logger) {
14661
14663
  embemedJSX: false,
14662
14664
  minify: false,
14663
14665
  useExport: true,
14666
+ platform: "node",
14664
14667
  logger
14665
14668
  });
14666
14669
  const tmpBuildDir = (0, import_node_path5.resolve)(JSX_TMP_DIR, String(process.pid), "import", Date.now() + "-" + (0, import_node_crypto4.randomUUID)());
14667
- const inFileTmp = (0, import_node_path5.resolve)(tmpBuildDir, (0, import_node_path5.basename)(inFile) + ".mjs");
14670
+ const inFileTmp = (0, import_node_path5.resolve)(tmpBuildDir, (0, import_node_path5.basename)(inFile) + ".cjs");
14668
14671
  (0, import_node_fs6.mkdirSync)(tmpBuildDir, {
14669
14672
  recursive: true
14670
14673
  });
@@ -14673,17 +14676,17 @@ async function importJSXFile(inFile, logger) {
14673
14676
  assertGlobalTampered();
14674
14677
  logger?.trace("importing [%s] from [%s]. to change the import folder set JSX_TMP", (0, import_node_path5.relative)((0, import_node_process3.cwd)(), inFile), (0, import_node_path5.dirname)((0, import_node_path5.relative)(JSX_TMP_DIR, inFileTmp)));
14675
14678
  logger?.debug("importing [%s]", (0, import_node_path5.relative)((0, import_node_process3.cwd)(), inFile));
14676
- const module2 = await import(inFileTmp);
14679
+ const module2 = await import((0, import_node_path5.resolve)(inFileTmp));
14677
14680
  assertGlobalTampered();
14678
14681
  if (CLEAR_JSX_CACHE) {
14679
14682
  logger?.trace("clearing cache at [%s]. to change this behaivor set CLEAR_JSX_CACHE to 0", tmpBuildDir);
14680
14683
  (0, import_node_fs6.unlinkSync)(inFileTmp);
14681
14684
  (0, import_node_fs6.rmdirSync)(tmpBuildDir);
14682
14685
  }
14683
- return module2;
14686
+ return module2.default;
14684
14687
  } catch (e) {
14685
14688
  logger?.error(e);
14686
- logger?.error("error with: " + inFile);
14689
+ logger?.error("error with2: " + inFile);
14687
14690
  if (CLEAR_JSX_CACHE) {
14688
14691
  logger?.trace("clearing cache at [%s] to change this behaivor set CLEAR_JSX_CACHE to 0", tmpBuildDir);
14689
14692
  (0, import_node_fs6.unlinkSync)(inFileTmp);
@@ -14735,7 +14738,10 @@ function tryConnection() {
14735
14738
  const newSocket = getSocket();
14736
14739
  newSocket.addEventListener("open", (event) => {
14737
14740
  console.log("reloading");
14738
- window.location.reload();
14741
+ setTimeout(()=>{
14742
+ window.location.reload();
14743
+ }, 500);
14744
+
14739
14745
  });
14740
14746
  newSocket.addEventListener("error", (err) => {
14741
14747
  console.error(err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miqro",
3
- "version": "6.2.1",
3
+ "version": "6.2.2",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "build/esm/src/lib.js",
package/src/common/jsx.ts CHANGED
@@ -50,6 +50,7 @@ export interface InflateOptions {
50
50
  embemedJSX: boolean;
51
51
  minify: boolean;
52
52
  useExport: boolean;
53
+ platform?: string;
53
54
  logger?: Logger | Console;
54
55
  }
55
56
 
@@ -78,7 +79,8 @@ export async function inflateJSX(inFile: string, options: InflateOptions): Promi
78
79
  const { outputFiles: [{ contents }] } = await esBuild({
79
80
  ...DEFAULT_ESOPTION,
80
81
  entryPoints: [inFileTmp],
81
- minify: options.minify
82
+ minify: options.minify,
83
+ platform: options.platform ? options.platform: DEFAULT_ESOPTION.platform
82
84
  });
83
85
  if (CLEAR_JSX_CACHE) {
84
86
  logger?.trace("clearing cache at [%s] to change this behaivor set CLEAR_JSX_CACHE to 0", tmpBuildDir);
@@ -97,7 +99,8 @@ export async function inflateJSX(inFile: string, options: InflateOptions): Promi
97
99
  const { outputFiles: [{ contents }] } = await esBuild({
98
100
  ...DEFAULT_ESOPTION,
99
101
  entryPoints: [inFileTmp],
100
- minify: options.minify
102
+ minify: options.minify,
103
+ platform: options.platform ? options.platform: DEFAULT_ESOPTION.platform
101
104
  });
102
105
  if (CLEAR_JSX_CACHE) {
103
106
  logger?.trace("clearing cache at [%s] to change this behaivor set CLEAR_JSX_CACHE to 0", tmpBuildDir);
@@ -449,10 +452,12 @@ export async function importJSXFile(inFile: string, logger?: Logger | Console):
449
452
  embemedJSX: false,
450
453
  minify: false,
451
454
  useExport: true,
455
+ platform: "node",
452
456
  logger
453
457
  });
454
458
  const tmpBuildDir = resolve(JSX_TMP_DIR, String(process.pid), "import", Date.now() + "-" + randomUUID());
455
- const inFileTmp = resolve(tmpBuildDir, basename(inFile) + ".mjs");
459
+ //const inFileTmp = resolve(tmpBuildDir, basename(inFile) + ".mjs");
460
+ const inFileTmp = resolve(tmpBuildDir, basename(inFile) + ".cjs");
456
461
  //const logger = getLogger(`${SERVER_IDENTIFIER}_JSX`);
457
462
  mkdirSync(tmpBuildDir, {
458
463
  recursive: true
@@ -462,17 +467,17 @@ export async function importJSXFile(inFile: string, logger?: Logger | Console):
462
467
  assertGlobalTampered();
463
468
  logger?.trace("importing [%s] from [%s]. to change the import folder set JSX_TMP", relative(cwd(), inFile), dirname(relative(JSX_TMP_DIR, inFileTmp)));
464
469
  logger?.debug("importing [%s]", relative(cwd(), inFile));
465
- const module = await import(inFileTmp);
470
+ const module = await import(resolve(inFileTmp));
466
471
  assertGlobalTampered();
467
472
  if (CLEAR_JSX_CACHE) {
468
473
  logger?.trace("clearing cache at [%s]. to change this behaivor set CLEAR_JSX_CACHE to 0", tmpBuildDir);
469
474
  unlinkSync(inFileTmp);
470
475
  rmdirSync(tmpBuildDir);
471
476
  }
472
- return module;
477
+ return module.default;
473
478
  } catch (e) {
474
479
  logger?.error(e);
475
- logger?.error("error with: " + inFile);
480
+ logger?.error("error with2: " + inFile);
476
481
  if (CLEAR_JSX_CACHE) {
477
482
  logger?.trace("clearing cache at [%s] to change this behaivor set CLEAR_JSX_CACHE to 0", tmpBuildDir);
478
483
  unlinkSync(inFileTmp);
@@ -19,7 +19,10 @@ function tryConnection() {
19
19
  const newSocket = getSocket();
20
20
  newSocket.addEventListener("open", (event) => {
21
21
  console.log("reloading");
22
- window.location.reload();
22
+ setTimeout(()=>{
23
+ window.location.reload();
24
+ }, 500);
25
+
23
26
  });
24
27
  newSocket.addEventListener("error", (err) => {
25
28
  console.error(err);
@@ -21,7 +21,7 @@ export class WebSocketManager {
21
21
  this.onUpgrade = this.onUpgrade.bind(this);
22
22
  this.logger = options && options.logger ? options.logger : null;
23
23
  this.name = options && options.name ? options.name : "WebSocketManager";
24
- this.loggerProvider = options.loggerProvider;
24
+ this.loggerProvider = options && options.loggerProvider;
25
25
  this.avoidLogSocket = options && options.avoidLogSocket ? options.avoidLogSocket : false;
26
26
  }
27
27