@bleedingdev/modern-js-builder 3.9.0-ultramodern.2 → 3.9.0-ultramodern.4

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.
Files changed (34) hide show
  1. package/dist/cjs/shared/rsc/rscDisabledRuntime.js +6 -29
  2. package/dist/esm/shared/rsc/rscDisabledRuntime.mjs +3 -16
  3. package/dist/esm-node/shared/rsc/rscDisabledRuntime.mjs +3 -19
  4. package/dist/types/css-minimizer/LICENSE +20 -0
  5. package/dist/types/css-minimizer/index.d.ts +154 -0
  6. package/dist/types/sass/LICENSE +21 -0
  7. package/dist/types/sass/index.d.ts +36 -0
  8. package/dist/types/sass/loader.d.ts +957 -0
  9. package/dist/types/types.d.ts +3 -3
  10. package/package.json +6 -3
  11. package/dist/cjs/shared/rsc/rscDisabledClientBrowserRuntime.js +0 -69
  12. package/dist/cjs/shared/rsc/rscDisabledClientEdgeRuntime.js +0 -61
  13. package/dist/cjs/shared/rsc/rscDisabledClientNodeRuntime.js +0 -65
  14. package/dist/cjs/shared/rsc/rscDisabledRuntimeError.js +0 -42
  15. package/dist/cjs/shared/rsc/rscDisabledServerEdgeRuntime.js +0 -93
  16. package/dist/cjs/shared/rsc/rscDisabledServerNodeRuntime.js +0 -101
  17. package/dist/esm/shared/rsc/rscDisabledClientBrowserRuntime.mjs +0 -10
  18. package/dist/esm/shared/rsc/rscDisabledClientEdgeRuntime.mjs +0 -8
  19. package/dist/esm/shared/rsc/rscDisabledClientNodeRuntime.mjs +0 -9
  20. package/dist/esm/shared/rsc/rscDisabledRuntimeError.mjs +0 -4
  21. package/dist/esm/shared/rsc/rscDisabledServerEdgeRuntime.mjs +0 -16
  22. package/dist/esm/shared/rsc/rscDisabledServerNodeRuntime.mjs +0 -18
  23. package/dist/esm-node/shared/rsc/rscDisabledClientBrowserRuntime.mjs +0 -11
  24. package/dist/esm-node/shared/rsc/rscDisabledClientEdgeRuntime.mjs +0 -9
  25. package/dist/esm-node/shared/rsc/rscDisabledClientNodeRuntime.mjs +0 -10
  26. package/dist/esm-node/shared/rsc/rscDisabledRuntimeError.mjs +0 -5
  27. package/dist/esm-node/shared/rsc/rscDisabledServerEdgeRuntime.mjs +0 -17
  28. package/dist/esm-node/shared/rsc/rscDisabledServerNodeRuntime.mjs +0 -19
  29. package/dist/types/shared/rsc/rscDisabledClientBrowserRuntime.d.ts +0 -9
  30. package/dist/types/shared/rsc/rscDisabledClientEdgeRuntime.d.ts +0 -7
  31. package/dist/types/shared/rsc/rscDisabledClientNodeRuntime.d.ts +0 -8
  32. package/dist/types/shared/rsc/rscDisabledRuntimeError.d.ts +0 -1
  33. package/dist/types/shared/rsc/rscDisabledServerEdgeRuntime.d.ts +0 -15
  34. package/dist/types/shared/rsc/rscDisabledServerNodeRuntime.d.ts +0 -17
@@ -1,14 +1,5 @@
1
1
  "use strict";
2
2
  var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.n = (module)=>{
5
- var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
- __webpack_require__.d(getter, {
7
- a: getter
8
- });
9
- return getter;
10
- };
11
- })();
12
3
  (()=>{
13
4
  __webpack_require__.d = (exports1, getters, values)=>{
14
5
  var define = (defs, kind)=>{
@@ -36,11 +27,6 @@ var __webpack_require__ = {};
36
27
  })();
37
28
  var __webpack_exports__ = {};
38
29
  __webpack_require__.r(__webpack_exports__);
39
- __webpack_require__.d(__webpack_exports__, {
40
- rscDisabledRuntimePlugin: ()=>rscDisabledRuntimePlugin
41
- });
42
- const external_path_namespaceObject = require("path");
43
- var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
44
30
  const disabledRuntimeModules = {
45
31
  'react-server-dom-rspack/client.browser': './rscDisabledClientBrowserRuntime',
46
32
  'react-server-dom-rspack/client.edge': './rscDisabledClientEdgeRuntime',
@@ -83,22 +69,10 @@ function normalizeArrayAliases(aliases) {
83
69
  return normalized;
84
70
  }
85
71
  function resolveDisabledRuntimeModules() {
86
- const resolvedModules = new Map();
87
- return Object.fromEntries(Object.entries(disabledRuntimeModules).map(([request, moduleRequest])=>{
88
- let modulePath = resolvedModules.get(moduleRequest);
89
- if (void 0 === modulePath) {
90
- try {
91
- modulePath = require.resolve(moduleRequest);
92
- } catch {
93
- modulePath = external_path_default().resolve(__dirname, moduleRequest);
94
- }
95
- resolvedModules.set(moduleRequest, modulePath);
96
- }
97
- return [
72
+ return Object.fromEntries(Object.entries(disabledRuntimeModules).map(([request, moduleRequest])=>[
98
73
  `${request}$`,
99
- modulePath
100
- ];
101
- }));
74
+ require.resolve(`@modern-js/runtime-extensions/rsc-disabled/${moduleRequest.slice(2)}`)
75
+ ]));
102
76
  }
103
77
  function applyDisabledRuntimeAliases(config, disabledAliases) {
104
78
  config.resolve ??= {};
@@ -131,6 +105,9 @@ function rscDisabledRuntimePlugin() {
131
105
  }
132
106
  };
133
107
  }
108
+ __webpack_require__.d(__webpack_exports__, {
109
+ rscDisabledRuntimePlugin: ()=>rscDisabledRuntimePlugin
110
+ });
134
111
  exports.rscDisabledRuntimePlugin = __webpack_exports__.rscDisabledRuntimePlugin;
135
112
  for(var __rspack_i in __webpack_exports__)if (-1 === [
136
113
  "rscDisabledRuntimePlugin"
@@ -1,4 +1,3 @@
1
- import path from "path";
2
1
  const disabledRuntimeModules = {
3
2
  'react-server-dom-rspack/client.browser': './rscDisabledClientBrowserRuntime',
4
3
  'react-server-dom-rspack/client.edge': './rscDisabledClientEdgeRuntime',
@@ -41,22 +40,10 @@ function normalizeArrayAliases(aliases) {
41
40
  return normalized;
42
41
  }
43
42
  function resolveDisabledRuntimeModules() {
44
- const resolvedModules = new Map();
45
- return Object.fromEntries(Object.entries(disabledRuntimeModules).map(([request, moduleRequest])=>{
46
- let modulePath = resolvedModules.get(moduleRequest);
47
- if (void 0 === modulePath) {
48
- try {
49
- modulePath = require.resolve(moduleRequest);
50
- } catch {
51
- modulePath = path.resolve(__dirname, moduleRequest);
52
- }
53
- resolvedModules.set(moduleRequest, modulePath);
54
- }
55
- return [
43
+ return Object.fromEntries(Object.entries(disabledRuntimeModules).map(([request, moduleRequest])=>[
56
44
  `${request}$`,
57
- modulePath
58
- ];
59
- }));
45
+ require.resolve(`@modern-js/runtime-extensions/rsc-disabled/${moduleRequest.slice(2)}`)
46
+ ]));
60
47
  }
61
48
  function applyDisabledRuntimeAliases(config, disabledAliases) {
62
49
  config.resolve ??= {};
@@ -1,9 +1,5 @@
1
1
  import __rslib_shim_module__ from "node:module";
2
2
  const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(/*#__PURE__*/ (()=>import.meta.url)());
3
- import path from "path";
4
- import { fileURLToPath as __rspack_fileURLToPath } from "node:url";
5
- import { dirname as __rspack_dirname } from "node:path";
6
- var __rspack_import_meta_dirname__ = __rspack_dirname(__rspack_fileURLToPath(import.meta.url));
7
3
  const disabledRuntimeModules = {
8
4
  'react-server-dom-rspack/client.browser': './rscDisabledClientBrowserRuntime',
9
5
  'react-server-dom-rspack/client.edge': './rscDisabledClientEdgeRuntime',
@@ -46,22 +42,10 @@ function normalizeArrayAliases(aliases) {
46
42
  return normalized;
47
43
  }
48
44
  function resolveDisabledRuntimeModules() {
49
- const resolvedModules = new Map();
50
- return Object.fromEntries(Object.entries(disabledRuntimeModules).map(([request, moduleRequest])=>{
51
- let modulePath = resolvedModules.get(moduleRequest);
52
- if (void 0 === modulePath) {
53
- try {
54
- modulePath = require.resolve(moduleRequest);
55
- } catch {
56
- modulePath = path.resolve(__rspack_import_meta_dirname__, moduleRequest);
57
- }
58
- resolvedModules.set(moduleRequest, modulePath);
59
- }
60
- return [
45
+ return Object.fromEntries(Object.entries(disabledRuntimeModules).map(([request, moduleRequest])=>[
61
46
  `${request}$`,
62
- modulePath
63
- ];
64
- }));
47
+ require.resolve(`@modern-js/runtime-extensions/rsc-disabled/${moduleRequest.slice(2)}`)
48
+ ]));
65
49
  }
66
50
  function applyDisabledRuntimeAliases(config, disabledAliases) {
67
51
  config.resolve ??= {};
@@ -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,154 @@
1
+ type BasePluginOptions = {
2
+ /**
3
+ * Test rule
4
+ */
5
+ test?: Rule | undefined;
6
+ /**
7
+ * Include rule
8
+ */
9
+ include?: Rule | undefined;
10
+ /**
11
+ * Exclude rule
12
+ */
13
+ exclude?: Rule | undefined;
14
+ /**
15
+ * Warnings filter
16
+ */
17
+ warningsFilter?: WarningsFilter | undefined;
18
+ /**
19
+ * Parallel option
20
+ */
21
+ parallel?: Parallel | undefined;
22
+ };
23
+ type Rule = RegExp | string;
24
+ type WarningsFilter = (
25
+ warning: Warning | WarningObject | string,
26
+ file: string,
27
+ source?: string,
28
+ ) => boolean;
29
+ type Warning =
30
+ | (Error & {
31
+ plugin?: string;
32
+ text?: string;
33
+ source?: string;
34
+ })
35
+ | string;
36
+ type WarningObject = {
37
+ /**
38
+ * Warning message
39
+ */
40
+ message: string;
41
+ /**
42
+ * Plugin name
43
+ */
44
+ plugin?: string | undefined;
45
+ /**
46
+ * Warning text
47
+ */
48
+ text?: string | undefined;
49
+ /**
50
+ * Line number
51
+ */
52
+ line?: number | undefined;
53
+ /**
54
+ * Column number
55
+ */
56
+ column?: number | undefined;
57
+ };
58
+ type Parallel = undefined | boolean | number;
59
+ type DefinedDefaultMinimizerAndOptions<T> = T extends CssNanoOptionsExtended
60
+ ? {
61
+ minify?: MinimizerImplementation<T> | undefined;
62
+ minimizerOptions?: MinimizerOptions<T> | undefined;
63
+ }
64
+ : {
65
+ minify: MinimizerImplementation<T>;
66
+ minimizerOptions?: MinimizerOptions<T> | undefined;
67
+ };
68
+ type CssNanoOptionsExtended = CssNanoOptions & {
69
+ processorOptions?: ProcessOptionsExtender;
70
+ };
71
+ type CssNanoOptions = Record<string, unknown>;
72
+ type ProcessOptionsExtender =
73
+ | ProcessOptions
74
+ | {
75
+ from?: string;
76
+ to?: string;
77
+ parser?: string | Syntax | Parser;
78
+ stringifier?: string | Syntax | Stringifier;
79
+ syntax?: string | Syntax;
80
+ };
81
+ type ProcessOptions = import("postcss").ProcessOptions;
82
+ type Syntax = import("postcss").Syntax;
83
+ type Parser = import("postcss").Parser;
84
+ type Stringifier = import("postcss").Stringifier;
85
+ type MinimizerImplementation<T> = T extends EXPECTED_ANY[]
86
+ ? {
87
+ [P in keyof T]: BasicMinimizerImplementation<T[P]> &
88
+ MinimizeFunctionHelpers;
89
+ }
90
+ : BasicMinimizerImplementation<T> & MinimizeFunctionHelpers;
91
+ type EXPECTED_ANY = any;
92
+ type BasicMinimizerImplementation<T> = (
93
+ input: Input,
94
+ sourceMap: RawSourceMap | undefined,
95
+ minifyOptions: InferDefaultType<T>,
96
+ ) => Promise<MinimizedResult> | MinimizedResult;
97
+ type Input = {
98
+ [file: string]: string;
99
+ };
100
+ type RawSourceMap = import("@jridgewell/trace-mapping").EncodedSourceMap & {
101
+ sources: string[];
102
+ sourcesContent?: string[];
103
+ file: string;
104
+ };
105
+ type InferDefaultType<T> = T extends infer U ? U : CustomOptions;
106
+ type CustomOptions = {
107
+ [key: string]: unknown;
108
+ };
109
+ type MinimizedResult = {
110
+ /**
111
+ * Minimized code
112
+ */
113
+ code: string;
114
+ /**
115
+ * Source map
116
+ */
117
+ map?: RawSourceMap | undefined;
118
+ /**
119
+ * Errors
120
+ */
121
+ errors?: (Error | ErrorObject | string)[] | undefined;
122
+ /**
123
+ * Warnings
124
+ */
125
+ warnings?: (Warning | WarningObject | string)[] | undefined;
126
+ };
127
+ type ErrorObject = {
128
+ /**
129
+ * Error message
130
+ */
131
+ message: string;
132
+ /**
133
+ * Line number
134
+ */
135
+ line?: number | undefined;
136
+ /**
137
+ * Column number
138
+ */
139
+ column?: number | undefined;
140
+ /**
141
+ * Error stack trace
142
+ */
143
+ stack?: string | undefined;
144
+ };
145
+ type MinimizeFunctionHelpers = {
146
+ /**
147
+ * Check if worker threads are supported
148
+ */
149
+ supportsWorkerThreads?: (() => boolean | undefined) | undefined;
150
+ };
151
+ type MinimizerOptions<T> = T extends EXPECTED_ANY[]
152
+ ? { [P in keyof T]?: InferDefaultType<T[P]> }
153
+ : InferDefaultType<T>;
154
+ export type PluginCssMinimizerOptions = { pluginOptions?: import('@rsbuild/core').ConfigChain<BasePluginOptions & DefinedDefaultMinimizerAndOptions<CssNanoOptionsExtended>> };
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023-present Bytedance, Inc. and its affiliates.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,36 @@
1
+ import type { ConfigChainWithContext, Rspack } from '@rsbuild/core';
2
+ import type { LegacyOptions as LegacySassOptions, Options as SassOptions } from 'sass-embedded';
3
+ import type { LoaderOptions } from './loader.js';
4
+ export type SassLoaderOptions = Omit<LoaderOptions, 'api' | 'sassOptions' | 'additionalData'> & ({
5
+ api?: 'modern' | 'modern-compiler';
6
+ sassOptions?: SassOptions<'async'>;
7
+ } | {
8
+ api: 'legacy';
9
+ sassOptions?: Partial<LegacySassOptions<'async'>>;
10
+ }) & {
11
+ // Use `Rspack.LoaderContext` instead of `webpack.LoaderContext`
12
+ // see https://github.com/web-infra-dev/rsbuild/pull/2708
13
+ additionalData?: string | ((content: string | Buffer, loaderContext: Rspack.LoaderContext) => string);
14
+ };
15
+ export type PluginSassOptions = {
16
+ /**
17
+ * Options passed to sass-loader.
18
+ * @see https://github.com/webpack/sass-loader
19
+ */ sassLoaderOptions?: ConfigChainWithContext<SassLoaderOptions, {
20
+ /**
21
+ * @deprecated
22
+ * use `exclude` option instead.
23
+ */ addExcludes: (items: string | RegExp | (string | RegExp)[]) => void;
24
+ }>;
25
+ /**
26
+ * Include some `.scss` or `.sass` files, they will be transformed by sass-loader.
27
+ * @default /\.s(?:a|c)ss$/
28
+ */ include?: Rspack.RuleSetCondition;
29
+ /**
30
+ * Exclude some `.scss` or `.sass` files, they will not be transformed by sass-loader.
31
+ */ exclude?: Rspack.RuleSetCondition;
32
+ /**
33
+ * Whether to use `resolve-url-loader` to rewrite urls.
34
+ * @default true
35
+ */ rewriteUrls?: boolean;
36
+ };