path-serializer 0.0.2 → 0.0.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.
@@ -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
+ }