@rsbuild/core 1.0.0 → 1.0.1-beta.0
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/README.md +1 -1
- package/bin/rsbuild.js +4 -2
- package/compiled/autoprefixer/index.d.ts +95 -0
- package/compiled/autoprefixer/index.js +7000 -0
- package/compiled/autoprefixer/license +20 -0
- package/compiled/autoprefixer/package.json +1 -0
- package/compiled/browserslist/index.d.ts +201 -0
- package/compiled/browserslist/index.js +1867 -0
- package/compiled/browserslist/license +20 -0
- package/compiled/browserslist/package.json +1 -0
- package/compiled/chokidar/index.d.ts +198 -0
- package/compiled/chokidar/index.js +5139 -0
- package/compiled/chokidar/license +21 -0
- package/compiled/chokidar/package.json +1 -0
- package/compiled/commander/{typings/index.d.ts → index.d.ts} +184 -102
- package/compiled/commander/index.js +2190 -1
- package/compiled/commander/package.json +1 -1
- package/compiled/connect/index.d.ts +90 -0
- package/compiled/connect/index.js +1240 -0
- package/compiled/connect/license +25 -0
- package/compiled/connect/package.json +1 -0
- package/compiled/connect-history-api-fallback/index.js +149 -1
- package/compiled/connect-history-api-fallback/package.json +1 -1
- package/compiled/css-loader/api.js +85 -0
- package/compiled/css-loader/getUrl.js +26 -0
- package/compiled/css-loader/index.d.ts +1 -0
- package/compiled/css-loader/index.js +7541 -0
- package/compiled/css-loader/license +20 -0
- package/compiled/css-loader/noSourceMaps.js +5 -0
- package/compiled/css-loader/package.json +1 -0
- package/compiled/css-loader/semver.js +1 -0
- package/compiled/css-loader/sourceMaps.js +16 -0
- package/compiled/dotenv/{lib/main.d.ts → index.d.ts} +25 -24
- package/compiled/dotenv/index.js +336 -1
- package/compiled/dotenv/package.json +1 -1
- package/compiled/dotenv-expand/index.d.ts +52 -0
- package/compiled/dotenv-expand/index.js +105 -1
- package/compiled/dotenv-expand/package.json +1 -1
- package/compiled/html-rspack-plugin/default_index.ejs +9 -0
- package/compiled/html-rspack-plugin/index.d.ts +284 -0
- package/compiled/html-rspack-plugin/index.js +1574 -0
- package/compiled/html-rspack-plugin/license +20 -0
- package/compiled/html-rspack-plugin/loader.js +173 -0
- package/compiled/html-rspack-plugin/package.json +1 -0
- package/compiled/http-compression/index.js +134 -1
- package/compiled/http-compression/package.json +1 -1
- package/compiled/http-proxy-middleware/index.d.ts +315 -0
- package/compiled/http-proxy-middleware/index.js +5251 -0
- package/compiled/http-proxy-middleware/license +22 -0
- package/compiled/http-proxy-middleware/package.json +1 -0
- package/compiled/jiti/index.d.ts +1 -0
- package/compiled/jiti/index.js +254 -1748
- package/compiled/jiti/package.json +1 -1
- package/compiled/launch-editor-middleware/index.d.ts +1 -0
- package/compiled/launch-editor-middleware/index.js +696 -0
- package/compiled/launch-editor-middleware/license +21 -0
- package/compiled/launch-editor-middleware/package.json +1 -0
- package/compiled/on-finished/index.d.ts +13 -0
- package/compiled/on-finished/index.js +197 -0
- package/compiled/on-finished/license +23 -0
- package/compiled/on-finished/package.json +1 -0
- package/compiled/open/index.d.ts +1 -153
- package/compiled/open/index.js +409 -1
- package/compiled/open/package.json +1 -1
- package/compiled/picocolors/index.d.ts +34 -0
- package/compiled/picocolors/index.js +97 -0
- package/compiled/picocolors/license +15 -0
- package/compiled/picocolors/package.json +1 -0
- package/compiled/postcss-load-config/index.d.ts +1 -0
- package/compiled/postcss-load-config/index.js +751 -0
- package/compiled/postcss-load-config/license +20 -0
- package/compiled/postcss-load-config/package.json +1 -0
- package/compiled/postcss-loader/index.d.ts +1 -0
- package/compiled/postcss-loader/index.js +8423 -0
- package/compiled/postcss-loader/license +20 -0
- package/compiled/postcss-loader/package.json +1 -0
- package/compiled/postcss-loader/semver.js +1 -0
- package/compiled/postcss-value-parser/index.d.ts +1 -0
- package/compiled/postcss-value-parser/index.js +495 -0
- package/compiled/postcss-value-parser/license +22 -0
- package/compiled/postcss-value-parser/package.json +1 -0
- package/compiled/rslog/index.d.ts +66 -0
- package/compiled/rslog/index.js +334 -0
- package/compiled/rslog/license +21 -0
- package/compiled/rslog/package.json +1 -0
- package/compiled/rspack-chain/index.d.ts +601 -0
- package/compiled/rspack-chain/index.js +1702 -0
- package/compiled/rspack-chain/license +373 -0
- package/compiled/rspack-chain/package.json +1 -0
- package/compiled/rspack-manifest-plugin/index.d.ts +1 -0
- package/compiled/rspack-manifest-plugin/index.js +5884 -0
- package/compiled/rspack-manifest-plugin/license +21 -0
- package/compiled/rspack-manifest-plugin/package.json +1 -0
- package/compiled/sirv/index.d.ts +1 -0
- package/compiled/sirv/index.js +701 -1
- package/compiled/sirv/package.json +1 -1
- package/compiled/style-loader/index.d.ts +1 -0
- package/compiled/style-loader/index.js +427 -0
- package/compiled/style-loader/license +20 -0
- package/compiled/style-loader/package.json +1 -0
- package/compiled/style-loader/runtime/injectStylesIntoLinkTag.js +29 -0
- package/compiled/style-loader/runtime/injectStylesIntoStyleTag.js +84 -0
- package/compiled/style-loader/runtime/insertBySelector.js +34 -0
- package/compiled/style-loader/runtime/insertStyleElement.js +10 -0
- package/compiled/style-loader/runtime/isEqualLocals.js +28 -0
- package/compiled/style-loader/runtime/isOldIE.js +17 -0
- package/compiled/style-loader/runtime/setAttributesWithAttributes.js +13 -0
- package/compiled/style-loader/runtime/setAttributesWithAttributesAndNonce.js +9 -0
- package/compiled/style-loader/runtime/setAttributesWithoutAttributes.js +10 -0
- package/compiled/style-loader/runtime/singletonStyleDomAPI.js +86 -0
- package/compiled/style-loader/runtime/styleDomAPI.js +61 -0
- package/compiled/style-loader/runtime/styleTagTransform.js +14 -0
- package/compiled/webpack-bundle-analyzer/index.d.ts +160 -0
- package/compiled/webpack-bundle-analyzer/index.js +13352 -0
- package/compiled/webpack-bundle-analyzer/license +20 -0
- package/compiled/webpack-bundle-analyzer/package.json +1 -0
- package/compiled/webpack-bundle-analyzer/public/viewer.js +16 -0
- package/compiled/webpack-bundle-analyzer/public/viewer.js.LICENSE.txt +10 -0
- package/compiled/webpack-dev-middleware/index.d.ts +1 -0
- package/compiled/webpack-dev-middleware/index.js +5672 -0
- package/compiled/webpack-dev-middleware/license +20 -0
- package/compiled/webpack-dev-middleware/package.json +1 -0
- package/compiled/webpack-dev-middleware/schema-utils.js +1 -0
- package/compiled/webpack-merge/index.d.ts +31 -0
- package/compiled/webpack-merge/index.js +1200 -0
- package/compiled/webpack-merge/license +20 -0
- package/compiled/webpack-merge/package.json +1 -0
- package/compiled/ws/index.d.ts +402 -0
- package/compiled/ws/index.js +3153 -0
- package/compiled/ws/license +20 -0
- package/compiled/ws/package.json +1 -0
- package/dist/client/hmr.js +249 -405
- package/dist/client/overlay.js +221 -0
- package/dist/{rspack-provider/plugins/basic.js → ignoreCssLoader.cjs} +12 -14
- package/dist/index.cjs +9004 -0
- package/dist/index.js +9075 -16
- package/dist/transformLoader.cjs +54 -0
- package/dist/transformRawLoader.cjs +65 -0
- package/dist-types/cli/commands.d.ts +20 -0
- package/dist-types/cli/init.d.ts +6 -0
- package/dist-types/cli/prepare.d.ts +1 -0
- package/dist-types/client/format.d.ts +5 -0
- package/dist-types/client/hmr.d.ts +1 -0
- package/dist-types/client/overlay.d.ts +1 -0
- package/dist-types/config.d.ts +63 -0
- package/dist-types/configChain.d.ts +162 -0
- package/dist-types/constants.d.ts +32 -0
- package/dist-types/createContext.d.ts +11 -0
- package/dist-types/createRsbuild.d.ts +2 -0
- package/dist-types/helpers/path.d.ts +10 -0
- package/dist-types/helpers.d.ts +57 -0
- package/dist-types/index.d.ts +24 -0
- package/dist-types/initHooks.d.ts +23 -0
- package/dist-types/initPlugins.d.ts +6 -0
- package/dist-types/internal.d.ts +20 -0
- package/dist-types/loadEnv.d.ts +27 -0
- package/dist-types/loader/ignoreCssLoader.d.ts +2 -0
- package/dist-types/loader/transformLoader.d.ts +5 -0
- package/dist-types/loader/transformRawLoader.d.ts +3 -0
- package/dist-types/logger.d.ts +4 -0
- package/dist-types/mergeConfig.d.ts +2 -0
- package/dist-types/package.json +1 -0
- package/dist-types/pluginHelper.d.ts +12 -0
- package/dist-types/pluginManager.d.ts +7 -0
- package/{dist → dist-types}/plugins/asset.d.ts +1 -1
- package/dist-types/plugins/basic.d.ts +5 -0
- package/dist-types/plugins/bundleAnalyzer.d.ts +2 -0
- package/dist-types/plugins/cache.d.ts +2 -0
- package/dist-types/plugins/cleanOutput.d.ts +2 -0
- package/dist-types/plugins/css.d.ts +10 -0
- package/dist-types/plugins/define.d.ts +2 -0
- package/dist-types/plugins/entry.d.ts +2 -0
- package/dist-types/plugins/externals.d.ts +2 -0
- package/{dist → dist-types}/plugins/fileSize.d.ts +1 -1
- package/dist-types/plugins/html.d.ts +9 -0
- package/dist-types/plugins/inlineChunk.d.ts +2 -0
- package/dist-types/plugins/lazyCompilation.d.ts +2 -0
- package/dist-types/plugins/manifest.d.ts +2 -0
- package/dist-types/plugins/minimize.d.ts +10 -0
- package/dist-types/plugins/moduleFederation.d.ts +2 -0
- package/dist-types/plugins/moment.d.ts +2 -0
- package/dist-types/plugins/nodeAddons.d.ts +2 -0
- package/dist-types/plugins/nonce.d.ts +2 -0
- package/{dist/plugins/startUrl.d.ts → dist-types/plugins/open.d.ts} +2 -1
- package/dist-types/plugins/output.d.ts +2 -0
- package/{dist → dist-types}/plugins/performance.d.ts +1 -1
- package/dist-types/plugins/progress.d.ts +2 -0
- package/dist-types/plugins/resolve.d.ts +2 -0
- package/dist-types/plugins/resourceHints.d.ts +2 -0
- package/dist-types/plugins/rsdoctor.d.ts +2 -0
- package/dist-types/plugins/rspackProfile.d.ts +2 -0
- package/dist-types/plugins/server.d.ts +2 -0
- package/dist-types/plugins/splitChunks.d.ts +4 -0
- package/dist-types/plugins/sri.d.ts +2 -0
- package/dist-types/plugins/swc.d.ts +7 -0
- package/dist-types/plugins/target.d.ts +2 -0
- package/dist-types/plugins/wasm.d.ts +2 -0
- package/dist-types/provider/build.d.ts +3 -0
- package/dist-types/provider/createCompiler.d.ts +33 -0
- package/dist-types/provider/initConfigs.d.ts +10 -0
- package/dist-types/provider/inspectConfig.d.ts +6 -0
- package/dist-types/provider/provider.d.ts +2 -0
- package/dist-types/provider/rspackConfig.d.ts +8 -0
- package/dist-types/rspack/HtmlAppIconPlugin.d.ts +13 -0
- package/dist-types/rspack/HtmlBasicPlugin.d.ts +37 -0
- package/dist-types/rspack/InlineChunkHtmlPlugin.d.ts +29 -0
- package/dist-types/rspack/preload/HtmlPreloadOrPrefetchPlugin.d.ts +29 -0
- package/dist-types/rspack/preload/helpers/determineAsValue.d.ts +22 -0
- package/dist-types/rspack/preload/helpers/doesChunkBelongToHtml.d.ts +29 -0
- package/dist-types/rspack/preload/helpers/extractChunks.d.ts +28 -0
- package/dist-types/rspack/preload/helpers/index.d.ts +4 -0
- package/dist-types/rspack/preload/helpers/type.d.ts +13 -0
- package/dist-types/server/compilerDevMiddleware.d.ts +30 -0
- package/dist-types/server/devMiddleware.d.ts +39 -0
- package/dist-types/server/devServer.d.ts +50 -0
- package/dist-types/server/environment.d.ts +7 -0
- package/dist-types/server/getDevMiddlewares.d.ts +25 -0
- package/dist-types/server/helper.d.ts +59 -0
- package/dist-types/server/httpServer.d.ts +8 -0
- package/dist-types/server/middlewares.d.ts +22 -0
- package/dist-types/server/prodServer.d.ts +25 -0
- package/dist-types/server/proxy.d.ts +6 -0
- package/dist-types/server/restart.d.ts +9 -0
- package/dist-types/server/runner/asModule.d.ts +2 -0
- package/dist-types/server/runner/basic.d.ts +25 -0
- package/dist-types/server/runner/cjs.d.ts +10 -0
- package/dist-types/server/runner/esm.d.ts +6 -0
- package/dist-types/server/runner/index.d.ts +8 -0
- package/dist-types/server/runner/type.d.ts +36 -0
- package/dist-types/server/socketServer.d.ts +22 -0
- package/dist-types/server/watchFiles.d.ts +11 -0
- package/dist-types/types/config/dev.d.ts +88 -0
- package/dist-types/types/config/html.d.ts +107 -0
- package/dist-types/types/config/index.d.ts +134 -0
- package/dist-types/types/config/output.d.ts +297 -0
- package/dist-types/types/config/performance.d.ts +123 -0
- package/dist-types/types/config/security.d.ts +18 -0
- package/dist-types/types/config/server.d.ts +106 -0
- package/dist-types/types/config/source.d.ts +79 -0
- package/dist-types/types/config/tools.d.ts +85 -0
- package/dist-types/types/context.d.ts +38 -0
- package/dist-types/types/hooks.d.ts +125 -0
- package/dist-types/types/index.d.ts +9 -0
- package/dist-types/types/plugin.d.ts +197 -0
- package/dist-types/types/rsbuild.d.ts +109 -0
- package/dist-types/types/rspack.d.ts +28 -0
- package/dist-types/types/stats.d.ts +17 -0
- package/dist-types/types/thirdParty.d.ts +168 -0
- package/dist-types/types/utils.d.ts +13 -0
- package/package.json +73 -43
- package/types.d.ts +36 -4
- package/compiled/dotenv-expand/lib/main.d.ts +0 -29
- package/compiled/jiti/types/jiti.d.ts +0 -19
- package/compiled/jiti/types/types.d.ts +0 -31
- package/compiled/open/license +0 -9
- package/compiled/sirv/sirv.d.ts +0 -27
- package/dist/cli/commands.d.ts +0 -20
- package/dist/cli/commands.js +0 -131
- package/dist/cli/config.d.ts +0 -9
- package/dist/cli/config.js +0 -110
- package/dist/cli/prepare.d.ts +0 -1
- package/dist/cli/prepare.js +0 -43
- package/dist/client/hmr/createSocketUrl.d.ts +0 -16
- package/dist/client/hmr/index.d.ts +0 -1
- package/dist/createRsbuild.d.ts +0 -10
- package/dist/createRsbuild.js +0 -100
- package/dist/index.d.ts +0 -10
- package/dist/loadEnv.d.ts +0 -5
- package/dist/loadEnv.js +0 -58
- package/dist/plugins/asset.js +0 -73
- package/dist/plugins/bundleAnalyzer.d.ts +0 -2
- package/dist/plugins/bundleAnalyzer.js +0 -59
- package/dist/plugins/cache.d.ts +0 -2
- package/dist/plugins/cache.js +0 -112
- package/dist/plugins/cleanOutput.d.ts +0 -2
- package/dist/plugins/cleanOutput.js +0 -47
- package/dist/plugins/define.d.ts +0 -2
- package/dist/plugins/define.js +0 -47
- package/dist/plugins/devtool.d.ts +0 -2
- package/dist/plugins/devtool.js +0 -46
- package/dist/plugins/entry.d.ts +0 -2
- package/dist/plugins/entry.js +0 -53
- package/dist/plugins/externals.d.ts +0 -2
- package/dist/plugins/externals.js +0 -48
- package/dist/plugins/fileSize.js +0 -158
- package/dist/plugins/html.d.ts +0 -15
- package/dist/plugins/html.js +0 -270
- package/dist/plugins/index.d.ts +0 -2
- package/dist/plugins/index.js +0 -61
- package/dist/plugins/inlineChunk.d.ts +0 -2
- package/dist/plugins/inlineChunk.js +0 -76
- package/dist/plugins/moment.d.ts +0 -2
- package/dist/plugins/moment.js +0 -68
- package/dist/plugins/networkPerformance.d.ts +0 -2
- package/dist/plugins/networkPerformance.js +0 -58
- package/dist/plugins/nodeAddons.d.ts +0 -2
- package/dist/plugins/nodeAddons.js +0 -70
- package/dist/plugins/performance.js +0 -63
- package/dist/plugins/preloadOrPrefetch.d.ts +0 -2
- package/dist/plugins/preloadOrPrefetch.js +0 -61
- package/dist/plugins/splitChunks.d.ts +0 -2
- package/dist/plugins/splitChunks.js +0 -228
- package/dist/plugins/startUrl.js +0 -148
- package/dist/plugins/target.d.ts +0 -2
- package/dist/plugins/target.js +0 -53
- package/dist/plugins/toml.d.ts +0 -2
- package/dist/plugins/toml.js +0 -36
- package/dist/plugins/wasm.d.ts +0 -2
- package/dist/plugins/wasm.js +0 -51
- package/dist/plugins/yaml.d.ts +0 -2
- package/dist/plugins/yaml.js +0 -36
- package/dist/rspack-plugins/HtmlBasicPlugin.d.ts +0 -19
- package/dist/rspack-plugins/HtmlBasicPlugin.js +0 -87
- package/dist/rspack-plugins/RemoveCssSourcemapPlugin.d.ts +0 -8
- package/dist/rspack-plugins/RemoveCssSourcemapPlugin.js +0 -51
- package/dist/rspack-provider/config.d.ts +0 -9
- package/dist/rspack-provider/config.js +0 -47
- package/dist/rspack-provider/core/build.d.ts +0 -19
- package/dist/rspack-provider/core/build.js +0 -79
- package/dist/rspack-provider/core/createCompiler.d.ts +0 -11
- package/dist/rspack-provider/core/createCompiler.js +0 -112
- package/dist/rspack-provider/core/createContext.d.ts +0 -13
- package/dist/rspack-provider/core/createContext.js +0 -133
- package/dist/rspack-provider/core/devMiddleware.d.ts +0 -3
- package/dist/rspack-provider/core/devMiddleware.js +0 -65
- package/dist/rspack-provider/core/initConfigs.d.ts +0 -14
- package/dist/rspack-provider/core/initConfigs.js +0 -78
- package/dist/rspack-provider/core/initHooks.d.ts +0 -19
- package/dist/rspack-provider/core/initHooks.js +0 -45
- package/dist/rspack-provider/core/initPlugins.d.ts +0 -9
- package/dist/rspack-provider/core/initPlugins.js +0 -87
- package/dist/rspack-provider/core/inspectConfig.d.ts +0 -19
- package/dist/rspack-provider/core/inspectConfig.js +0 -81
- package/dist/rspack-provider/core/rspackConfig.d.ts +0 -9
- package/dist/rspack-provider/core/rspackConfig.js +0 -132
- package/dist/rspack-provider/css-modules-typescript-pre-loader/index.d.ts +0 -6
- package/dist/rspack-provider/css-modules-typescript-pre-loader/index.js +0 -84
- package/dist/rspack-provider/css-modules-typescript-pre-loader/postcss-icss-extract-plugin.d.ts +0 -11
- package/dist/rspack-provider/css-modules-typescript-pre-loader/postcss-icss-extract-plugin.js +0 -67
- package/dist/rspack-provider/index.d.ts +0 -5
- package/dist/rspack-provider/index.js +0 -38
- package/dist/rspack-provider/plugins/basic.d.ts +0 -5
- package/dist/rspack-provider/plugins/css.d.ts +0 -29
- package/dist/rspack-provider/plugins/css.js +0 -199
- package/dist/rspack-provider/plugins/hmr.d.ts +0 -2
- package/dist/rspack-provider/plugins/hmr.js +0 -38
- package/dist/rspack-provider/plugins/less.d.ts +0 -2
- package/dist/rspack-provider/plugins/less.js +0 -78
- package/dist/rspack-provider/plugins/minimize.d.ts +0 -5
- package/dist/rspack-provider/plugins/minimize.js +0 -77
- package/dist/rspack-provider/plugins/output.d.ts +0 -2
- package/dist/rspack-provider/plugins/output.js +0 -65
- package/dist/rspack-provider/plugins/progress.d.ts +0 -2
- package/dist/rspack-provider/plugins/progress.js +0 -61
- package/dist/rspack-provider/plugins/resolve.d.ts +0 -2
- package/dist/rspack-provider/plugins/resolve.js +0 -54
- package/dist/rspack-provider/plugins/rspackProfile.d.ts +0 -5
- package/dist/rspack-provider/plugins/rspackProfile.js +0 -107
- package/dist/rspack-provider/plugins/sass.d.ts +0 -2
- package/dist/rspack-provider/plugins/sass.js +0 -83
- package/dist/rspack-provider/plugins/swc.d.ts +0 -7
- package/dist/rspack-provider/plugins/swc.js +0 -147
- package/dist/rspack-provider/plugins/transition.d.ts +0 -5
- package/dist/rspack-provider/plugins/transition.js +0 -42
- package/dist/rspack-provider/provider.d.ts +0 -8
- package/dist/rspack-provider/provider.js +0 -117
- package/dist/rspack-provider/shared.d.ts +0 -8
- package/dist/rspack-provider/shared.js +0 -116
- package/dist/server/dev-middleware/index.d.ts +0 -24
- package/dist/server/dev-middleware/index.js +0 -91
- package/dist/server/dev-middleware/socketServer.d.ts +0 -22
- package/dist/server/dev-middleware/socketServer.js +0 -164
- package/dist/server/devServer.d.ts +0 -34
- package/dist/server/devServer.js +0 -252
- package/dist/server/index.d.ts +0 -2
- package/dist/server/index.js +0 -31
- package/dist/server/middlewares.d.ts +0 -9
- package/dist/server/middlewares.js +0 -115
- package/dist/server/prodServer.d.ts +0 -33
- package/dist/server/prodServer.js +0 -197
- package/dist/server/proxy.d.ts +0 -9
- package/dist/server/proxy.js +0 -90
- package/dist/server/restart.d.ts +0 -11
- package/dist/server/restart.js +0 -65
- package/dist/types.d.ts +0 -19
- package/dist/types.js +0 -16
- package/static/template.html +0 -7
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright JS Foundation and other contributors
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
'Software'), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
17
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
18
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
19
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
20
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/* This loader renders the template with lodash.template if no other loader was found */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* This is a minimal implementation of `lodash.template`
|
|
6
|
+
* Modified based on lodash v4.17.21
|
|
7
|
+
* License: https://github.com/lodash/lodash/blob/main/LICENSE
|
|
8
|
+
*/
|
|
9
|
+
/** Used to match template delimiters. */
|
|
10
|
+
const reEscape = /<%-([\s\S]+?)%>/g;
|
|
11
|
+
/** Used to match template delimiters. */
|
|
12
|
+
const reEvaluate = /<%([\s\S]+?)%>/g;
|
|
13
|
+
/** Used to match template delimiters. */
|
|
14
|
+
const reInterpolate = /<%=([\s\S]+?)%>/g;
|
|
15
|
+
/** Used to match empty string literals in compiled template source. */
|
|
16
|
+
const reEmptyStringLeading = /\b__p \+= '';/g,
|
|
17
|
+
reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
|
|
18
|
+
reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Used to match
|
|
22
|
+
* [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
|
|
23
|
+
*/
|
|
24
|
+
const reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
|
|
25
|
+
|
|
26
|
+
/** Used to match unescaped characters in compiled string literals. */
|
|
27
|
+
const reUnescapedString = /['\n\r\u2028\u2029\\]/g;
|
|
28
|
+
|
|
29
|
+
/** Used to escape characters for inclusion in compiled string literals. */
|
|
30
|
+
const stringEscapes = {
|
|
31
|
+
'\\': '\\',
|
|
32
|
+
"'": "'",
|
|
33
|
+
'\n': 'n',
|
|
34
|
+
'\r': 'r',
|
|
35
|
+
'\u2028': 'u2028',
|
|
36
|
+
'\u2029': 'u2029',
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const escapeStringChar = (chr) => '\\' + stringEscapes[chr];
|
|
40
|
+
|
|
41
|
+
function template(string) {
|
|
42
|
+
let isEscaping;
|
|
43
|
+
let isEvaluating;
|
|
44
|
+
let index = 0;
|
|
45
|
+
let source = "__p += '";
|
|
46
|
+
|
|
47
|
+
// Compile the regexp to match each delimiter.
|
|
48
|
+
const reDelimiters = RegExp(
|
|
49
|
+
reEscape.source +
|
|
50
|
+
'|' +
|
|
51
|
+
reInterpolate.source +
|
|
52
|
+
'|' +
|
|
53
|
+
reEsTemplate.source +
|
|
54
|
+
'|' +
|
|
55
|
+
reEvaluate.source +
|
|
56
|
+
'|$',
|
|
57
|
+
'g',
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
string.replace(
|
|
61
|
+
reDelimiters,
|
|
62
|
+
function (
|
|
63
|
+
match,
|
|
64
|
+
escapeValue,
|
|
65
|
+
interpolateValue,
|
|
66
|
+
esTemplateValue,
|
|
67
|
+
evaluateValue,
|
|
68
|
+
offset,
|
|
69
|
+
) {
|
|
70
|
+
interpolateValue || (interpolateValue = esTemplateValue);
|
|
71
|
+
|
|
72
|
+
// Escape characters that can't be included in string literals.
|
|
73
|
+
source += string
|
|
74
|
+
.slice(index, offset)
|
|
75
|
+
.replace(reUnescapedString, escapeStringChar);
|
|
76
|
+
|
|
77
|
+
// Replace delimiters with snippets.
|
|
78
|
+
if (escapeValue) {
|
|
79
|
+
isEscaping = true;
|
|
80
|
+
source += "' +\n__e(" + escapeValue + ") +\n'";
|
|
81
|
+
}
|
|
82
|
+
if (evaluateValue) {
|
|
83
|
+
isEvaluating = true;
|
|
84
|
+
source += "';\n" + evaluateValue + ";\n__p += '";
|
|
85
|
+
}
|
|
86
|
+
if (interpolateValue) {
|
|
87
|
+
source +=
|
|
88
|
+
"' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
|
|
89
|
+
}
|
|
90
|
+
index = offset + match.length;
|
|
91
|
+
|
|
92
|
+
// The JS engine embedded in Adobe products needs `match` returned in
|
|
93
|
+
// order to produce the correct `offset` value.
|
|
94
|
+
return match;
|
|
95
|
+
},
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
source += "';\n";
|
|
99
|
+
|
|
100
|
+
// Cleanup code by stripping empty strings.
|
|
101
|
+
source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
|
|
102
|
+
.replace(reEmptyStringMiddle, '$1')
|
|
103
|
+
.replace(reEmptyStringTrailing, '$1;');
|
|
104
|
+
|
|
105
|
+
// Frame code as the function body.
|
|
106
|
+
source =
|
|
107
|
+
'function(' +
|
|
108
|
+
'data' +
|
|
109
|
+
') {\n' +
|
|
110
|
+
"let __t, __p = ''" +
|
|
111
|
+
(isEscaping ? ', __e = lodashEscape' : '') +
|
|
112
|
+
(isEvaluating
|
|
113
|
+
? ', __j = Array.prototype.join;\n' +
|
|
114
|
+
"function print() { __p += __j.call(arguments, '') }\n"
|
|
115
|
+
: ';\n') +
|
|
116
|
+
source +
|
|
117
|
+
'return __p\n}';
|
|
118
|
+
|
|
119
|
+
return { compiled: source, isEscaping };
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
module.exports = function (source) {
|
|
123
|
+
const allLoadersButThisOne = this.loaders.filter(
|
|
124
|
+
(loader) => loader.normal !== module.exports,
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
// This loader shouldn't kick in if there is any other loader
|
|
128
|
+
if (allLoadersButThisOne.length > 0) {
|
|
129
|
+
return source;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Allow only one html-webpack-plugin loader to allow loader options in the webpack config
|
|
133
|
+
const htmlWebpackPluginLoaders = this.loaders.filter(
|
|
134
|
+
(loader) => loader.normal === module.exports,
|
|
135
|
+
);
|
|
136
|
+
const lastHtmlRspackPluginLoader =
|
|
137
|
+
htmlWebpackPluginLoaders[htmlWebpackPluginLoaders.length - 1];
|
|
138
|
+
if (this.loaders[this.loaderIndex] !== lastHtmlRspackPluginLoader) {
|
|
139
|
+
return source;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (/\.(c|m)?js$/.test(this.resourcePath)) {
|
|
143
|
+
return source;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const escapeCode = `const htmlEscapes = {
|
|
147
|
+
"&": "&",
|
|
148
|
+
"<": "<",
|
|
149
|
+
">": ">",
|
|
150
|
+
'"': """,
|
|
151
|
+
"'": "'",
|
|
152
|
+
};
|
|
153
|
+
const escapeHtmlChar = (key) => htmlEscapes[key];
|
|
154
|
+
const reUnescapedHtml = /[&<>"']/g, reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
|
|
155
|
+
|
|
156
|
+
function lodashEscape(string) {
|
|
157
|
+
string = string.toString();
|
|
158
|
+
return string && reHasUnescapedHtml.test(string)
|
|
159
|
+
? string.replace(reUnescapedHtml, escapeHtmlChar)
|
|
160
|
+
: string;
|
|
161
|
+
};`;
|
|
162
|
+
|
|
163
|
+
// The following part renders the template with lodash as a minimalistic loader
|
|
164
|
+
const { compiled, isEscaping } = template(source);
|
|
165
|
+
// Use `eval("require")("lodash")` to enforce using the native nodejs require
|
|
166
|
+
// during template execution
|
|
167
|
+
return `
|
|
168
|
+
module.exports = function (templateParams) { with(templateParams) {
|
|
169
|
+
${isEscaping ? escapeCode : ''}
|
|
170
|
+
// Execute the lodash template
|
|
171
|
+
return (${compiled})();
|
|
172
|
+
}}`;
|
|
173
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"html-rspack-plugin","author":"Jan Nicklas <j.nicklas@me.com> (https://github.com/jantimon)","version":"6.0.0-beta.8","funding":{"type":"opencollective","url":"https://opencollective.com/html-webpack-plugin"},"license":"MIT","types":"index.d.ts","type":"commonjs"}
|
|
@@ -1 +1,134 @@
|
|
|
1
|
-
(()
|
|
1
|
+
(() => {
|
|
2
|
+
"use strict";
|
|
3
|
+
var __webpack_modules__ = {
|
|
4
|
+
807: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
5
|
+
const zlib = __nccwpck_require__(796);
|
|
6
|
+
const MIMES = /text|javascript|\/json|xml/i;
|
|
7
|
+
const noop = () => {};
|
|
8
|
+
const getChunkSize = (chunk, enc) =>
|
|
9
|
+
chunk ? Buffer.byteLength(chunk, enc) : 0;
|
|
10
|
+
module.exports = ({
|
|
11
|
+
threshold = 1024,
|
|
12
|
+
level = -1,
|
|
13
|
+
brotli = true,
|
|
14
|
+
gzip = true,
|
|
15
|
+
mimes = MIMES,
|
|
16
|
+
} = {}) => {
|
|
17
|
+
const brotliOpts = (typeof brotli === "object" && brotli) || {};
|
|
18
|
+
const gzipOpts = (typeof gzip === "object" && gzip) || {};
|
|
19
|
+
if (brotli && !zlib.createBrotliCompress) brotli = false;
|
|
20
|
+
return (req, res, next = noop) => {
|
|
21
|
+
const accept = req.headers["accept-encoding"];
|
|
22
|
+
const encoding =
|
|
23
|
+
accept &&
|
|
24
|
+
((brotli && accept.match(/\bbr\b/)) ||
|
|
25
|
+
(gzip && accept.match(/\bgzip\b/)) ||
|
|
26
|
+
[])[0];
|
|
27
|
+
if (req.method === "HEAD" || !encoding) return next();
|
|
28
|
+
let compress;
|
|
29
|
+
let pendingStatus;
|
|
30
|
+
let pendingListeners = [];
|
|
31
|
+
let started = false;
|
|
32
|
+
let size = 0;
|
|
33
|
+
function start() {
|
|
34
|
+
started = true;
|
|
35
|
+
size = res.getHeader("Content-Length") | 0 || size;
|
|
36
|
+
const compressible = mimes.test(
|
|
37
|
+
String(res.getHeader("Content-Type") || "text/plain"),
|
|
38
|
+
);
|
|
39
|
+
const cleartext = !res.getHeader("Content-Encoding");
|
|
40
|
+
const listeners = pendingListeners || [];
|
|
41
|
+
if (compressible && cleartext && size >= threshold) {
|
|
42
|
+
res.setHeader("Content-Encoding", encoding);
|
|
43
|
+
res.removeHeader("Content-Length");
|
|
44
|
+
if (encoding === "br") {
|
|
45
|
+
compress = zlib.createBrotliCompress({
|
|
46
|
+
params: Object.assign(
|
|
47
|
+
{
|
|
48
|
+
[zlib.constants.BROTLI_PARAM_QUALITY]:
|
|
49
|
+
level === -1 ? 1 : level,
|
|
50
|
+
[zlib.constants.BROTLI_PARAM_SIZE_HINT]: size,
|
|
51
|
+
},
|
|
52
|
+
brotliOpts,
|
|
53
|
+
),
|
|
54
|
+
});
|
|
55
|
+
} else {
|
|
56
|
+
compress = zlib.createGzip(
|
|
57
|
+
Object.assign({ level: level === -1 ? 7 : level }, gzipOpts),
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
compress.on(
|
|
61
|
+
"data",
|
|
62
|
+
(chunk) => write.call(res, chunk) === false && compress.pause(),
|
|
63
|
+
);
|
|
64
|
+
on.call(res, "drain", () => compress.resume());
|
|
65
|
+
compress.on("end", () => end.call(res));
|
|
66
|
+
listeners.forEach((p) => compress.on.apply(compress, p));
|
|
67
|
+
} else {
|
|
68
|
+
pendingListeners = null;
|
|
69
|
+
listeners.forEach((p) => on.apply(res, p));
|
|
70
|
+
}
|
|
71
|
+
writeHead.call(res, pendingStatus || res.statusCode);
|
|
72
|
+
}
|
|
73
|
+
const { end, write, on, writeHead } = res;
|
|
74
|
+
res.writeHead = function (status, reason, headers) {
|
|
75
|
+
if (typeof reason !== "string")
|
|
76
|
+
[headers, reason] = [reason, headers];
|
|
77
|
+
if (headers) for (const i in headers) res.setHeader(i, headers[i]);
|
|
78
|
+
pendingStatus = status;
|
|
79
|
+
return this;
|
|
80
|
+
};
|
|
81
|
+
res.write = function (chunk, enc) {
|
|
82
|
+
size += getChunkSize(chunk, enc);
|
|
83
|
+
if (!started) start();
|
|
84
|
+
if (!compress) return write.apply(this, arguments);
|
|
85
|
+
return compress.write.apply(compress, arguments);
|
|
86
|
+
};
|
|
87
|
+
res.end = function (chunk, enc) {
|
|
88
|
+
if (arguments.length > 0 && typeof chunk !== "function") {
|
|
89
|
+
size += getChunkSize(chunk, enc);
|
|
90
|
+
}
|
|
91
|
+
if (!started) start();
|
|
92
|
+
if (!compress) return end.apply(this, arguments);
|
|
93
|
+
return compress.end.apply(compress, arguments);
|
|
94
|
+
};
|
|
95
|
+
res.on = function (type, listener) {
|
|
96
|
+
if (!pendingListeners || type !== "drain")
|
|
97
|
+
on.call(this, type, listener);
|
|
98
|
+
else if (compress) compress.on(type, listener);
|
|
99
|
+
else pendingListeners.push([type, listener]);
|
|
100
|
+
return this;
|
|
101
|
+
};
|
|
102
|
+
next();
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
},
|
|
106
|
+
796: (module) => {
|
|
107
|
+
module.exports = require("zlib");
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
var __webpack_module_cache__ = {};
|
|
111
|
+
function __nccwpck_require__(moduleId) {
|
|
112
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
113
|
+
if (cachedModule !== undefined) {
|
|
114
|
+
return cachedModule.exports;
|
|
115
|
+
}
|
|
116
|
+
var module = (__webpack_module_cache__[moduleId] = { exports: {} });
|
|
117
|
+
var threw = true;
|
|
118
|
+
try {
|
|
119
|
+
__webpack_modules__[moduleId](
|
|
120
|
+
module,
|
|
121
|
+
module.exports,
|
|
122
|
+
__nccwpck_require__,
|
|
123
|
+
);
|
|
124
|
+
threw = false;
|
|
125
|
+
} finally {
|
|
126
|
+
if (threw) delete __webpack_module_cache__[moduleId];
|
|
127
|
+
}
|
|
128
|
+
return module.exports;
|
|
129
|
+
}
|
|
130
|
+
if (typeof __nccwpck_require__ !== "undefined")
|
|
131
|
+
__nccwpck_require__.ab = __dirname + "/";
|
|
132
|
+
var __webpack_exports__ = __nccwpck_require__(807);
|
|
133
|
+
module.exports = __webpack_exports__;
|
|
134
|
+
})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"http-compression","author":{"email":"josefrancisco.verdu@gmail.com","name":"Kiko Beats","url":"https://kikobeats.com"},"version":"1.0.
|
|
1
|
+
{"name":"http-compression","author":{"email":"josefrancisco.verdu@gmail.com","name":"Kiko Beats","url":"https://kikobeats.com"},"version":"1.0.20","license":"MIT","types":"index.d.ts","type":"commonjs"}
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import * as express from 'express';
|
|
3
|
+
import * as http from 'http';
|
|
4
|
+
import * as events from 'events';
|
|
5
|
+
import * as net from 'net';
|
|
6
|
+
import * as stream from 'stream';
|
|
7
|
+
import * as url from 'url';
|
|
8
|
+
|
|
9
|
+
interface ProxyTargetDetailed {
|
|
10
|
+
host: string;
|
|
11
|
+
port: number;
|
|
12
|
+
protocol?: string | undefined;
|
|
13
|
+
hostname?: string | undefined;
|
|
14
|
+
socketPath?: string | undefined;
|
|
15
|
+
key?: string | undefined;
|
|
16
|
+
passphrase?: string | undefined;
|
|
17
|
+
pfx?: Buffer | string | undefined;
|
|
18
|
+
cert?: string | undefined;
|
|
19
|
+
ca?: string | undefined;
|
|
20
|
+
ciphers?: string | undefined;
|
|
21
|
+
secureProtocol?: string | undefined;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare class Server<TIncomingMessage = http.IncomingMessage, TServerResponse = http.ServerResponse>
|
|
25
|
+
extends events.EventEmitter
|
|
26
|
+
{
|
|
27
|
+
/**
|
|
28
|
+
* Creates the proxy server with specified options.
|
|
29
|
+
* @param options - Config object passed to the proxy
|
|
30
|
+
*/
|
|
31
|
+
constructor(options?: Server.ServerOptions);
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Used for proxying regular HTTP(S) requests
|
|
35
|
+
* @param req - Client request.
|
|
36
|
+
* @param res - Client response.
|
|
37
|
+
* @param options - Additional options.
|
|
38
|
+
*/
|
|
39
|
+
web(
|
|
40
|
+
req: http.IncomingMessage,
|
|
41
|
+
res: http.ServerResponse,
|
|
42
|
+
options?: Server.ServerOptions,
|
|
43
|
+
callback?: Server.ErrorCallback,
|
|
44
|
+
): void;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Used for proxying regular HTTP(S) requests
|
|
48
|
+
* @param req - Client request.
|
|
49
|
+
* @param socket - Client socket.
|
|
50
|
+
* @param head - Client head.
|
|
51
|
+
* @param options - Additionnal options.
|
|
52
|
+
*/
|
|
53
|
+
ws(
|
|
54
|
+
req: http.IncomingMessage,
|
|
55
|
+
socket: any,
|
|
56
|
+
head: any,
|
|
57
|
+
options?: Server.ServerOptions,
|
|
58
|
+
callback?: Server.ErrorCallback,
|
|
59
|
+
): void;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* A function that wraps the object in a webserver, for your convenience
|
|
63
|
+
* @param port - Port to listen on
|
|
64
|
+
* @param hostname - The hostname to listen on
|
|
65
|
+
*/
|
|
66
|
+
listen(port: number, hostname?: string): Server<TIncomingMessage, TServerResponse>;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* A function that closes the inner webserver and stops listening on given port
|
|
70
|
+
*/
|
|
71
|
+
close(callback?: () => void): void;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Creates the proxy server with specified options.
|
|
75
|
+
* @param options Config object passed to the proxy
|
|
76
|
+
* @returns Proxy object with handlers for `ws` and `web` requests
|
|
77
|
+
*/
|
|
78
|
+
// tslint:disable:no-unnecessary-generics
|
|
79
|
+
static createProxyServer<TIncomingMessage = http.IncomingMessage, TServerResponse = http.ServerResponse>(
|
|
80
|
+
options?: Server.ServerOptions,
|
|
81
|
+
): Server<TIncomingMessage, TServerResponse>;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Creates the proxy server with specified options.
|
|
85
|
+
* @param options Config object passed to the proxy
|
|
86
|
+
* @returns Proxy object with handlers for `ws` and `web` requests
|
|
87
|
+
*/
|
|
88
|
+
// tslint:disable:no-unnecessary-generics
|
|
89
|
+
static createServer<TIncomingMessage = http.IncomingMessage, TServerResponse = http.ServerResponse>(
|
|
90
|
+
options?: Server.ServerOptions,
|
|
91
|
+
): Server<TIncomingMessage, TServerResponse>;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Creates the proxy server with specified options.
|
|
95
|
+
* @param options Config object passed to the proxy
|
|
96
|
+
* @returns Proxy object with handlers for `ws` and `web` requests
|
|
97
|
+
*/
|
|
98
|
+
// tslint:disable:no-unnecessary-generics
|
|
99
|
+
static createProxy<TIncomingMessage = http.IncomingMessage, TServerResponse = http.ServerResponse>(
|
|
100
|
+
options?: Server.ServerOptions,
|
|
101
|
+
): Server<TIncomingMessage, TServerResponse>;
|
|
102
|
+
|
|
103
|
+
addListener(event: string, listener: () => void): this;
|
|
104
|
+
on(event: string, listener: () => void): this;
|
|
105
|
+
on(event: "error", listener: Server.ErrorCallback<Error, TIncomingMessage, TServerResponse>): this;
|
|
106
|
+
on(event: "start", listener: Server.StartCallback<TIncomingMessage, TServerResponse>): this;
|
|
107
|
+
on(
|
|
108
|
+
event: "proxyReq",
|
|
109
|
+
listener: Server.ProxyReqCallback<http.ClientRequest, TIncomingMessage, TServerResponse>,
|
|
110
|
+
): this;
|
|
111
|
+
on(event: "proxyRes", listener: Server.ProxyResCallback<TIncomingMessage, TServerResponse>): this;
|
|
112
|
+
on(event: "proxyReqWs", listener: Server.ProxyReqWsCallback<http.ClientRequest, TIncomingMessage>): this;
|
|
113
|
+
on(event: "econnreset", listener: Server.EconnresetCallback<Error, TIncomingMessage, TServerResponse>): this;
|
|
114
|
+
on(event: "end", listener: Server.EndCallback<TIncomingMessage, TServerResponse>): this;
|
|
115
|
+
on(event: "open", listener: Server.OpenCallback): this;
|
|
116
|
+
on(event: "close", listener: Server.CloseCallback<TIncomingMessage>): this;
|
|
117
|
+
|
|
118
|
+
once(event: string, listener: () => void): this;
|
|
119
|
+
once(event: "error", listener: Server.ErrorCallback<Error, TIncomingMessage, TServerResponse>): this;
|
|
120
|
+
once(event: "start", listener: Server.StartCallback<TIncomingMessage, TServerResponse>): this;
|
|
121
|
+
once(
|
|
122
|
+
event: "proxyReq",
|
|
123
|
+
listener: Server.ProxyReqCallback<http.ClientRequest, TIncomingMessage, TServerResponse>,
|
|
124
|
+
): this;
|
|
125
|
+
once(event: "proxyRes", listener: Server.ProxyResCallback<TIncomingMessage, TServerResponse>): this;
|
|
126
|
+
once(event: "proxyReqWs", listener: Server.ProxyReqWsCallback<http.ClientRequest, TIncomingMessage>): this;
|
|
127
|
+
once(event: "econnreset", listener: Server.EconnresetCallback<Error, TIncomingMessage, TServerResponse>): this;
|
|
128
|
+
once(event: "end", listener: Server.EndCallback<TIncomingMessage, TServerResponse>): this;
|
|
129
|
+
once(event: "open", listener: Server.OpenCallback): this;
|
|
130
|
+
once(event: "close", listener: Server.CloseCallback<TIncomingMessage>): this;
|
|
131
|
+
removeListener(event: string, listener: () => void): this;
|
|
132
|
+
removeAllListeners(event?: string): this;
|
|
133
|
+
getMaxListeners(): number;
|
|
134
|
+
setMaxListeners(n: number): this;
|
|
135
|
+
listeners(event: string): Array<() => void>;
|
|
136
|
+
emit(event: string, ...args: any[]): boolean;
|
|
137
|
+
listenerCount(type: string): number;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
declare namespace Server {
|
|
141
|
+
type ProxyTarget = ProxyTargetUrl | ProxyTargetDetailed;
|
|
142
|
+
type ProxyTargetUrl = string | Partial<url.Url>;
|
|
143
|
+
|
|
144
|
+
interface ServerOptions {
|
|
145
|
+
/** URL string to be parsed with the url module. */
|
|
146
|
+
target?: ProxyTarget | undefined;
|
|
147
|
+
/** URL string to be parsed with the url module. */
|
|
148
|
+
forward?: ProxyTargetUrl | undefined;
|
|
149
|
+
/** Object to be passed to http(s).request. */
|
|
150
|
+
agent?: any;
|
|
151
|
+
/** Object to be passed to https.createServer(). */
|
|
152
|
+
ssl?: any;
|
|
153
|
+
/** If you want to proxy websockets. */
|
|
154
|
+
ws?: boolean | undefined;
|
|
155
|
+
/** Adds x- forward headers. */
|
|
156
|
+
xfwd?: boolean | undefined;
|
|
157
|
+
/** Verify SSL certificate. */
|
|
158
|
+
secure?: boolean | undefined;
|
|
159
|
+
/** Explicitly specify if we are proxying to another proxy. */
|
|
160
|
+
toProxy?: boolean | undefined;
|
|
161
|
+
/** Specify whether you want to prepend the target's path to the proxy path. */
|
|
162
|
+
prependPath?: boolean | undefined;
|
|
163
|
+
/** Specify whether you want to ignore the proxy path of the incoming request. */
|
|
164
|
+
ignorePath?: boolean | undefined;
|
|
165
|
+
/** Local interface string to bind for outgoing connections. */
|
|
166
|
+
localAddress?: string | undefined;
|
|
167
|
+
/** Changes the origin of the host header to the target URL. */
|
|
168
|
+
changeOrigin?: boolean | undefined;
|
|
169
|
+
/** specify whether you want to keep letter case of response header key */
|
|
170
|
+
preserveHeaderKeyCase?: boolean | undefined;
|
|
171
|
+
/** Basic authentication i.e. 'user:password' to compute an Authorization header. */
|
|
172
|
+
auth?: string | undefined;
|
|
173
|
+
/** Rewrites the location hostname on (301 / 302 / 307 / 308) redirects, Default: null. */
|
|
174
|
+
hostRewrite?: string | undefined;
|
|
175
|
+
/** Rewrites the location host/ port on (301 / 302 / 307 / 308) redirects based on requested host/ port.Default: false. */
|
|
176
|
+
autoRewrite?: boolean | undefined;
|
|
177
|
+
/** Rewrites the location protocol on (301 / 302 / 307 / 308) redirects to 'http' or 'https'.Default: null. */
|
|
178
|
+
protocolRewrite?: string | undefined;
|
|
179
|
+
/** rewrites domain of set-cookie headers. */
|
|
180
|
+
cookieDomainRewrite?: false | string | { [oldDomain: string]: string } | undefined;
|
|
181
|
+
/** rewrites path of set-cookie headers. Default: false */
|
|
182
|
+
cookiePathRewrite?: false | string | { [oldPath: string]: string } | undefined;
|
|
183
|
+
/** object with extra headers to be added to target requests. */
|
|
184
|
+
headers?: { [header: string]: string } | undefined;
|
|
185
|
+
/** Timeout (in milliseconds) when proxy receives no response from target. Default: 120000 (2 minutes) */
|
|
186
|
+
proxyTimeout?: number | undefined;
|
|
187
|
+
/** Timeout (in milliseconds) for incoming requests */
|
|
188
|
+
timeout?: number | undefined;
|
|
189
|
+
/** Specify whether you want to follow redirects. Default: false */
|
|
190
|
+
followRedirects?: boolean | undefined;
|
|
191
|
+
/** If set to true, none of the webOutgoing passes are called and it's your responsibility to appropriately return the response by listening and acting on the proxyRes event */
|
|
192
|
+
selfHandleResponse?: boolean | undefined;
|
|
193
|
+
/** Buffer */
|
|
194
|
+
buffer?: stream.Stream | undefined;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
type StartCallback<TIncomingMessage = http.IncomingMessage, TServerResponse = http.ServerResponse> = (
|
|
198
|
+
req: TIncomingMessage,
|
|
199
|
+
res: TServerResponse,
|
|
200
|
+
target: ProxyTargetUrl,
|
|
201
|
+
) => void;
|
|
202
|
+
type ProxyReqCallback<
|
|
203
|
+
TClientRequest = http.ClientRequest,
|
|
204
|
+
TIncomingMessage = http.IncomingMessage,
|
|
205
|
+
TServerResponse = http.ServerResponse,
|
|
206
|
+
> = (proxyReq: TClientRequest, req: TIncomingMessage, res: TServerResponse, options: ServerOptions) => void;
|
|
207
|
+
type ProxyResCallback<TIncomingMessage = http.IncomingMessage, TServerResponse = http.ServerResponse> = (
|
|
208
|
+
proxyRes: TIncomingMessage,
|
|
209
|
+
req: TIncomingMessage,
|
|
210
|
+
res: TServerResponse,
|
|
211
|
+
) => void;
|
|
212
|
+
type ProxyReqWsCallback<TClientRequest = http.ClientRequest, TIncomingMessage = http.IncomingMessage> = (
|
|
213
|
+
proxyReq: TClientRequest,
|
|
214
|
+
req: TIncomingMessage,
|
|
215
|
+
socket: net.Socket,
|
|
216
|
+
options: ServerOptions,
|
|
217
|
+
head: any,
|
|
218
|
+
) => void;
|
|
219
|
+
type EconnresetCallback<
|
|
220
|
+
TError = Error,
|
|
221
|
+
TIncomingMessage = http.IncomingMessage,
|
|
222
|
+
TServerResponse = http.ServerResponse,
|
|
223
|
+
> = (
|
|
224
|
+
err: TError,
|
|
225
|
+
req: TIncomingMessage,
|
|
226
|
+
res: TServerResponse,
|
|
227
|
+
target: ProxyTargetUrl,
|
|
228
|
+
) => void;
|
|
229
|
+
type EndCallback<TIncomingMessage = http.IncomingMessage, TServerResponse = http.ServerResponse> = (
|
|
230
|
+
req: TIncomingMessage,
|
|
231
|
+
res: TServerResponse,
|
|
232
|
+
proxyRes: TIncomingMessage,
|
|
233
|
+
) => void;
|
|
234
|
+
type OpenCallback = (proxySocket: net.Socket) => void;
|
|
235
|
+
type CloseCallback<TIncomingMessage = http.IncomingMessage> = (
|
|
236
|
+
proxyRes: TIncomingMessage,
|
|
237
|
+
proxySocket: net.Socket,
|
|
238
|
+
proxyHead: any,
|
|
239
|
+
) => void;
|
|
240
|
+
type ErrorCallback<TError = Error, TIncomingMessage = http.IncomingMessage, TServerResponse = http.ServerResponse> =
|
|
241
|
+
(
|
|
242
|
+
err: TError,
|
|
243
|
+
req: TIncomingMessage,
|
|
244
|
+
res: TServerResponse | net.Socket,
|
|
245
|
+
target?: ProxyTargetUrl,
|
|
246
|
+
) => void;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Based on definition by DefinitelyTyped:
|
|
251
|
+
* https://github.com/DefinitelyTyped/DefinitelyTyped/blob/6f529c6c67a447190f86bfbf894d1061e41e07b7/types/http-proxy-middleware/index.d.ts
|
|
252
|
+
*/
|
|
253
|
+
|
|
254
|
+
interface Request extends express.Request {
|
|
255
|
+
}
|
|
256
|
+
interface Response extends express.Response {
|
|
257
|
+
}
|
|
258
|
+
interface RequestHandler extends express.RequestHandler {
|
|
259
|
+
upgrade?: (req: Request, socket: net.Socket, head: any) => void;
|
|
260
|
+
}
|
|
261
|
+
declare type Filter = string | string[] | ((pathname: string, req: Request) => boolean);
|
|
262
|
+
interface Options extends Server.ServerOptions {
|
|
263
|
+
pathRewrite?: {
|
|
264
|
+
[regexp: string]: string;
|
|
265
|
+
} | ((path: string, req: Request) => string) | ((path: string, req: Request) => Promise<string>);
|
|
266
|
+
router?: {
|
|
267
|
+
[hostOrPath: string]: Server.ServerOptions['target'];
|
|
268
|
+
} | ((req: Request) => Server.ServerOptions['target']) | ((req: Request) => Promise<Server.ServerOptions['target']>);
|
|
269
|
+
logLevel?: 'debug' | 'info' | 'warn' | 'error' | 'silent';
|
|
270
|
+
logProvider?: LogProviderCallback;
|
|
271
|
+
onError?: OnErrorCallback;
|
|
272
|
+
onProxyRes?: OnProxyResCallback;
|
|
273
|
+
onProxyReq?: OnProxyReqCallback;
|
|
274
|
+
onProxyReqWs?: OnProxyReqWsCallback;
|
|
275
|
+
onOpen?: OnOpenCallback;
|
|
276
|
+
onClose?: OnCloseCallback;
|
|
277
|
+
}
|
|
278
|
+
interface LogProvider {
|
|
279
|
+
log: Logger;
|
|
280
|
+
debug?: Logger;
|
|
281
|
+
info?: Logger;
|
|
282
|
+
warn?: Logger;
|
|
283
|
+
error?: Logger;
|
|
284
|
+
}
|
|
285
|
+
declare type Logger = (...args: any[]) => void;
|
|
286
|
+
declare type LogProviderCallback = (provider: LogProvider) => LogProvider;
|
|
287
|
+
/**
|
|
288
|
+
* Use types based on the events listeners from http-proxy
|
|
289
|
+
* https://github.com/DefinitelyTyped/DefinitelyTyped/blob/51504fd999031b7f025220fab279f1b2155cbaff/types/http-proxy/index.d.ts
|
|
290
|
+
*/
|
|
291
|
+
declare type OnErrorCallback = (err: Error, req: Request, res: Response, target?: string | Partial<url.Url>) => void;
|
|
292
|
+
declare type OnProxyResCallback = (proxyRes: http.IncomingMessage, req: Request, res: Response) => void;
|
|
293
|
+
declare type OnProxyReqCallback = (proxyReq: http.ClientRequest, req: Request, res: Response, options: Server.ServerOptions) => void;
|
|
294
|
+
declare type OnProxyReqWsCallback = (proxyReq: http.ClientRequest, req: Request, socket: net.Socket, options: Server.ServerOptions, head: any) => void;
|
|
295
|
+
declare type OnCloseCallback = (proxyRes: Response, proxySocket: net.Socket, proxyHead: any) => void;
|
|
296
|
+
declare type OnOpenCallback = (proxySocket: net.Socket) => void;
|
|
297
|
+
|
|
298
|
+
declare type Interceptor = (buffer: Buffer, proxyRes: http.IncomingMessage, req: http.IncomingMessage, res: http.ServerResponse) => Promise<Buffer | string>;
|
|
299
|
+
/**
|
|
300
|
+
* Intercept responses from upstream.
|
|
301
|
+
* Automatically decompress (deflate, gzip, brotli).
|
|
302
|
+
* Give developer the opportunity to modify intercepted Buffer and http.ServerResponse
|
|
303
|
+
*
|
|
304
|
+
* NOTE: must set options.selfHandleResponse=true (prevent automatic call of res.end())
|
|
305
|
+
*/
|
|
306
|
+
declare function responseInterceptor(interceptor: Interceptor): (proxyRes: http.IncomingMessage, req: http.IncomingMessage, res: http.ServerResponse) => Promise<void>;
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Fix proxied body if bodyParser is involved.
|
|
310
|
+
*/
|
|
311
|
+
declare function fixRequestBody(proxyReq: http.ClientRequest, req: http.IncomingMessage): void;
|
|
312
|
+
|
|
313
|
+
declare function createProxyMiddleware(context: Filter | Options, options?: Options): RequestHandler;
|
|
314
|
+
|
|
315
|
+
export { type Filter, type Options, type RequestHandler, createProxyMiddleware, fixRequestBody, responseInterceptor };
|