path-serializer 0.0.2 → 0.0.3

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.
@@ -0,0 +1,333 @@
1
+ export default {
2
+ html: {
3
+ meta: {
4
+ charset: {
5
+ charset: 'UTF-8'
6
+ },
7
+ viewport: 'width=device-width, initial-scale=1.0'
8
+ },
9
+ title: 'Rsbuild App',
10
+ inject: 'head',
11
+ mountId: 'root',
12
+ crossorigin: false,
13
+ outputStructure: 'flat',
14
+ scriptLoading: 'defer'
15
+ },
16
+ source: {
17
+ alias: {},
18
+ define: {},
19
+ aliasStrategy: 'prefer-tsconfig',
20
+ preEntry: [],
21
+ decorators: {
22
+ version: '2022-03'
23
+ },
24
+ tsconfigPath: '/Users/bytedance/Documents/codes/path-serializer/tsconfig.json',
25
+ entry: {
26
+ main: './src/index.ts'
27
+ }
28
+ },
29
+ output: {
30
+ target: 'node',
31
+ distPath: {
32
+ root: './dist/cjs',
33
+ css: 'static/css',
34
+ svg: 'static/svg',
35
+ font: 'static/font',
36
+ html: '/',
37
+ wasm: 'static/wasm',
38
+ image: 'static/image',
39
+ media: 'static/media',
40
+ js: './'
41
+ },
42
+ assetPrefix: '/',
43
+ filename: {
44
+ js: '[name].cjs'
45
+ },
46
+ charset: 'ascii',
47
+ polyfill: 'off',
48
+ dataUriLimit: {
49
+ svg: 4096,
50
+ font: 4096,
51
+ image: 4096,
52
+ media: 4096
53
+ },
54
+ legalComments: 'linked',
55
+ injectStyles: false,
56
+ minify: false,
57
+ manifest: false,
58
+ sourceMap: {
59
+ js: undefined,
60
+ css: false
61
+ },
62
+ filenameHash: false,
63
+ inlineScripts: false,
64
+ inlineStyles: false,
65
+ cssModules: {
66
+ auto: true,
67
+ namedExport: false,
68
+ exportGlobals: false,
69
+ exportLocalsConvention: 'camelCase'
70
+ },
71
+ emitAssets: true,
72
+ overrideBrowserslist: [
73
+ 'last 1 node versions'
74
+ ],
75
+ externals: [
76
+ 'assert',
77
+ 'assert/strict',
78
+ 'async_hooks',
79
+ 'buffer',
80
+ 'child_process',
81
+ 'cluster',
82
+ 'console',
83
+ 'constants',
84
+ 'crypto',
85
+ 'dgram',
86
+ 'diagnostics_channel',
87
+ 'dns',
88
+ 'dns/promises',
89
+ 'domain',
90
+ 'events',
91
+ 'fs',
92
+ 'fs/promises',
93
+ 'http',
94
+ 'http2',
95
+ 'https',
96
+ 'inspector',
97
+ 'inspector/promises',
98
+ 'module',
99
+ 'net',
100
+ 'os',
101
+ 'path',
102
+ 'path/posix',
103
+ 'path/win32',
104
+ 'perf_hooks',
105
+ 'process',
106
+ 'punycode',
107
+ 'querystring',
108
+ 'readline',
109
+ 'readline/promises',
110
+ 'repl',
111
+ 'stream',
112
+ 'stream/consumers',
113
+ 'stream/promises',
114
+ 'stream/web',
115
+ 'string_decoder',
116
+ 'sys',
117
+ 'timers',
118
+ 'timers/promises',
119
+ 'tls',
120
+ 'trace_events',
121
+ 'tty',
122
+ 'url',
123
+ 'util',
124
+ 'util/types',
125
+ 'v8',
126
+ 'vm',
127
+ 'wasi',
128
+ 'worker_threads',
129
+ 'zlib',
130
+ /^node:/,
131
+ 'pnpapi'
132
+ ]
133
+ },
134
+ tools: {
135
+ cssExtract: {
136
+ loaderOptions: {},
137
+ pluginOptions: {
138
+ ignoreOrder: true
139
+ }
140
+ },
141
+ rspack: [
142
+ {
143
+ externalsType: 'commonjs',
144
+ output: {
145
+ iife: false,
146
+ chunkFormat: 'commonjs',
147
+ library: {
148
+ type: 'commonjs'
149
+ }
150
+ }
151
+ },
152
+ (config) => {
153
+ config.target = ["es2022"];
154
+ return config;
155
+ },
156
+ {
157
+ target: [
158
+ 'node'
159
+ ]
160
+ },
161
+ {
162
+ optimization: {
163
+ moduleIds: 'named'
164
+ },
165
+ experiments: {
166
+ rspackFuture: {
167
+ bundlerInfo: {
168
+ force: false
169
+ }
170
+ }
171
+ }
172
+ }
173
+ ],
174
+ htmlPlugin: false
175
+ },
176
+ security: {
177
+ nonce: '',
178
+ sri: {
179
+ enable: false
180
+ }
181
+ },
182
+ performance: {
183
+ profile: false,
184
+ buildCache: true,
185
+ printFileSize: true,
186
+ removeConsole: false,
187
+ removeMomentLocale: false,
188
+ chunkSplit: {
189
+ strategy: 'split-by-experience'
190
+ }
191
+ },
192
+ dev: {
193
+ assetPrefix: '/',
194
+ lazyCompilation: undefined,
195
+ progressBar: false,
196
+ hmr: true,
197
+ liveReload: true,
198
+ writeToDisk: false,
199
+ client: {
200
+ path: '/rsbuild-hmr',
201
+ port: '',
202
+ host: '',
203
+ overlay: true
204
+ }
205
+ },
206
+ _privateMeta: {
207
+ configFilePath: '/Users/bytedance/Documents/codes/path-serializer/rslib.config.ts'
208
+ },
209
+ dts: {
210
+ bundle: true
211
+ },
212
+ plugins: [
213
+ {
214
+ name: 'rsbuild:dts',
215
+ setup(api) {
216
+ options.bundle = options.bundle ?? false;
217
+ options.abortOnError = options.abortOnError ?? true;
218
+ const dtsPromises = [];
219
+ let promisesResult = [];
220
+ api.onBeforeEnvironmentCompile(
221
+ ({ isWatch, isFirstCompile, environment }) => {
222
+ if (!isFirstCompile) {
223
+ return;
224
+ }
225
+ const { config } = environment;
226
+ options.distPath = options.distPath ?? config.output?.distPath?.root;
227
+ const jsExtension = extname(__filename);
228
+ const childProcess = fork(join(__dirname, `./dts${jsExtension}`), [], {
229
+ stdio: "inherit"
230
+ });
231
+ const dtsGenOptions = {
232
+ ...options,
233
+ // TODO: temporarily use main as dts entry, only accept single entry
234
+ entryPath: config.source?.entry?.main,
235
+ tsconfigPath: config.source.tsconfigPath,
236
+ name: environment.name,
237
+ cwd: api.context.rootPath,
238
+ isWatch
239
+ };
240
+ childProcess.send(dtsGenOptions);
241
+ dtsPromises.push(
242
+ new Promise((resolve) => {
243
+ childProcess.on("message", (message) => {
244
+ if (message === "success") {
245
+ resolve({
246
+ status: "success"
247
+ });
248
+ } else if (message === "error") {
249
+ resolve({
250
+ status: "error",
251
+ errorMessage: `Error occurred in ${environment.name} DTS generation`
252
+ });
253
+ }
254
+ });
255
+ })
256
+ );
257
+ }
258
+ );
259
+ api.onAfterBuild(async ({ isFirstCompile }) => {
260
+ if (!isFirstCompile) {
261
+ return;
262
+ }
263
+ promisesResult = await Promise.all(dtsPromises);
264
+ });
265
+ api.onAfterBuild({
266
+ handler: ({ isFirstCompile }) => {
267
+ if (!isFirstCompile) {
268
+ return;
269
+ }
270
+ for (const result of promisesResult) {
271
+ if (result.status === "error") {
272
+ if (options.abortOnError) {
273
+ throw new Error(result.errorMessage);
274
+ }
275
+ result.errorMessage && logger.error(result.errorMessage);
276
+ logger.warn(
277
+ "With the `abortOnError` configuration currently turned off, type errors do not cause build failures, but they do not guarantee proper type file output."
278
+ );
279
+ }
280
+ }
281
+ },
282
+ order: "post"
283
+ });
284
+ }
285
+ }
286
+ ],
287
+ server: {
288
+ port: 3000,
289
+ host: '0.0.0.0',
290
+ open: false,
291
+ htmlFallback: 'index',
292
+ compress: true,
293
+ printUrls: true,
294
+ strictPort: false
295
+ },
296
+ pluginNames: [
297
+ 'rsbuild:basic',
298
+ 'rsbuild:entry',
299
+ 'rsbuild:cache',
300
+ 'rsbuild:target',
301
+ 'rsbuild:output',
302
+ 'rsbuild:resolve',
303
+ 'rsbuild:file-size',
304
+ 'rsbuild:clean-output',
305
+ 'rsbuild:asset',
306
+ 'rsbuild:html',
307
+ 'rsbuild:app-icon',
308
+ 'rsbuild:wasm',
309
+ 'rsbuild:moment',
310
+ 'rsbuild:node-addons',
311
+ 'rsbuild:define',
312
+ 'rsbuild:css',
313
+ 'rsbuild:minimize',
314
+ 'rsbuild:progress',
315
+ 'rsbuild:swc',
316
+ 'rsbuild:externals',
317
+ 'rsbuild:split-chunks',
318
+ 'rsbuild:open',
319
+ 'rsbuild:inline-chunk',
320
+ 'rsbuild:rsdoctor',
321
+ 'rsbuild:resource-hints',
322
+ 'rsbuild:performance',
323
+ 'rsbuild:bundle-analyzer',
324
+ 'rsbuild:server',
325
+ 'rsbuild:manifest',
326
+ 'rsbuild:module-federation',
327
+ 'rsbuild:rspack-profile',
328
+ 'rsbuild:lazy-compilation',
329
+ 'rsbuild:sri',
330
+ 'rsbuild:nonce',
331
+ 'rsbuild:dts'
332
+ ]
333
+ }
@@ -0,0 +1,339 @@
1
+ export default {
2
+ html: {
3
+ meta: {
4
+ charset: {
5
+ charset: 'UTF-8'
6
+ },
7
+ viewport: 'width=device-width, initial-scale=1.0'
8
+ },
9
+ title: 'Rsbuild App',
10
+ inject: 'head',
11
+ mountId: 'root',
12
+ crossorigin: false,
13
+ outputStructure: 'flat',
14
+ scriptLoading: 'defer'
15
+ },
16
+ source: {
17
+ alias: {},
18
+ define: {},
19
+ aliasStrategy: 'prefer-tsconfig',
20
+ preEntry: [],
21
+ decorators: {
22
+ version: '2022-03'
23
+ },
24
+ tsconfigPath: '/Users/bytedance/Documents/codes/path-serializer/tsconfig.json',
25
+ entry: {
26
+ main: './src/index.ts'
27
+ }
28
+ },
29
+ output: {
30
+ target: 'node',
31
+ distPath: {
32
+ root: './dist/esm',
33
+ css: 'static/css',
34
+ svg: 'static/svg',
35
+ font: 'static/font',
36
+ html: '/',
37
+ wasm: 'static/wasm',
38
+ image: 'static/image',
39
+ media: 'static/media',
40
+ js: './'
41
+ },
42
+ assetPrefix: '/',
43
+ filename: {
44
+ js: '[name].js'
45
+ },
46
+ charset: 'ascii',
47
+ polyfill: 'off',
48
+ dataUriLimit: {
49
+ svg: 4096,
50
+ font: 4096,
51
+ image: 4096,
52
+ media: 4096
53
+ },
54
+ legalComments: 'linked',
55
+ injectStyles: false,
56
+ minify: false,
57
+ manifest: false,
58
+ sourceMap: {
59
+ js: undefined,
60
+ css: false
61
+ },
62
+ filenameHash: false,
63
+ inlineScripts: false,
64
+ inlineStyles: false,
65
+ cssModules: {
66
+ auto: true,
67
+ namedExport: false,
68
+ exportGlobals: false,
69
+ exportLocalsConvention: 'camelCase'
70
+ },
71
+ emitAssets: true,
72
+ overrideBrowserslist: [
73
+ 'last 1 node versions'
74
+ ],
75
+ externals: [
76
+ 'assert',
77
+ 'assert/strict',
78
+ 'async_hooks',
79
+ 'buffer',
80
+ 'child_process',
81
+ 'cluster',
82
+ 'console',
83
+ 'constants',
84
+ 'crypto',
85
+ 'dgram',
86
+ 'diagnostics_channel',
87
+ 'dns',
88
+ 'dns/promises',
89
+ 'domain',
90
+ 'events',
91
+ 'fs',
92
+ 'fs/promises',
93
+ 'http',
94
+ 'http2',
95
+ 'https',
96
+ 'inspector',
97
+ 'inspector/promises',
98
+ 'module',
99
+ 'net',
100
+ 'os',
101
+ 'path',
102
+ 'path/posix',
103
+ 'path/win32',
104
+ 'perf_hooks',
105
+ 'process',
106
+ 'punycode',
107
+ 'querystring',
108
+ 'readline',
109
+ 'readline/promises',
110
+ 'repl',
111
+ 'stream',
112
+ 'stream/consumers',
113
+ 'stream/promises',
114
+ 'stream/web',
115
+ 'string_decoder',
116
+ 'sys',
117
+ 'timers',
118
+ 'timers/promises',
119
+ 'tls',
120
+ 'trace_events',
121
+ 'tty',
122
+ 'url',
123
+ 'util',
124
+ 'util/types',
125
+ 'v8',
126
+ 'vm',
127
+ 'wasi',
128
+ 'worker_threads',
129
+ 'zlib',
130
+ /^node:/,
131
+ 'pnpapi'
132
+ ]
133
+ },
134
+ tools: {
135
+ cssExtract: {
136
+ loaderOptions: {},
137
+ pluginOptions: {
138
+ ignoreOrder: true
139
+ }
140
+ },
141
+ rspack: [
142
+ {
143
+ externalsType: 'module-import',
144
+ output: {
145
+ module: true,
146
+ chunkFormat: 'module',
147
+ library: {
148
+ type: 'modern-module'
149
+ }
150
+ },
151
+ optimization: {
152
+ concatenateModules: true
153
+ },
154
+ experiments: {
155
+ outputModule: true
156
+ }
157
+ },
158
+ (config) => {
159
+ config.target = ["es2022"];
160
+ return config;
161
+ },
162
+ {
163
+ target: [
164
+ 'node'
165
+ ]
166
+ },
167
+ {
168
+ optimization: {
169
+ moduleIds: 'named'
170
+ },
171
+ experiments: {
172
+ rspackFuture: {
173
+ bundlerInfo: {
174
+ force: false
175
+ }
176
+ }
177
+ }
178
+ }
179
+ ],
180
+ htmlPlugin: false
181
+ },
182
+ security: {
183
+ nonce: '',
184
+ sri: {
185
+ enable: false
186
+ }
187
+ },
188
+ performance: {
189
+ profile: false,
190
+ buildCache: true,
191
+ printFileSize: true,
192
+ removeConsole: false,
193
+ removeMomentLocale: false,
194
+ chunkSplit: {
195
+ strategy: 'split-by-experience'
196
+ }
197
+ },
198
+ dev: {
199
+ assetPrefix: '/',
200
+ lazyCompilation: undefined,
201
+ progressBar: false,
202
+ hmr: true,
203
+ liveReload: true,
204
+ writeToDisk: false,
205
+ client: {
206
+ path: '/rsbuild-hmr',
207
+ port: '',
208
+ host: '',
209
+ overlay: true
210
+ }
211
+ },
212
+ _privateMeta: {
213
+ configFilePath: '/Users/bytedance/Documents/codes/path-serializer/rslib.config.ts'
214
+ },
215
+ dts: {
216
+ bundle: true
217
+ },
218
+ plugins: [
219
+ {
220
+ name: 'rsbuild:dts',
221
+ setup(api) {
222
+ options.bundle = options.bundle ?? false;
223
+ options.abortOnError = options.abortOnError ?? true;
224
+ const dtsPromises = [];
225
+ let promisesResult = [];
226
+ api.onBeforeEnvironmentCompile(
227
+ ({ isWatch, isFirstCompile, environment }) => {
228
+ if (!isFirstCompile) {
229
+ return;
230
+ }
231
+ const { config } = environment;
232
+ options.distPath = options.distPath ?? config.output?.distPath?.root;
233
+ const jsExtension = extname(__filename);
234
+ const childProcess = fork(join(__dirname, `./dts${jsExtension}`), [], {
235
+ stdio: "inherit"
236
+ });
237
+ const dtsGenOptions = {
238
+ ...options,
239
+ // TODO: temporarily use main as dts entry, only accept single entry
240
+ entryPath: config.source?.entry?.main,
241
+ tsconfigPath: config.source.tsconfigPath,
242
+ name: environment.name,
243
+ cwd: api.context.rootPath,
244
+ isWatch
245
+ };
246
+ childProcess.send(dtsGenOptions);
247
+ dtsPromises.push(
248
+ new Promise((resolve) => {
249
+ childProcess.on("message", (message) => {
250
+ if (message === "success") {
251
+ resolve({
252
+ status: "success"
253
+ });
254
+ } else if (message === "error") {
255
+ resolve({
256
+ status: "error",
257
+ errorMessage: `Error occurred in ${environment.name} DTS generation`
258
+ });
259
+ }
260
+ });
261
+ })
262
+ );
263
+ }
264
+ );
265
+ api.onAfterBuild(async ({ isFirstCompile }) => {
266
+ if (!isFirstCompile) {
267
+ return;
268
+ }
269
+ promisesResult = await Promise.all(dtsPromises);
270
+ });
271
+ api.onAfterBuild({
272
+ handler: ({ isFirstCompile }) => {
273
+ if (!isFirstCompile) {
274
+ return;
275
+ }
276
+ for (const result of promisesResult) {
277
+ if (result.status === "error") {
278
+ if (options.abortOnError) {
279
+ throw new Error(result.errorMessage);
280
+ }
281
+ result.errorMessage && logger.error(result.errorMessage);
282
+ logger.warn(
283
+ "With the `abortOnError` configuration currently turned off, type errors do not cause build failures, but they do not guarantee proper type file output."
284
+ );
285
+ }
286
+ }
287
+ },
288
+ order: "post"
289
+ });
290
+ }
291
+ }
292
+ ],
293
+ server: {
294
+ port: 3000,
295
+ host: '0.0.0.0',
296
+ open: false,
297
+ htmlFallback: 'index',
298
+ compress: true,
299
+ printUrls: true,
300
+ strictPort: false
301
+ },
302
+ pluginNames: [
303
+ 'rsbuild:basic',
304
+ 'rsbuild:entry',
305
+ 'rsbuild:cache',
306
+ 'rsbuild:target',
307
+ 'rsbuild:output',
308
+ 'rsbuild:resolve',
309
+ 'rsbuild:file-size',
310
+ 'rsbuild:clean-output',
311
+ 'rsbuild:asset',
312
+ 'rsbuild:html',
313
+ 'rsbuild:app-icon',
314
+ 'rsbuild:wasm',
315
+ 'rsbuild:moment',
316
+ 'rsbuild:node-addons',
317
+ 'rsbuild:define',
318
+ 'rsbuild:css',
319
+ 'rsbuild:minimize',
320
+ 'rsbuild:progress',
321
+ 'rsbuild:swc',
322
+ 'rsbuild:externals',
323
+ 'rsbuild:split-chunks',
324
+ 'rsbuild:open',
325
+ 'rsbuild:inline-chunk',
326
+ 'rsbuild:rsdoctor',
327
+ 'rsbuild:resource-hints',
328
+ 'rsbuild:performance',
329
+ 'rsbuild:bundle-analyzer',
330
+ 'rsbuild:server',
331
+ 'rsbuild:manifest',
332
+ 'rsbuild:module-federation',
333
+ 'rsbuild:rspack-profile',
334
+ 'rsbuild:lazy-compilation',
335
+ 'rsbuild:sri',
336
+ 'rsbuild:nonce',
337
+ 'rsbuild:dts'
338
+ ]
339
+ }