isomorfeus-asset-manager 0.14.19 → 0.14.22
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.
- checksums.yaml +4 -4
- data/lib/isomorfeus/asset_manager/browser_asset.rb +5 -0
- data/lib/isomorfeus/asset_manager/config.rb +1 -1
- data/lib/isomorfeus/asset_manager/node_asset.rb +1 -1
- data/lib/isomorfeus/asset_manager/version.rb +1 -1
- data/lib/isomorfeus/asset_manager.rb +6 -15
- data/node_modules/.package-lock.json +18 -18
- data/node_modules/esbuild-wasm/bin/esbuild +37 -5
- data/node_modules/esbuild-wasm/esbuild.wasm +0 -0
- data/node_modules/esbuild-wasm/esm/browser.d.ts +13 -1
- data/node_modules/esbuild-wasm/esm/browser.js +625 -744
- data/node_modules/esbuild-wasm/esm/browser.min.js +14 -7
- data/node_modules/esbuild-wasm/exit0.js +2 -0
- data/node_modules/esbuild-wasm/lib/browser.d.ts +13 -1
- data/node_modules/esbuild-wasm/lib/browser.js +654 -756
- data/node_modules/esbuild-wasm/lib/browser.min.js +13 -6
- data/node_modules/esbuild-wasm/lib/main.d.ts +13 -1
- data/node_modules/esbuild-wasm/lib/main.js +57 -43
- data/node_modules/esbuild-wasm/package.json +1 -1
- data/node_modules/esbuild-wasm/wasm_exec.js +17 -127
- data/node_modules/esbuild-wasm/wasm_exec_node.js +49 -0
- data/package.json +1 -1
- metadata +17 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e208b674f5b5ed724db1be5c74054c92d4b2468faea3a30267f528f36c1bb9ce
|
4
|
+
data.tar.gz: 03201b0049a608178c9a7d550749556de94ad9e9382eca635f18694ed5debd51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff78d031bde9dc60794d00abd392449f6acee64845d9ba5270749dcea6fbe89c680da79c5a46975db1ff16f6c036b525f330c1fd211fc0462f842cf29cdc102c
|
7
|
+
data.tar.gz: 2088239fe557d25847360d8e5348d0052f72176384bd22492e1222569286a9c196f53284dd895c9ce46fdc93bc13c0faf045aa9bd7d72db4637c45d0a10c66d0
|
@@ -94,6 +94,11 @@ module Isomorfeus
|
|
94
94
|
catch { console.log('Isomorfeus Asset Manager could not update locale ', update.locale) }
|
95
95
|
return;
|
96
96
|
}
|
97
|
+
if (typeof update.reload !== 'undefined') {
|
98
|
+
console.log('Isomorfeus Asset Manager reloading page, updating javascript import ', update.reload);
|
99
|
+
setTimeout(function() { window.location.reload(true); }, 500);
|
100
|
+
return;
|
101
|
+
}
|
97
102
|
let start_index = 'Opal.modules[\\"'.length;
|
98
103
|
let end_index = update.javascript.indexOf('"', start_index);
|
99
104
|
let opal_module_name = update.javascript.substr(start_index, end_index - start_index);
|
@@ -78,7 +78,7 @@ module Isomorfeus
|
|
78
78
|
|
79
79
|
self.hmr_listener = nil
|
80
80
|
self.asset_manager_hmr_channel = :isomorfeus_asset_manager_module_updates
|
81
|
-
self.asset_manager_hmr_dirs = %w[channels components data locales operations policies]
|
81
|
+
self.asset_manager_hmr_dirs = %w[channels components data imports locales mail_components operations policies server]
|
82
82
|
self.hmr_websocket_path = '/_asset_manager_hmr_websocket'
|
83
83
|
self.assets_path = '/assets'
|
84
84
|
self.assets = {
|
@@ -49,7 +49,7 @@ module Isomorfeus
|
|
49
49
|
def generate_entry(asset_name)
|
50
50
|
js = ''
|
51
51
|
js << "#{@js_imports.map(&:to_s).join("\n")}"
|
52
|
-
js << "#{@ruby_imports.map { |i| i.to_s(asset_name) }.join(
|
52
|
+
js << "#{@ruby_imports.map { |i| i.to_s(asset_name) }.join('')}"
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
@@ -78,22 +78,10 @@ module Isomorfeus
|
|
78
78
|
{ javascript: compiler.compile }
|
79
79
|
end
|
80
80
|
|
81
|
-
def print_message(m, level)
|
82
|
-
l = m['location']
|
83
|
-
STDERR.puts "#{l['file']}:#{l['line']}:#{l['column']}: #{level}: #{m['text']}"
|
84
|
-
STDERR.puts " #{l['line']} | #{l['lineText']}\n\n"
|
85
|
-
end
|
86
81
|
|
87
82
|
def handle_errors(asset_key, result)
|
88
|
-
|
89
|
-
|
90
|
-
print_message(e, 'error')
|
91
|
-
unless e['notes'].empty?
|
92
|
-
e['notes'].each do |n|
|
93
|
-
print_message(n, 'note')
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
83
|
+
result = result['result']
|
84
|
+
if result && !(result['errors'].nil? || result['errors'].empty?)
|
97
85
|
raise "Asset Manager: error bundling '#{asset_key}'"
|
98
86
|
end
|
99
87
|
end
|
@@ -137,6 +125,9 @@ module Isomorfeus
|
|
137
125
|
elsif file.end_with?('.yml') || file.end_with?('.mo') || file.end_with?('.po')
|
138
126
|
Isomorfeus.server_requires_reload!
|
139
127
|
update_json = Oj.dump({ locale: file }, mode: :strict)
|
128
|
+
elsif file.end_with?('.js')
|
129
|
+
Isomorfeus.assets.each_value { |asset| asset.unbundle! }
|
130
|
+
update_json = Oj.dump({ reload: file }, mode: :strict)
|
140
131
|
else
|
141
132
|
update_json = Oj.dump({ error: "Don't know how to update #{file}!" }, mode: :strict)
|
142
133
|
end
|
@@ -177,7 +168,7 @@ module Isomorfeus
|
|
177
168
|
target: '#{asset.browser? ? 'es6' : 'node16' }',
|
178
169
|
write: true
|
179
170
|
})
|
180
|
-
.then((result) => { global.res_meta = result.metafile; return result; }, (reason) => { return { result: { errors: [{text:
|
171
|
+
.then((result) => { global.res_meta = result.metafile; return result; }, (reason) => { return { result: { errors: [{text: reason}]}}; })
|
181
172
|
.catch((error) => { return { result: { errors: [{text: error.message}]}}; });
|
182
173
|
JAVASCRIPT
|
183
174
|
if analyze
|
@@ -1,18 +1,18 @@
|
|
1
|
-
{
|
2
|
-
"name": "isomorfeus-asset-manager",
|
3
|
-
"lockfileVersion": 2,
|
4
|
-
"requires": true,
|
5
|
-
"packages": {
|
6
|
-
"node_modules/esbuild-wasm": {
|
7
|
-
"version": "0.14.
|
8
|
-
"resolved": "https://registry.npmjs.org/esbuild-wasm/-/esbuild-wasm-0.14.
|
9
|
-
"integrity": "sha512-
|
10
|
-
"bin": {
|
11
|
-
"esbuild": "bin/esbuild"
|
12
|
-
},
|
13
|
-
"engines": {
|
14
|
-
"node": ">=12"
|
15
|
-
}
|
16
|
-
}
|
17
|
-
}
|
18
|
-
}
|
1
|
+
{
|
2
|
+
"name": "isomorfeus-asset-manager",
|
3
|
+
"lockfileVersion": 2,
|
4
|
+
"requires": true,
|
5
|
+
"packages": {
|
6
|
+
"node_modules/esbuild-wasm": {
|
7
|
+
"version": "0.14.36",
|
8
|
+
"resolved": "https://registry.npmjs.org/esbuild-wasm/-/esbuild-wasm-0.14.36.tgz",
|
9
|
+
"integrity": "sha512-tDMs2l397fd/pwLoIKb4uYfQayM5hMfUwVvCmzbFEU+zXedj15/Z/A8iD87cWHN1VD66REdgcGMt1BO6C7RnLw==",
|
10
|
+
"bin": {
|
11
|
+
"esbuild": "bin/esbuild"
|
12
|
+
},
|
13
|
+
"engines": {
|
14
|
+
"node": ">=12"
|
15
|
+
}
|
16
|
+
}
|
17
|
+
}
|
18
|
+
}
|
@@ -2,17 +2,18 @@
|
|
2
2
|
|
3
3
|
// Forward to the automatically-generated WebAssembly loader from the Go compiler
|
4
4
|
|
5
|
+
const module_ = require('module');
|
5
6
|
const crypto = require('crypto');
|
6
7
|
const path = require('path');
|
7
8
|
const zlib = require('zlib');
|
8
9
|
const fs = require('fs');
|
9
10
|
const os = require('os');
|
10
11
|
|
11
|
-
const
|
12
|
+
const wasm_exec_node = path.join(__dirname, '..', 'wasm_exec_node.js');
|
12
13
|
const esbuild_wasm = path.join(__dirname, '..', 'esbuild.wasm');
|
13
14
|
|
14
|
-
const code = fs.readFileSync(
|
15
|
-
const wrapper = new Function('require', '
|
15
|
+
const code = fs.readFileSync(wasm_exec_node, 'utf8');
|
16
|
+
const wrapper = new Function('require', 'WebAssembly', code);
|
16
17
|
|
17
18
|
function instantiate(bytes, importObject) {
|
18
19
|
// Using this API causes "./esbuild --version" to run around 1 second faster
|
@@ -80,6 +81,37 @@ fs.read = function () {
|
|
80
81
|
return read.apply(this, arguments);
|
81
82
|
};
|
82
83
|
|
84
|
+
// Hack around a Unicode bug in node: https://github.com/nodejs/node/issues/24550.
|
85
|
+
// See this for the matching Go issue: https://github.com/golang/go/issues/43917.
|
86
|
+
const write = fs.write;
|
87
|
+
fs.write = function (fd, buf, offset, length, position, callback) {
|
88
|
+
if (offset === 0 && length === buf.length && position === null) {
|
89
|
+
if (fd === process.stdout.fd) {
|
90
|
+
try {
|
91
|
+
process.stdout.write(buf, err => err ? callback(err, 0, null) : callback(null, length, buf));
|
92
|
+
} catch (err) {
|
93
|
+
callback(err, 0, null);
|
94
|
+
}
|
95
|
+
return;
|
96
|
+
}
|
97
|
+
if (fd === process.stderr.fd) {
|
98
|
+
try {
|
99
|
+
process.stderr.write(buf, err => err ? callback(err, 0, null) : callback(null, length, buf));
|
100
|
+
} catch (err) {
|
101
|
+
callback(err, 0, null);
|
102
|
+
}
|
103
|
+
return;
|
104
|
+
}
|
105
|
+
}
|
106
|
+
return write.apply(this, arguments);
|
107
|
+
};
|
108
|
+
const writeSync = fs.writeSync;
|
109
|
+
fs.writeSync = function (fd, buf) {
|
110
|
+
if (fd === process.stdout.fd) return process.stdout.write(buf), buf.length;
|
111
|
+
if (fd === process.stderr.fd) return process.stderr.write(buf), buf.length;
|
112
|
+
return writeSync.apply(this, arguments);
|
113
|
+
};
|
114
|
+
|
83
115
|
// WASM code generated with Go 1.17.2+ will crash when run in a situation with
|
84
116
|
// many environment variables: https://github.com/golang/go/issues/49011. An
|
85
117
|
// example of this situation is running a Go-compiled WASM executable in GitHub
|
@@ -97,5 +129,5 @@ for (let key in process.env) {
|
|
97
129
|
}
|
98
130
|
}
|
99
131
|
|
100
|
-
|
101
|
-
wrapper(
|
132
|
+
process.argv.splice(2, 0, esbuild_wasm);
|
133
|
+
wrapper(module_.createRequire(wasm_exec_node), Object.assign(Object.create(WebAssembly), { instantiate }));
|
Binary file
|
@@ -7,7 +7,7 @@ export type Drop = 'console' | 'debugger';
|
|
7
7
|
|
8
8
|
interface CommonOptions {
|
9
9
|
/** Documentation: https://esbuild.github.io/api/#sourcemap */
|
10
|
-
sourcemap?: boolean | 'inline' | 'external' | 'both';
|
10
|
+
sourcemap?: boolean | 'linked' | 'inline' | 'external' | 'both';
|
11
11
|
/** Documentation: https://esbuild.github.io/api/#legal-comments */
|
12
12
|
legalComments?: 'none' | 'inline' | 'eof' | 'linked' | 'external';
|
13
13
|
/** Documentation: https://esbuild.github.io/api/#source-root */
|
@@ -27,6 +27,8 @@ interface CommonOptions {
|
|
27
27
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
28
28
|
reserveProps?: RegExp;
|
29
29
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
30
|
+
mangleQuoted?: boolean;
|
31
|
+
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
30
32
|
mangleCache?: Record<string, string | false>;
|
31
33
|
/** Documentation: https://esbuild.github.io/api/#drop */
|
32
34
|
drop?: Drop[];
|
@@ -569,6 +571,16 @@ export interface InitializeOptions {
|
|
569
571
|
*/
|
570
572
|
wasmURL?: string
|
571
573
|
|
574
|
+
/**
|
575
|
+
* The result of calling "new WebAssembly.Module(buffer)" where "buffer"
|
576
|
+
* is a typed array or ArrayBuffer containing the binary code of the
|
577
|
+
* "esbuild.wasm" file.
|
578
|
+
*
|
579
|
+
* You can use this as an alternative to "wasmURL" for environments where it's
|
580
|
+
* not possible to download the WebAssembly module.
|
581
|
+
*/
|
582
|
+
wasmModule?: WebAssembly.Module
|
583
|
+
|
572
584
|
/**
|
573
585
|
* By default esbuild runs the WebAssembly-based browser API in a web worker
|
574
586
|
* to avoid blocking the UI thread. This can be disabled by setting "worker"
|