isomorfeus-asset-manager 0.14.21 → 0.14.22

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,72 +2,18 @@
2
2
  // Use of this source code is governed by a BSD-style
3
3
  // license that can be found in the LICENSE file.
4
4
 
5
- (() => {
6
- // Map multiple JavaScript environments to a single common API,
7
- // preferring web standards over Node.js API.
8
- //
9
- // Environments considered:
10
- // - Browsers
11
- // - Node.js
12
- // - Electron
13
- // - Parcel
14
- // - Webpack
15
-
16
- if (typeof global !== "undefined") {
17
- // global already exists
18
- } else if (typeof window !== "undefined") {
19
- window.global = window;
20
- } else if (typeof self !== "undefined") {
21
- self.global = self;
22
- } else {
23
- throw new Error("cannot export Go (neither global, window nor self is defined)");
24
- }
25
-
26
- if (!global.require && typeof require !== "undefined") {
27
- global.require = require;
28
- }
29
-
30
- if (!global.fs && global.require) {
31
- const fs = require("fs");
32
- if (typeof fs === "object" && fs !== null && Object.keys(fs).length !== 0) {
33
-
34
- global.fs = Object.assign({}, fs, {
35
- // Hack around a Unicode bug in node: https://github.com/nodejs/node/issues/24550
36
- write(fd, buf, offset, length, position, callback) {
37
- if (offset === 0 && length === buf.length && position === null) {
38
- if (fd === process.stdout.fd) {
39
- try {
40
- process.stdout.write(buf, err => err ? callback(err, 0, null) : callback(null, length, buf));
41
- } catch (err) {
42
- callback(err, 0, null);
43
- }
44
- return;
45
- }
46
- if (fd === process.stderr.fd) {
47
- try {
48
- process.stderr.write(buf, err => err ? callback(err, 0, null) : callback(null, length, buf));
49
- } catch (err) {
50
- callback(err, 0, null);
51
- }
52
- return;
53
- }
54
- }
55
- fs.write(fd, buf, offset, length, position, callback);
56
- },
57
- });
58
-
59
- }
60
- }
5
+ "use strict";
61
6
 
7
+ (() => {
62
8
  const enosys = () => {
63
9
  const err = new Error("not implemented");
64
10
  err.code = "ENOSYS";
65
11
  return err;
66
12
  };
67
13
 
68
- if (!global.fs) {
14
+ if (!globalThis.fs) {
69
15
  let outputBuf = "";
70
- global.fs = {
16
+ globalThis.fs = {
71
17
  constants: { O_WRONLY: -1, O_RDWR: -1, O_CREAT: -1, O_TRUNC: -1, O_APPEND: -1, O_EXCL: -1 }, // unused
72
18
  writeSync(fd, buf) {
73
19
  outputBuf += decoder.decode(buf);
@@ -112,8 +58,8 @@
112
58
  };
113
59
  }
114
60
 
115
- if (!global.process) {
116
- global.process = {
61
+ if (!globalThis.process) {
62
+ globalThis.process = {
117
63
  getuid() { return -1; },
118
64
  getgid() { return -1; },
119
65
  geteuid() { return -1; },
@@ -127,50 +73,26 @@
127
73
  }
128
74
  }
129
75
 
130
- if (!global.crypto && global.require) {
131
- const nodeCrypto = require("crypto");
132
- global.crypto = {
133
- getRandomValues(b) {
134
- nodeCrypto.randomFillSync(b);
135
- },
136
- };
137
- }
138
- if (!global.crypto) {
139
- throw new Error("global.crypto is not available, polyfill required (getRandomValues only)");
76
+ if (!globalThis.crypto) {
77
+ throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");
140
78
  }
141
79
 
142
- if (!global.performance) {
143
- global.performance = {
144
- now() {
145
- const [sec, nsec] = process.hrtime();
146
- return sec * 1000 + nsec / 1000000;
147
- },
148
- };
80
+ if (!globalThis.performance) {
81
+ throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");
149
82
  }
150
83
 
151
- if (!global.TextEncoder && global.require) {
152
- global.TextEncoder = require("util").TextEncoder;
153
- }
154
- if (!global.TextEncoder) {
155
- throw new Error("global.TextEncoder is not available, polyfill required");
84
+ if (!globalThis.TextEncoder) {
85
+ throw new Error("globalThis.TextEncoder is not available, polyfill required");
156
86
  }
157
87
 
158
- if (!global.TextDecoder && global.require) {
159
- global.TextDecoder = require("util").TextDecoder;
88
+ if (!globalThis.TextDecoder) {
89
+ throw new Error("globalThis.TextDecoder is not available, polyfill required");
160
90
  }
161
- if (!global.TextDecoder) {
162
- throw new Error("global.TextDecoder is not available, polyfill required");
163
- }
164
-
165
-
166
- // Make sure Go sees the shadowed "fs" global
167
- const { fs } = global;
168
-
169
91
 
170
92
  const encoder = new TextEncoder("utf-8");
171
93
  const decoder = new TextDecoder("utf-8");
172
94
 
173
- global.Go = class {
95
+ globalThis.Go = class {
174
96
  constructor() {
175
97
  this.argv = ["js"];
176
98
  this.env = {};
@@ -545,7 +467,7 @@
545
467
  null,
546
468
  true,
547
469
  false,
548
- global,
470
+ globalThis,
549
471
  this,
550
472
  ];
551
473
  this._goRefCounts = new Array(this._values.length).fill(Infinity); // number of references that Go has to a JS value, indexed by reference id
@@ -554,7 +476,7 @@
554
476
  [null, 2],
555
477
  [true, 3],
556
478
  [false, 4],
557
- [global, 5],
479
+ [globalThis, 5],
558
480
  [this, 6],
559
481
  ]);
560
482
  this._idPool = []; // unused ids that have been garbage collected
@@ -629,36 +551,4 @@
629
551
  };
630
552
  }
631
553
  }
632
-
633
- if (
634
- typeof module !== "undefined" &&
635
- global.require &&
636
- global.require.main === module &&
637
- global.process &&
638
- global.process.versions &&
639
- !global.process.versions.electron
640
- ) {
641
- if (process.argv.length < 3) {
642
- console.error("usage: go_js_wasm_exec [wasm binary] [arguments]");
643
- process.exit(1);
644
- }
645
-
646
- const go = new Go();
647
- go.argv = process.argv.slice(2);
648
- go.env = Object.assign({ TMPDIR: require("os").tmpdir() }, process.env);
649
- go.exit = process.exit;
650
- WebAssembly.instantiate(fs.readFileSync(process.argv[2]), go.importObject).then((result) => {
651
- process.on("exit", (code) => { // Node.js exits if no event handler is pending
652
- if (code === 0 && !go.exited) {
653
- // deadlock, make Go print error and stack traces
654
- go._pendingEvent = { id: 0 };
655
- go._resume();
656
- }
657
- });
658
- return go.run(result.instance);
659
- }).catch((err) => {
660
- console.error(err);
661
- process.exit(1);
662
- });
663
- }
664
554
  })();
@@ -0,0 +1,49 @@
1
+ // Copyright 2021 The Go Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style
3
+ // license that can be found in the LICENSE file.
4
+
5
+ "use strict";
6
+
7
+ if (process.argv.length < 3) {
8
+ console.error("usage: go_js_wasm_exec [wasm binary] [arguments]");
9
+ process.exit(1);
10
+ }
11
+
12
+ globalThis.require = require;
13
+ globalThis.fs = require("fs");
14
+ globalThis.TextEncoder = require("util").TextEncoder;
15
+ globalThis.TextDecoder = require("util").TextDecoder;
16
+
17
+ globalThis.performance = {
18
+ now() {
19
+ const [sec, nsec] = process.hrtime();
20
+ return sec * 1000 + nsec / 1000000;
21
+ },
22
+ };
23
+
24
+ const crypto = require("crypto");
25
+ globalThis.crypto = {
26
+ getRandomValues(b) {
27
+ crypto.randomFillSync(b);
28
+ },
29
+ };
30
+
31
+ require("./wasm_exec");
32
+
33
+ const go = new Go();
34
+ go.argv = process.argv.slice(2);
35
+ go.env = Object.assign({ TMPDIR: require("os").tmpdir() }, process.env);
36
+ go.exit = process.exit;
37
+ WebAssembly.instantiate(fs.readFileSync(process.argv[2]), go.importObject).then((result) => {
38
+ process.on("exit", (code) => { // Node.js exits if no event handler is pending
39
+ if (code === 0 && !go.exited) {
40
+ // deadlock, make Go print error and stack traces
41
+ go._pendingEvent = { id: 0 };
42
+ go._resume();
43
+ }
44
+ });
45
+ return go.run(result.instance);
46
+ }).catch((err) => {
47
+ console.error(err);
48
+ process.exit(1);
49
+ });
data/package.json CHANGED
@@ -4,6 +4,6 @@
4
4
  "license": "MIT",
5
5
  "homepage": "https://github.com/isomorfeus/isomorfeus-asset-manager",
6
6
  "dependencies": {
7
- "esbuild-wasm": "0.14.23"
7
+ "esbuild-wasm": "0.14.36"
8
8
  }
9
9
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isomorfeus-asset-manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.21
4
+ version: 0.14.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Biedermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-28 00:00:00.000000000 Z
11
+ date: 2022-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: brotli
@@ -30,28 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.7.47
33
+ version: 0.7.49
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.7.47
40
+ version: 0.7.49
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: isomorfeus-speednode
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.5.2
47
+ version: 0.5.3
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.5.2
54
+ version: 0.5.3
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: listen
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -84,16 +84,22 @@ dependencies:
84
84
  name: opal
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: 1.4.0
90
+ - - "<"
88
91
  - !ruby/object:Gem::Version
89
- version: 1.4.1
92
+ version: 1.6.0
90
93
  type: :runtime
91
94
  prerelease: false
92
95
  version_requirements: !ruby/object:Gem::Requirement
93
96
  requirements:
94
- - - "~>"
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: 1.4.0
100
+ - - "<"
95
101
  - !ruby/object:Gem::Version
96
- version: 1.4.1
102
+ version: 1.6.0
97
103
  - !ruby/object:Gem::Dependency
98
104
  name: rack
99
105
  requirement: !ruby/object:Gem::Requirement
@@ -178,6 +184,7 @@ files:
178
184
  - node_modules/esbuild-wasm/lib/main.js
179
185
  - node_modules/esbuild-wasm/package.json
180
186
  - node_modules/esbuild-wasm/wasm_exec.js
187
+ - node_modules/esbuild-wasm/wasm_exec_node.js
181
188
  - package.json
182
189
  homepage: https://isomorfeus.com
183
190
  licenses: