@bleedingdev/modern-js-builder 3.9.0-ultramodern.1 → 3.9.0-ultramodern.10

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 (53) hide show
  1. package/dist/cjs/createBuilder.js +15 -6
  2. package/dist/cjs/index.js +6 -2
  3. package/dist/cjs/shared/parseCommonConfig.js +2 -1
  4. package/dist/cjs/shared/rsc/rscClientBrowserFallback.js +68 -0
  5. package/dist/cjs/shared/tsgo.js +274 -0
  6. package/dist/esm/createBuilder.mjs +16 -7
  7. package/dist/esm/index.mjs +1 -0
  8. package/dist/esm/shared/parseCommonConfig.mjs +2 -1
  9. package/dist/esm/shared/rsc/rscClientBrowserFallback.mjs +20 -0
  10. package/dist/esm/shared/tsgo.mjs +219 -0
  11. package/dist/esm-node/createBuilder.mjs +16 -7
  12. package/dist/esm-node/index.mjs +1 -0
  13. package/dist/esm-node/shared/parseCommonConfig.mjs +2 -1
  14. package/dist/esm-node/shared/rsc/rscClientBrowserFallback.mjs +25 -0
  15. package/dist/esm-node/shared/tsgo.mjs +220 -0
  16. package/dist/types/css-minimizer/LICENSE +20 -0
  17. package/dist/types/css-minimizer/index.d.ts +154 -0
  18. package/dist/types/index.d.ts +1 -0
  19. package/dist/types/sass/LICENSE +21 -0
  20. package/dist/types/sass/index.d.ts +36 -0
  21. package/dist/types/sass/loader.d.ts +957 -0
  22. package/dist/types/shared/rsc/rscClientBrowserFallback.d.ts +2 -0
  23. package/dist/types/shared/tsgo.d.ts +27 -0
  24. package/dist/types/types.d.ts +3 -3
  25. package/package.json +15 -13
  26. package/dist/cjs/shared/rsc/rscDisabledClientBrowserRuntime.js +0 -69
  27. package/dist/cjs/shared/rsc/rscDisabledClientEdgeRuntime.js +0 -61
  28. package/dist/cjs/shared/rsc/rscDisabledClientNodeRuntime.js +0 -65
  29. package/dist/cjs/shared/rsc/rscDisabledRuntime.js +0 -140
  30. package/dist/cjs/shared/rsc/rscDisabledRuntimeError.js +0 -42
  31. package/dist/cjs/shared/rsc/rscDisabledServerEdgeRuntime.js +0 -93
  32. package/dist/cjs/shared/rsc/rscDisabledServerNodeRuntime.js +0 -101
  33. package/dist/esm/shared/rsc/rscDisabledClientBrowserRuntime.mjs +0 -10
  34. package/dist/esm/shared/rsc/rscDisabledClientEdgeRuntime.mjs +0 -8
  35. package/dist/esm/shared/rsc/rscDisabledClientNodeRuntime.mjs +0 -9
  36. package/dist/esm/shared/rsc/rscDisabledRuntime.mjs +0 -92
  37. package/dist/esm/shared/rsc/rscDisabledRuntimeError.mjs +0 -4
  38. package/dist/esm/shared/rsc/rscDisabledServerEdgeRuntime.mjs +0 -16
  39. package/dist/esm/shared/rsc/rscDisabledServerNodeRuntime.mjs +0 -18
  40. package/dist/esm-node/shared/rsc/rscDisabledClientBrowserRuntime.mjs +0 -11
  41. package/dist/esm-node/shared/rsc/rscDisabledClientEdgeRuntime.mjs +0 -9
  42. package/dist/esm-node/shared/rsc/rscDisabledClientNodeRuntime.mjs +0 -10
  43. package/dist/esm-node/shared/rsc/rscDisabledRuntime.mjs +0 -97
  44. package/dist/esm-node/shared/rsc/rscDisabledRuntimeError.mjs +0 -5
  45. package/dist/esm-node/shared/rsc/rscDisabledServerEdgeRuntime.mjs +0 -17
  46. package/dist/esm-node/shared/rsc/rscDisabledServerNodeRuntime.mjs +0 -19
  47. package/dist/types/shared/rsc/rscDisabledClientBrowserRuntime.d.ts +0 -9
  48. package/dist/types/shared/rsc/rscDisabledClientEdgeRuntime.d.ts +0 -7
  49. package/dist/types/shared/rsc/rscDisabledClientNodeRuntime.d.ts +0 -8
  50. package/dist/types/shared/rsc/rscDisabledRuntime.d.ts +0 -2
  51. package/dist/types/shared/rsc/rscDisabledRuntimeError.d.ts +0 -1
  52. package/dist/types/shared/rsc/rscDisabledServerEdgeRuntime.d.ts +0 -15
  53. package/dist/types/shared/rsc/rscDisabledServerNodeRuntime.d.ts +0 -17
@@ -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>> };
@@ -2,6 +2,7 @@ import { type BuilderInstance, createRspackBuilder } from './createBuilder.js';
2
2
  import type { CreateBuilderOptions } from './types.js';
3
3
  export { type ChainIdentifier, type ConfigChain, logger, type NormalizedConfig, type RsbuildConfig, type RsbuildContext, type RsbuildPlugin, type RsbuildPlugins, type RsbuildTarget, type Rspack, type RspackChain, } from '@rsbuild/core';
4
4
  export { parseConfig as parseRspackConfig } from './createBuilder.js';
5
+ export { refreshTsgoCheckerConfig } from './shared/tsgo.js';
5
6
  export { castArray, isHtmlDisabled, RUNTIME_CHUNK_NAME, RUNTIME_CHUNK_REGEX, SERVICE_WORKER_ENVIRONMENT_NAME, } from './shared/utils.js';
6
7
  export type { BuilderConfig, BundlerType, CacheGroup, MetaOptions, MultiStats, RspackConfig, Stats, ToolsDevServerConfig, } from './types.js';
7
8
  export type { BuilderInstance, CreateBuilderOptions };
@@ -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
+ };