@lynx-js/rspeedy 0.8.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/CHANGELOG.md +208 -0
- package/LICENSE +202 -0
- package/README.md +32 -0
- package/bin/rspeedy.js +33 -0
- package/client/hmr/WebSocketClient.js +65 -0
- package/client.d.ts +5 -0
- package/lib/api.d.ts +46 -0
- package/lib/api.js +2 -0
- package/lib/cli/build.d.ts +4 -0
- package/lib/cli/build.js +32 -0
- package/lib/cli/commands.d.ts +5 -0
- package/lib/cli/commands.js +45 -0
- package/lib/cli/dev.d.ts +4 -0
- package/lib/cli/dev.js +75 -0
- package/lib/cli/exit.d.ts +1 -0
- package/lib/cli/exit.js +51 -0
- package/lib/cli/inspect.d.ts +8 -0
- package/lib/cli/inspect.js +30 -0
- package/lib/cli/main.d.ts +1 -0
- package/lib/cli/main.js +39 -0
- package/lib/cli/preview.d.ts +4 -0
- package/lib/cli/preview.js +31 -0
- package/lib/cli/start.d.ts +6 -0
- package/lib/cli/start.js +88 -0
- package/lib/config/defaults.d.ts +2 -0
- package/lib/config/defaults.js +32 -0
- package/lib/config/defineConfig.d.ts +22 -0
- package/lib/config/defineConfig.js +24 -0
- package/lib/config/dev/client.d.ts +15 -0
- package/lib/config/dev/client.js +2 -0
- package/lib/config/dev/index.d.ts +133 -0
- package/lib/config/dev/index.js +2 -0
- package/lib/config/index.d.ts +172 -0
- package/lib/config/index.js +2 -0
- package/lib/config/loadConfig.d.ts +50 -0
- package/lib/config/loadConfig.js +98 -0
- package/lib/config/output/css-modules.d.ts +84 -0
- package/lib/config/output/css-modules.js +2 -0
- package/lib/config/output/dist-path.d.ts +68 -0
- package/lib/config/output/dist-path.js +2 -0
- package/lib/config/output/filename.d.ts +167 -0
- package/lib/config/output/filename.js +2 -0
- package/lib/config/output/index.d.ts +320 -0
- package/lib/config/output/index.js +2 -0
- package/lib/config/output/minify.d.ts +80 -0
- package/lib/config/output/minify.js +2 -0
- package/lib/config/output/source-map.d.ts +68 -0
- package/lib/config/output/source-map.js +2 -0
- package/lib/config/performance/chunk-split.d.ts +192 -0
- package/lib/config/performance/chunk-split.js +2 -0
- package/lib/config/performance/index.d.ts +50 -0
- package/lib/config/performance/index.js +2 -0
- package/lib/config/rsbuild/entry.d.ts +3 -0
- package/lib/config/rsbuild/entry.js +31 -0
- package/lib/config/rsbuild/index.d.ts +4 -0
- package/lib/config/rsbuild/index.js +70 -0
- package/lib/config/server/index.d.ts +47 -0
- package/lib/config/server/index.js +2 -0
- package/lib/config/source/decorators.d.ts +43 -0
- package/lib/config/source/decorators.js +2 -0
- package/lib/config/source/entry.d.ts +84 -0
- package/lib/config/source/entry.js +2 -0
- package/lib/config/source/index.d.ts +474 -0
- package/lib/config/source/index.js +2 -0
- package/lib/config/source/transformImport.d.ts +106 -0
- package/lib/config/source/transformImport.js +2 -0
- package/lib/config/tools/css-extract.d.ts +72 -0
- package/lib/config/tools/css-extract.js +2 -0
- package/lib/config/tools/css-loader.d.ts +130 -0
- package/lib/config/tools/css-loader.js +2 -0
- package/lib/config/tools/index.d.ts +170 -0
- package/lib/config/tools/index.js +2 -0
- package/lib/config/validate.d.ts +4 -0
- package/lib/config/validate.js +28962 -0
- package/lib/create-rspeedy.d.ts +45 -0
- package/lib/create-rspeedy.js +48 -0
- package/lib/debug.d.ts +3 -0
- package/lib/debug.js +25 -0
- package/lib/index.d.ts +45 -0
- package/lib/index.js +10 -0
- package/lib/plugins/api.plugin.d.ts +3 -0
- package/lib/plugins/api.plugin.js +25 -0
- package/lib/plugins/chunkLoading.plugin.d.ts +2 -0
- package/lib/plugins/chunkLoading.plugin.js +30 -0
- package/lib/plugins/dev.plugin.d.ts +5 -0
- package/lib/plugins/dev.plugin.js +130 -0
- package/lib/plugins/index.d.ts +3 -0
- package/lib/plugins/index.js +49 -0
- package/lib/plugins/inspect.plugin.d.ts +4 -0
- package/lib/plugins/inspect.plugin.js +39 -0
- package/lib/plugins/minify.plugin.d.ts +3 -0
- package/lib/plugins/minify.plugin.js +89 -0
- package/lib/plugins/optimization.plugin.d.ts +2 -0
- package/lib/plugins/optimization.plugin.js +31 -0
- package/lib/plugins/output.plugin.d.ts +3 -0
- package/lib/plugins/output.plugin.js +34 -0
- package/lib/plugins/resolve.plugin.d.ts +2 -0
- package/lib/plugins/resolve.plugin.js +38 -0
- package/lib/plugins/rsdoctor.plugin.d.ts +3 -0
- package/lib/plugins/rsdoctor.plugin.js +41 -0
- package/lib/plugins/sourcemap.plugin.d.ts +2 -0
- package/lib/plugins/sourcemap.plugin.js +84 -0
- package/lib/plugins/stats.plugin.d.ts +2 -0
- package/lib/plugins/stats.plugin.js +20 -0
- package/lib/plugins/swc.plugin.d.ts +2 -0
- package/lib/plugins/swc.plugin.js +21 -0
- package/lib/plugins/target.plugin.d.ts +2 -0
- package/lib/plugins/target.plugin.js +12 -0
- package/lib/utils/getESVersionTarget.d.ts +1 -0
- package/lib/utils/getESVersionTarget.js +7 -0
- package/lib/utils/is-ci.d.ts +1 -0
- package/lib/utils/is-ci.js +7 -0
- package/lib/version.d.ts +4 -0
- package/lib/version.js +15 -0
- package/lib/webpack/CompilationIdPlugin.d.ts +4 -0
- package/lib/webpack/CompilationIdPlugin.js +20 -0
- package/lib/webpack/EvalSourceMapDevToolPlugin.d.ts +9 -0
- package/lib/webpack/EvalSourceMapDevToolPlugin.js +15 -0
- package/lib/webpack/ProvidePlugin.d.ts +9 -0
- package/lib/webpack/ProvidePlugin.js +15 -0
- package/lib/webpack/SourceMapDevToolPlugin.d.ts +9 -0
- package/lib/webpack/SourceMapDevToolPlugin.js +15 -0
- package/package.json +83 -0
- package/register/data.d.ts +9 -0
- package/register/hooks.js +146 -0
- package/register/index.d.ts +4 -0
- package/register/index.js +47 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Copyright 2024 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
|
|
5
|
+
// Copyright 2024 Bloomberg Finance L.P.
|
|
6
|
+
// Distributed under the terms of the Apache 2.0 license.
|
|
7
|
+
|
|
8
|
+
import module from 'node:module'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Register the ESM loader for TypeScript.
|
|
12
|
+
*
|
|
13
|
+
* @returns {() => void} - The `unregister` function.
|
|
14
|
+
*/
|
|
15
|
+
export function register() {
|
|
16
|
+
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
|
17
|
+
if (!module.register) {
|
|
18
|
+
throw new Error(
|
|
19
|
+
[
|
|
20
|
+
`This version of Node.js (${process.version}) does not support module.register(). You can either:`,
|
|
21
|
+
` - Upgrade to Node.js v18.19 or v20.6 and above`,
|
|
22
|
+
` - Use \`lynx.config.js\` instead of \`lynx.config.ts\``,
|
|
23
|
+
].join('\n'),
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const { port1, port2 } = new MessageChannel()
|
|
28
|
+
|
|
29
|
+
// We have checked if `module.register` exists before.
|
|
30
|
+
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
|
31
|
+
module.register(
|
|
32
|
+
// Load a copy of loader so it can be registered multiple times
|
|
33
|
+
`./hooks.js?${Date.now()}`,
|
|
34
|
+
import.meta.url,
|
|
35
|
+
{
|
|
36
|
+
parentURL: import.meta.url,
|
|
37
|
+
data: {
|
|
38
|
+
port: port2,
|
|
39
|
+
},
|
|
40
|
+
transferList: [port2],
|
|
41
|
+
},
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
return function unregister() {
|
|
45
|
+
port1.postMessage('deactivate')
|
|
46
|
+
}
|
|
47
|
+
}
|