@gjsify/resolve-npm 0.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/lib/index.d.ts ADDED
@@ -0,0 +1,33 @@
1
+ /** Array of Node.js build in module names */
2
+ export declare const EXTERNALS_NODE: string[];
3
+
4
+ /** Array of NPM module names for which we have our own implementation */
5
+ export declare const EXTERNALS_NPM: string[];
6
+
7
+ /** General record of modules for Gjs */
8
+ export declare const ALIASES_GENERAL_FOR_GJS: {[alias:string]: string};
9
+
10
+ /** Record of Node.js modules (build in or not) and his replacement for Gjs */
11
+ export declare const ALIASES_NODE_FOR_GJS: {[alias:string]: string};
12
+
13
+ /** Record of Web modules and his replacement for Gjs */
14
+ export declare const ALIASES_WEB_FOR_GJS: {[alias:string]: string};
15
+
16
+ /** General record of modules for Deno */
17
+ export declare const ALIASES_GENERAL_FOR_DENO: {[alias:string]: string};
18
+
19
+ /** Record of Gjs modules (build in or not) and his replacement for Deno */
20
+ export declare const ALIASES_GJS_FOR_DENO: {[alias:string]: string};
21
+
22
+ /** Record of Node.js modules (build in or not) and his replacement for Deno */
23
+ export declare const ALIASES_NODE_FOR_DENO: {[alias:string]: string};
24
+
25
+ /** General record of modules for Node */
26
+ export declare const ALIASES_GENERAL_FOR_NODE: {[alias:string]: string};
27
+
28
+ /** Record of Gjs modules (build in or not) and his replacement for Node */
29
+ export declare const ALIASES_GJS_FOR_NODE: {[alias:string]: string};
30
+
31
+ /** Record of Web modules and his replacement for Node */
32
+ export declare const ALIASES_WEB_FOR_NODE: {[alias:string]: string};
33
+
package/lib/index.mjs ADDED
@@ -0,0 +1,274 @@
1
+ /** Array of Node.js build in module names */
2
+ export const EXTERNALS_NODE = [
3
+ 'assert',
4
+ 'assert/strict',
5
+ 'async_hooks',
6
+ 'buffer',
7
+ 'child_process',
8
+ 'cluster',
9
+ 'console',
10
+ 'constants',
11
+ 'crypto',
12
+ 'dgram',
13
+ 'diagnostics_channel',
14
+ 'dns',
15
+ 'dns/promises',
16
+ 'domain',
17
+ 'events',
18
+ 'fs',
19
+ 'fs/promises',
20
+ 'http',
21
+ 'http2',
22
+ 'https',
23
+ 'inspector',
24
+ 'module',
25
+ 'net',
26
+ 'os',
27
+ 'path',
28
+ 'path/common',
29
+ 'path/glob',
30
+ 'path/posix',
31
+ 'path/separator',
32
+ 'path/win32',
33
+ 'perf_hooks',
34
+ 'process',
35
+ 'punycode',
36
+ 'querystring',
37
+ 'readline',
38
+ 'readline/promises',
39
+ 'repl',
40
+ 'stream',
41
+ 'stream/web',
42
+ 'stream/consumers',
43
+ 'stream/promises',
44
+ 'string_decoder',
45
+ 'sys',
46
+ 'test',
47
+ 'timers',
48
+ 'timers/promises',
49
+ 'tls',
50
+ 'tty',
51
+ 'url',
52
+ 'util',
53
+ 'util/types',
54
+ 'v8',
55
+ 'vm',
56
+ 'wasi',
57
+ 'worker_threads',
58
+ 'zlib',
59
+ ]
60
+
61
+ /** Array of NPM module names for which we have our own implementation */
62
+ export const EXTERNALS_NPM = [
63
+ 'readable-stream',
64
+ 'node-fetch'
65
+ ]
66
+
67
+ /** General record of modules for Gjs */
68
+ export const ALIASES_GENERAL_FOR_GJS = {}
69
+
70
+ /** Record of Node.js modules (build in or not) and his replacement for Gjs */
71
+ export const ALIASES_NODE_FOR_GJS = {
72
+ // Internal Node.js modules
73
+ 'assert': '@gjsify/assert',
74
+ 'assert/strict': '@gjsify/assert/strict',
75
+ 'async_hooks': '@gjsify/deno_std/node/async_hooks', // TODO
76
+ 'buffer': '@gjsify/buffer',
77
+ 'child_process': '@gjsify/deno_std/node/child_process', // TODO
78
+ 'cluster': '@gjsify/deno_std/node/cluster', // TODO
79
+ 'console': '@gjsify/console',
80
+ 'constants': '@gjsify/deno_std/node/constants', // TODO
81
+ 'crypto': '@gjsify/deno_std/node/crypto', // TODO
82
+ 'dgram': '@gjsify/deno_std/node/dgram', // TODO
83
+ 'diagnostics_channel': '@gjsify/deno_std/node/diagnostics_channel', // TODO
84
+ 'dns': '@gjsify/deno_std/node/dns', // TODO
85
+ 'dns/promises': '@gjsify/deno_std/node/dns/promises', // TODO
86
+ 'domain': '@gjsify/deno_std/node/domain', // TODO
87
+ 'events': '@gjsify/events',
88
+ 'fs': '@gjsify/fs',
89
+ 'fs/promises': '@gjsify/fs/promises',
90
+ 'http': '@gjsify/http',
91
+ 'http2': '@gjsify/deno_std/node/http2', // TODO
92
+ 'https': '@gjsify/deno_std/node/https', // TODO
93
+ 'inspector': '@gjsify/deno_std/node/inspector', // TODO
94
+ 'module': '@gjsify/deno_std/node/module', // TODO
95
+ 'net': '@gjsify/net',
96
+ 'os': '@gjsify/os',
97
+ 'path': '@gjsify/deno_std/node/path', // TODO
98
+ 'path/common': '@gjsify/deno_std/node/path/common', // TODO
99
+ 'path/glob': '@gjsify/deno_std/node/path/glob', // TODO
100
+ 'path/posix': '@gjsify/deno_std/node/path/posix', // TODO
101
+ 'path/separator': '@gjsify/deno_std/node/path/separator', // TODO
102
+ 'path/win32': '@gjsify/deno_std/node/path/win32', // TODO
103
+ 'perf_hooks': '@gjsify/deno_std/node/perf_hooks', // TODO
104
+ 'process': '@gjsify/process',
105
+ 'punycode': '@gjsify/deno_std/node/punycode', // TODO
106
+ 'querystring': '@gjsify/querystring',
107
+ 'readline': '@gjsify/deno_std/node/readline', // TODO
108
+ 'readline/promises': '@gjsify/deno_std/node/readline/promises', // TODO
109
+ 'repl': '@gjsify/deno_std/node/repl', // TODO
110
+ 'stream': '@gjsify/stream',
111
+ 'stream/web': '@gjsify/stream/web',
112
+ 'stream/consumers': '@gjsify/stream/consumers', // TODO
113
+ 'stream/promises': '@gjsify/stream/promises', // TODO
114
+ 'string_decoder': '@gjsify/deno_std/node/string_decoder', // TODO
115
+ 'sys': '@gjsify/deno_std/node/sys', // TODO
116
+ // 'test': '@gjsify/deno_std/node/test', // TODO
117
+ 'timers': '@gjsify/deno_std/node/timers', // TODO
118
+ 'timers/promises': '@gjsify/deno_std/node/timers/promises', // TODO
119
+ 'tls': '@gjsify/deno_std/node/tls', // TODO
120
+ 'tty': '@gjsify/tty',
121
+ 'url': '@gjsify/url',
122
+ 'util': '@gjsify/util',
123
+ 'util/types': '@gjsify/util/types',
124
+ 'v8': '@gjsify/deno_std/node/v8', // TODO
125
+ 'vm': '@gjsify/deno_std/node/vm', // TODO
126
+ 'wasi': '@gjsify/deno_std/node/wasi', // TODO
127
+ 'worker_threads': '@gjsify/deno_std/node/worker_threads', // TODO
128
+ 'zlib': '@gjsify/zlib',
129
+
130
+
131
+
132
+ // 'cluster': '@gjsify/deno_std/node/cluster',
133
+ // 'domain': '@gjsify/deno_std/node/domain',
134
+ // 'stream': '@gjsify/deno_std/node/stream',
135
+ // 'assertion_error': '@gjsify/deno_std/node/assertion_error',
136
+ // 'console': '@@gjsify/deno_std/nodeconsole',
137
+ // 'module': '@gjsify/deno_std/node/module',
138
+ // 'v8': '@gjsify/deno_std/node/v8',
139
+ // assert: 'assert', // https://github.com/browserify/commonjs-assert
140
+ // constants: 'constants-browserify', // https://github.com/juliangruber/constants-browserify
141
+ // punycode: 'punycode',
142
+ // string_decoder: 'string_decoder', // https://github.com/nodejs/string_decoder
143
+ // 'async_hooks': '@gjsify/deno_std/node/async_hooks',
144
+ // 'sys': '@gjsify/deno_std/node/sys',
145
+ // 'vm': '@gjsify/deno_std/node/vm',
146
+ // 'upstream_modules': '@gjsify/deno_std/node/upstream_modules',
147
+ // 'wasi': '@gjsify/deno_std/node/wasi',
148
+ // crypto: 'crypto-browserify',
149
+ // 'inspector': '@gjsify/deno_std/node/inspector',
150
+ // 'timers': '@gjsify/deno_std/node/timers',
151
+ // 'dgram': '@gjsify/deno_std/node/dgram',
152
+ // path: 'path-browserify',
153
+ // 'readline': '@gjsify/deno_std/node/readline',
154
+ // 'worker_threads': '@gjsify/deno_std/node/worker_threads',
155
+ // 'diagnostics_channel': '@gjsify/deno_std/node/diagnostics_channel',
156
+ // 'http2': '@gjsify/deno_std/node/http2',
157
+ // 'module_all': '@gjsify/deno_std/node/module_all',
158
+ // 'repl': '@gjsify/deno_std/node/repl',
159
+ // 'child_process': '@gjsify/deno_std/node/child_process',
160
+ // 'dns': '@gjsify/deno_std/node/dns',
161
+ // 'module_esm': '@gjsify/deno_std/node/module_esm',
162
+ // 'perf_hooks': '@gjsify/deno_std/node/perf_hooks',
163
+ // 'tls': '@gjsify/deno_std/node/tls',
164
+
165
+ // Third party Node Modules
166
+ 'node-fetch': '@gjsify/fetch',
167
+ }
168
+
169
+ /** Record of Web modules and his replacement for Gjs */
170
+ export const ALIASES_WEB_FOR_GJS = {
171
+ 'abort-controller': '@gjsify/abort-controller',
172
+ 'event-target-shim': '@gjsify/dom-events',
173
+ }
174
+
175
+ /** General record of modules for Deno */
176
+ export const ALIASES_GENERAL_FOR_DENO = {
177
+ '@gjsify/deno-runtime/globals': '@gjsify/empty',
178
+ '@gjsify/deno-globals': '@gjsify/empty',
179
+ }
180
+
181
+ /** Record of Node.js modules (build in or not) and his replacement for Deno */
182
+ export const ALIASES_NODE_FOR_DENO = {
183
+ // Node packages
184
+ // TODO std@0.177.0 is the latest version that has the node directory
185
+ 'assert': 'https://deno.land/std@0.177.0/node/assert.ts',
186
+ 'assert/strict': 'https://deno.land/std@0.177.0/node/assert/strict.ts',
187
+ 'async_hooks': 'https://deno.land/std@0.177.0/node/async_hooks.ts',
188
+ 'buffer': 'https://deno.land/std@0.177.0/node/buffer.ts',
189
+ 'child_process': 'https://deno.land/std@0.177.0/node/child_process.ts',
190
+ 'cluster': 'https://deno.land/std@0.177.0/node/cluster.ts',
191
+ 'console': 'https://deno.land/std@0.177.0/node/console.ts',
192
+ 'constants': 'https://deno.land/std@0.177.0/node/constants.ts',
193
+ 'crypto': 'https://deno.land/std@0.177.0/node/crypto.ts',
194
+ 'dgram': 'https://deno.land/std@0.177.0/node/dgram.ts',
195
+ 'diagnostics_channel': 'https://deno.land/std@0.177.0/node/diagnostics_channel.ts',
196
+ 'dns': 'https://deno.land/std@0.177.0/node/dns.ts',
197
+ 'dns/promises': 'https://deno.land/std@0.177.0/node/dns/promises.ts',
198
+ 'domain': 'https://deno.land/std@0.177.0/node/domain.ts',
199
+ 'events': 'https://deno.land/std@0.177.0/node/events.ts',
200
+ 'fs': 'https://deno.land/std@0.177.0/node/fs.ts',
201
+ 'fs/promises': 'https://deno.land/std@0.177.0/node/fs/promises.ts',
202
+ 'http': 'https://deno.land/std@0.177.0/node/http.ts',
203
+ 'http2': 'https://deno.land/std@0.177.0/node/http2.ts',
204
+ 'https': 'https://deno.land/std@0.177.0/node/https.ts',
205
+ 'inspector': 'https://deno.land/std@0.177.0/node/inspector.ts',
206
+ 'module': 'https://deno.land/std@0.177.0/node/module.ts',
207
+ 'net': 'https://deno.land/std@0.177.0/node/net.ts',
208
+ 'os': 'https://deno.land/std@0.177.0/node/os.ts',
209
+ 'path': 'https://deno.land/std@0.177.0/node/path.ts',
210
+ 'path/common': 'https://deno.land/std@0.177.0/node/path/common.ts',
211
+ 'path/glob': 'https://deno.land/std@0.177.0/node/path/glob.ts',
212
+ 'path/posix': 'https://deno.land/std@0.177.0/node/path/posix.ts',
213
+ 'path/separator': 'https://deno.land/std@0.177.0/node/path/separator.ts',
214
+ 'path/win32': 'https://deno.land/std@0.177.0/node/path/win32.ts',
215
+ 'perf_hooks': 'https://deno.land/std@0.177.0/node/perf_hooks.ts',
216
+ 'process': 'https://deno.land/std@0.177.0/node/process.ts',
217
+ 'punycode': 'https://deno.land/std@0.177.0/node/punycode.ts',
218
+ 'querystring': 'https://deno.land/std@0.177.0/node/querystring.ts',
219
+ 'readline': 'https://deno.land/std@0.177.0/node/readline.ts',
220
+ 'readline/promises': 'https://deno.land/std@0.177.0/node/readline/promises.ts',
221
+ 'repl': 'https://deno.land/std@0.177.0/node/repl.ts',
222
+ 'stream': 'https://deno.land/std@0.177.0/node/stream.ts',
223
+ 'stream/web': 'https://deno.land/std@0.177.0/node/stream/web.ts',
224
+ 'stream/consumers': 'https://deno.land/std@0.177.0/node/stream/consumers.mjs',
225
+ 'stream/promises': 'https://deno.land/std@0.177.0/node/stream/promises.mjs',
226
+ 'string_decoder': 'https://deno.land/std@0.177.0/node/string_decoder.ts',
227
+ 'sys': 'https://deno.land/std@0.177.0/node/sys.ts',
228
+ // 'test': 'https://deno.land/std@0.177.0/node/test.ts',
229
+ 'timers': 'https://deno.land/std@0.177.0/node/timers.ts',
230
+ 'timers/promises': 'https://deno.land/std@0.177.0/node/timers/promises.ts',
231
+ 'tls': 'https://deno.land/std@0.177.0/node/tls.ts',
232
+ 'tty': 'https://deno.land/std@0.177.0/node/tty.ts',
233
+ 'url': 'https://deno.land/std@0.177.0/node/url.ts',
234
+ 'util': 'https://deno.land/std@0.177.0/node/util.ts',
235
+ 'util/types': 'https://deno.land/std@0.177.0/node/util/types.ts',
236
+ 'v8': 'https://deno.land/std@0.177.0/node/v8.ts',
237
+ 'vm': 'https://deno.land/std@0.177.0/node/vm.ts',
238
+ 'wasi': 'https://deno.land/std@0.177.0/node/wasi.ts',
239
+ 'worker_threads': 'https://deno.land/std@0.177.0/node/worker_threads.ts',
240
+ 'zlib': 'https://deno.land/std@0.177.0/node/zlib.ts',
241
+ }
242
+
243
+ /** Record of Gjs modules (build in or not) and his replacement for Deno */
244
+ export const ALIASES_GJS_FOR_DENO = {
245
+ '@gjsify/node-globals': 'https://deno.land/std@0.177.0/node/global.ts',
246
+ }
247
+
248
+ /** Record of Web modules and his replacement for Deno */
249
+ export const ALIASES_WEB_FOR_DENO = {}
250
+
251
+
252
+ /** General record of modules for Node */
253
+ export const ALIASES_GENERAL_FOR_NODE = {
254
+ '@gjsify/node-globals': '@gjsify/empty',
255
+ '@gjsify/require': '@gjsify/empty',
256
+
257
+ // TODO we need a real replacement for this in the future
258
+ '@gjsify/deno-runtime/globals': '@gjsify/empty',
259
+ '@gjsify/deno-globals': '@gjsify/empty',
260
+ }
261
+
262
+ /** Record of Gjs modules (build in or not) and his replacement for Node */
263
+ const ALIASES_GJS_FOR_NODE = {}
264
+
265
+ // Revert the alias
266
+ for (const ALIAS_NODE_FOR_GJS in ALIASES_NODE_FOR_GJS) {
267
+ ALIASES_GJS_FOR_NODE[ALIASES_NODE_FOR_GJS[ALIAS_NODE_FOR_GJS]] = ALIAS_NODE_FOR_GJS
268
+ }
269
+
270
+ export { ALIASES_GJS_FOR_NODE };
271
+
272
+ /** Record of Web modules and his replacement for Node */
273
+ export const ALIASES_WEB_FOR_NODE = {}
274
+
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@gjsify/resolve-npm",
3
+ "version": "0.0.2",
4
+ "description": "Resolve NPM package aliases",
5
+ "type": "module",
6
+ "main": "lib/index.mjs",
7
+ "module": "lib/index.mjs",
8
+ "types": "lib/index.d.ts",
9
+ "scripts": {
10
+ "clear": "echo 'nothing to do'",
11
+ "test": "yarn print:name && echo 'nothing to do'",
12
+ "print:name": "echo '@gjsify/resolve-npm'",
13
+ "build": "yarn print:name && echo 'nothing to do'"
14
+ },
15
+ "keywords": [
16
+ "gjs",
17
+ "node",
18
+ "npm",
19
+ "alias"
20
+ ]
21
+ }