@rslib/core 0.17.2 → 0.18.1
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/dist/800.js +41 -2
- package/dist/entryModuleLoader.js +1 -18
- package/dist/index.js +22 -75
- package/dist-types/constant.d.ts +0 -3
- package/dist-types/plugins/EntryChunkPlugin.d.ts +2 -1
- package/package.json +7 -7
- package/dist/121.js +0 -43
package/dist/800.js
CHANGED
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
import node_path, { basename, dirname, extname, isAbsolute, join } from "node:path";
|
|
2
|
-
|
|
2
|
+
const DEFAULT_CONFIG_NAME = 'rslib.config';
|
|
3
|
+
const DEFAULT_CONFIG_EXTENSIONS = [
|
|
4
|
+
'.js',
|
|
5
|
+
'.ts',
|
|
6
|
+
'.mjs',
|
|
7
|
+
'.mts',
|
|
8
|
+
'.cjs',
|
|
9
|
+
'.cts'
|
|
10
|
+
];
|
|
11
|
+
const SWC_HELPERS = '@swc/helpers';
|
|
12
|
+
const DTS_EXTENSIONS = [
|
|
13
|
+
'd.ts',
|
|
14
|
+
'd.mts',
|
|
15
|
+
'd.cts'
|
|
16
|
+
];
|
|
17
|
+
const JS_EXTENSIONS = [
|
|
18
|
+
'js',
|
|
19
|
+
'mjs',
|
|
20
|
+
'jsx',
|
|
21
|
+
'(?<!\\.d\\.)ts',
|
|
22
|
+
'(?<!\\.d\\.)mts',
|
|
23
|
+
'(?<!\\.d\\.)cts',
|
|
24
|
+
'tsx',
|
|
25
|
+
'cjs',
|
|
26
|
+
'cjsx',
|
|
27
|
+
'mjsx',
|
|
28
|
+
'mtsx',
|
|
29
|
+
'ctsx'
|
|
30
|
+
];
|
|
31
|
+
const CSS_EXTENSIONS = [
|
|
32
|
+
'css',
|
|
33
|
+
'sass',
|
|
34
|
+
'scss',
|
|
35
|
+
'less',
|
|
36
|
+
'styl',
|
|
37
|
+
'stylus'
|
|
38
|
+
];
|
|
39
|
+
const JS_EXTENSIONS_PATTERN = new RegExp(`\\.(${JS_EXTENSIONS.join('|')})$`);
|
|
40
|
+
const CSS_EXTENSIONS_PATTERN = new RegExp(`\\.(${CSS_EXTENSIONS.join('|')})$`);
|
|
41
|
+
const DTS_EXTENSIONS_PATTERN = new RegExp(`\\.(${DTS_EXTENSIONS.join('|')})$`);
|
|
3
42
|
function getUndoPath(filename, outputPathArg, enforceRelative) {
|
|
4
43
|
let depth = -1;
|
|
5
44
|
let append = '';
|
|
@@ -49,4 +88,4 @@ const BASE_URI = 'webpack://';
|
|
|
49
88
|
const AUTO_PUBLIC_PATH = '__mini_css_extract_plugin_public_path_auto__';
|
|
50
89
|
const ABSOLUTE_PUBLIC_PATH = `${BASE_URI}/mini-css-extract-plugin/`;
|
|
51
90
|
const SINGLE_DOT_PATH_SEGMENT = '__mini_css_extract_plugin_single_dot_path_segment__';
|
|
52
|
-
export { ABSOLUTE_PUBLIC_PATH, AUTO_PUBLIC_PATH, BASE_URI, SINGLE_DOT_PATH_SEGMENT, basename, dirname, extname, getUndoPath, isAbsolute, isCssFile, isCssGlobalFile, isCssModulesFile, join, node_path };
|
|
91
|
+
export { ABSOLUTE_PUBLIC_PATH, AUTO_PUBLIC_PATH, BASE_URI, CSS_EXTENSIONS_PATTERN, DEFAULT_CONFIG_EXTENSIONS, DEFAULT_CONFIG_NAME, DTS_EXTENSIONS_PATTERN, JS_EXTENSIONS_PATTERN, SINGLE_DOT_PATH_SEGMENT, SWC_HELPERS, basename, dirname, extname, getUndoPath, isAbsolute, isCssFile, isCssGlobalFile, isCssModulesFile, join, node_path };
|
|
@@ -1,22 +1,5 @@
|
|
|
1
|
-
import { SHEBANG_REGEX, REACT_DIRECTIVE_REGEX } from "./121.js";
|
|
2
|
-
function splitFromFirstLine(text) {
|
|
3
|
-
const match = text.match(/(\r\n|\n)/);
|
|
4
|
-
if (!match) return [
|
|
5
|
-
text,
|
|
6
|
-
''
|
|
7
|
-
];
|
|
8
|
-
return [
|
|
9
|
-
text.slice(0, match.index),
|
|
10
|
-
text.slice(match.index)
|
|
11
|
-
];
|
|
12
|
-
}
|
|
13
1
|
const entryModuleLoader_loader = function(source) {
|
|
14
|
-
|
|
15
|
-
const [firstLine1, rest] = splitFromFirstLine(result);
|
|
16
|
-
if (SHEBANG_REGEX.test(firstLine1)) result = rest;
|
|
17
|
-
const [firstLine2, rest2] = splitFromFirstLine(result);
|
|
18
|
-
if (REACT_DIRECTIVE_REGEX.test(firstLine2)) result = rest2;
|
|
19
|
-
return result;
|
|
2
|
+
return source;
|
|
20
3
|
};
|
|
21
4
|
const entryModuleLoader = entryModuleLoader_loader;
|
|
22
5
|
export default entryModuleLoader;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__ from "@rsbuild/core";
|
|
2
|
-
import node_fs, {
|
|
2
|
+
import node_fs, { promises } from "node:fs";
|
|
3
3
|
import { glob } from "../compiled/tinyglobby/index.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import picocolors from "../compiled/picocolors/index.js";
|
|
@@ -8,8 +8,7 @@ import node_fs_promises from "node:fs/promises";
|
|
|
8
8
|
import { createRequire as external_module_createRequire } from "module";
|
|
9
9
|
import { EventEmitter } from "events";
|
|
10
10
|
import node_util from "node:util";
|
|
11
|
-
import { basename as external_node_path_basename, node_path, extname,
|
|
12
|
-
import { DEFAULT_CONFIG_NAME, SHEBANG_REGEX, DTS_EXTENSIONS_PATTERN, SWC_HELPERS, CSS_EXTENSIONS_PATTERN, JS_EXTENSIONS_PATTERN, DEFAULT_CONFIG_EXTENSIONS, REACT_DIRECTIVE_REGEX } from "./121.js";
|
|
11
|
+
import { basename as external_node_path_basename, node_path, extname, DEFAULT_CONFIG_NAME, dirname, DTS_EXTENSIONS_PATTERN, SWC_HELPERS, CSS_EXTENSIONS_PATTERN, JS_EXTENSIONS_PATTERN, BASE_URI, join, getUndoPath, ABSOLUTE_PUBLIC_PATH, isCssFile, AUTO_PUBLIC_PATH, isAbsolute, isCssGlobalFile, DEFAULT_CONFIG_EXTENSIONS, SINGLE_DOT_PATH_SEGMENT, isCssModulesFile } from "./800.js";
|
|
13
12
|
const LibSvgrPatchPlugin_pluginName = 'LIB_SVGR_PATCH_PLUGIN';
|
|
14
13
|
const PUBLIC_PATH_PLACEHOLDER = '__RSLIB_SVGR_AUTO_PUBLIC_PATH__';
|
|
15
14
|
class LibSvgrPatchPlugin {
|
|
@@ -265,19 +264,8 @@ const IMPORT_META_URL_SHIM = `const __rslib_import_meta_url__ = /*#__PURE__*/ (f
|
|
|
265
264
|
new URL('main.js', document.baseURI).href;
|
|
266
265
|
})();
|
|
267
266
|
`;
|
|
268
|
-
const matchFirstLine = (source, regex)=>{
|
|
269
|
-
const lineBreakPos = source.match(/(\r\n|\n)/);
|
|
270
|
-
const firstLineContent = source.slice(0, lineBreakPos?.index);
|
|
271
|
-
const matched = regex.exec(firstLineContent);
|
|
272
|
-
if (!matched) return false;
|
|
273
|
-
return matched[0];
|
|
274
|
-
};
|
|
275
267
|
class EntryChunkPlugin {
|
|
276
|
-
reactDirectives = {};
|
|
277
268
|
shimsInjectedAssets = new Set();
|
|
278
|
-
shebangChmod = 493;
|
|
279
|
-
shebangEntries = {};
|
|
280
|
-
shebangInjectedAssets = new Set();
|
|
281
269
|
enabledImportMetaUrlShim;
|
|
282
270
|
contextToWatch = null;
|
|
283
271
|
constructor({ enabledImportMetaUrlShim = true, contextToWatch }){
|
|
@@ -291,39 +279,10 @@ class EntryChunkPlugin {
|
|
|
291
279
|
if (!contextDep.has(this.contextToWatch)) contextDep.add(this.contextToWatch);
|
|
292
280
|
});
|
|
293
281
|
compiler.hooks.make.tap(EntryChunkPlugin_PLUGIN_NAME, (compilation)=>{
|
|
294
|
-
|
|
295
|
-
for (const [key, value] of compilation.entries){
|
|
296
|
-
const firstDep = value.dependencies[0];
|
|
297
|
-
if (firstDep?.request) entries[key] = firstDep.request;
|
|
298
|
-
}
|
|
299
|
-
for(const name in entries){
|
|
300
|
-
const first = entries[name];
|
|
301
|
-
if (!first) continue;
|
|
302
|
-
const filename = first.split('?')[0];
|
|
303
|
-
const isJs = JS_EXTENSIONS_PATTERN.test(filename);
|
|
304
|
-
if (!isJs) continue;
|
|
305
|
-
const content = compiler.inputFileSystem.readFileSync(filename, {
|
|
306
|
-
encoding: 'utf-8'
|
|
307
|
-
});
|
|
308
|
-
if (content.startsWith("#!")) {
|
|
309
|
-
const shebangMatch = matchFirstLine(content, SHEBANG_REGEX);
|
|
310
|
-
if (shebangMatch) this.shebangEntries[name] = shebangMatch;
|
|
311
|
-
}
|
|
312
|
-
const reactDirective = matchFirstLine(content, REACT_DIRECTIVE_REGEX);
|
|
313
|
-
if (reactDirective) this.reactDirectives[name] = reactDirective;
|
|
314
|
-
}
|
|
315
|
-
});
|
|
316
|
-
compiler.hooks.make.tap(EntryChunkPlugin_PLUGIN_NAME, (compilation)=>{
|
|
317
|
-
compilation.hooks.chunkAsset.tap(EntryChunkPlugin_PLUGIN_NAME, (chunk, filename)=>{
|
|
282
|
+
compilation.hooks.chunkAsset.tap(EntryChunkPlugin_PLUGIN_NAME, (_chunk, filename)=>{
|
|
318
283
|
const isJs = JS_EXTENSIONS_PATTERN.test(filename);
|
|
319
284
|
if (!isJs) return;
|
|
320
285
|
this.shimsInjectedAssets.add(filename);
|
|
321
|
-
const name = chunk.name;
|
|
322
|
-
if (!name) return;
|
|
323
|
-
const shebangEntry = this.shebangEntries[name];
|
|
324
|
-
if (shebangEntry) this.shebangEntries[filename] = shebangEntry;
|
|
325
|
-
const reactDirective = this.reactDirectives[name];
|
|
326
|
-
if (reactDirective) this.reactDirectives[filename] = reactDirective;
|
|
327
286
|
});
|
|
328
287
|
});
|
|
329
288
|
compiler.hooks.make.tap(EntryChunkPlugin_PLUGIN_NAME, (compilation)=>{
|
|
@@ -333,33 +292,14 @@ class EntryChunkPlugin {
|
|
|
333
292
|
for (const name of chunkAsset)compilation.updateAsset(name, (old)=>{
|
|
334
293
|
const oldSource = old.source().toString();
|
|
335
294
|
const replaceSource = new __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.sources.ReplaceSource(old);
|
|
336
|
-
if (oldSource.startsWith('
|
|
295
|
+
if (oldSource.startsWith('#!')) {
|
|
296
|
+
const firstLineEnd = oldSource.indexOf('\n');
|
|
297
|
+
replaceSource.insert(firstLineEnd + 1, IMPORT_META_URL_SHIM);
|
|
298
|
+
} else if (oldSource.startsWith("'use strict'") || oldSource.startsWith('"use strict"')) replaceSource.replace(0, 11, `"use strict";\n${IMPORT_META_URL_SHIM}`);
|
|
337
299
|
else replaceSource.insert(0, IMPORT_META_URL_SHIM);
|
|
338
300
|
return replaceSource;
|
|
339
301
|
});
|
|
340
302
|
});
|
|
341
|
-
compilation.hooks.processAssets.tap({
|
|
342
|
-
name: EntryChunkPlugin_PLUGIN_NAME,
|
|
343
|
-
stage: __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.Compilation.PROCESS_ASSETS_STAGE_DEV_TOOLING - 1
|
|
344
|
-
}, (assets)=>{
|
|
345
|
-
const chunkAsset = Object.keys(assets);
|
|
346
|
-
for (const name of chunkAsset){
|
|
347
|
-
const shebangValue = this.shebangEntries[name];
|
|
348
|
-
const reactDirectiveValue = this.reactDirectives[name];
|
|
349
|
-
if (shebangValue || reactDirectiveValue) compilation.updateAsset(name, (old)=>{
|
|
350
|
-
const replaceSource = new __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__.rspack.sources.ReplaceSource(old);
|
|
351
|
-
if (shebangValue) {
|
|
352
|
-
replaceSource.insert(0, `${shebangValue}\n`);
|
|
353
|
-
this.shebangInjectedAssets.add(name);
|
|
354
|
-
}
|
|
355
|
-
if (reactDirectiveValue) replaceSource.insert(0, `${reactDirectiveValue}\n`);
|
|
356
|
-
return replaceSource;
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
});
|
|
360
|
-
});
|
|
361
|
-
compiler.hooks.assetEmitted.tap(EntryChunkPlugin_PLUGIN_NAME, (file, { targetPath })=>{
|
|
362
|
-
if (this.shebangInjectedAssets.has(file)) chmodSync(targetPath, this.shebangChmod);
|
|
363
303
|
});
|
|
364
304
|
}
|
|
365
305
|
}
|
|
@@ -371,10 +311,10 @@ const entryModuleLoaderRsbuildPlugin = ()=>({
|
|
|
371
311
|
});
|
|
372
312
|
}
|
|
373
313
|
});
|
|
374
|
-
const composeEntryChunkConfig = ({ enabledImportMetaUrlShim, contextToWatch = null })=>({
|
|
375
|
-
plugins: [
|
|
314
|
+
const composeEntryChunkConfig = ({ enabledImportMetaUrlShim, useLoader, contextToWatch = null })=>({
|
|
315
|
+
plugins: useLoader ? [
|
|
376
316
|
entryModuleLoaderRsbuildPlugin()
|
|
377
|
-
],
|
|
317
|
+
] : [],
|
|
378
318
|
tools: {
|
|
379
319
|
rspack: {
|
|
380
320
|
plugins: [
|
|
@@ -1424,6 +1364,7 @@ function composeMinifyConfig(config) {
|
|
|
1424
1364
|
mangle: false,
|
|
1425
1365
|
minify: 'mf' === format,
|
|
1426
1366
|
compress: {
|
|
1367
|
+
directives: false,
|
|
1427
1368
|
defaults: false,
|
|
1428
1369
|
unused: true,
|
|
1429
1370
|
dead_code: true,
|
|
@@ -1520,7 +1461,8 @@ async function createConstantRsbuildConfig() {
|
|
|
1520
1461
|
performance: {
|
|
1521
1462
|
chunkSplit: {
|
|
1522
1463
|
strategy: 'custom'
|
|
1523
|
-
}
|
|
1464
|
+
},
|
|
1465
|
+
buildCache: true
|
|
1524
1466
|
},
|
|
1525
1467
|
tools: {
|
|
1526
1468
|
htmlPlugin: false,
|
|
@@ -2073,7 +2015,11 @@ const composeEntryConfig = async (rawEntry, bundle, root, cssModulesAuto, userOu
|
|
|
2073
2015
|
dot: true
|
|
2074
2016
|
});
|
|
2075
2017
|
const resolvedEntryFiles = globEntryFiles.filter((i)=>!DTS_EXTENSIONS_PATTERN.test(i));
|
|
2076
|
-
if (0 === resolvedEntryFiles.length)
|
|
2018
|
+
if (0 === resolvedEntryFiles.length) {
|
|
2019
|
+
const error = new Error(`No entry files matching ${entryFiles.map((file)=>picocolors.cyan(file)).join(', ')}. Please ensure the entry pattern in ${picocolors.cyan('source.entry')} is correct and points to valid source files.`);
|
|
2020
|
+
error.stack = '';
|
|
2021
|
+
throw error;
|
|
2022
|
+
}
|
|
2077
2023
|
const outBase = await resolveOutBase(resolvedEntryFiles);
|
|
2078
2024
|
function getEntryName(file) {
|
|
2079
2025
|
const { dir, name } = node_path.parse(node_path.relative(outBase, file));
|
|
@@ -2320,6 +2266,7 @@ async function composeLibRsbuildConfig(config, multiCompilerIndex, root, sharedP
|
|
|
2320
2266
|
const cssConfig = composeCssConfig(outBase, cssModulesAuto, config.bundle, banner?.css, footer?.css);
|
|
2321
2267
|
const assetConfig = composeAssetConfig(bundle, format);
|
|
2322
2268
|
const entryChunkConfig = composeEntryChunkConfig({
|
|
2269
|
+
useLoader: true !== advancedEsm && ('esm' === format || 'iife' === format),
|
|
2323
2270
|
enabledImportMetaUrlShim: enabledShims.cjs['import.meta.url'],
|
|
2324
2271
|
contextToWatch: outBase
|
|
2325
2272
|
});
|
|
@@ -3132,7 +3079,7 @@ const applyCommonOptions = (cli)=>{
|
|
|
3132
3079
|
};
|
|
3133
3080
|
function runCli() {
|
|
3134
3081
|
const cli = dist('rslib');
|
|
3135
|
-
cli.version("0.
|
|
3082
|
+
cli.version("0.18.1");
|
|
3136
3083
|
applyCommonOptions(cli);
|
|
3137
3084
|
const buildDescription = `build the library for production ${picocolors.dim('(default if no command is given)')}`;
|
|
3138
3085
|
const buildCommand = cli.command('', buildDescription).alias('build');
|
|
@@ -3248,9 +3195,9 @@ function prepareCli() {
|
|
|
3248
3195
|
setupLogLevel();
|
|
3249
3196
|
const { npm_execpath } = process.env;
|
|
3250
3197
|
if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) logger.log();
|
|
3251
|
-
logger.greet(` Rslib v0.
|
|
3198
|
+
logger.greet(` Rslib v0.18.1\n`);
|
|
3252
3199
|
}
|
|
3253
|
-
const src_version = "0.
|
|
3200
|
+
const src_version = "0.18.1";
|
|
3254
3201
|
export * as rsbuild from "@rsbuild/core";
|
|
3255
3202
|
export { logger } from "../compiled/rslog/index.js";
|
|
3256
3203
|
export { rspack } from "@rsbuild/core";
|
package/dist-types/constant.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
export declare const DEFAULT_CONFIG_NAME = "rslib.config";
|
|
2
2
|
export declare const DEFAULT_CONFIG_EXTENSIONS: readonly [".js", ".ts", ".mjs", ".mts", ".cjs", ".cts"];
|
|
3
3
|
export declare const SWC_HELPERS = "@swc/helpers";
|
|
4
|
-
export declare const SHEBANG_PREFIX = "#!";
|
|
5
|
-
export declare const SHEBANG_REGEX: RegExp;
|
|
6
|
-
export declare const REACT_DIRECTIVE_REGEX: RegExp;
|
|
7
4
|
export declare const JS_EXTENSIONS_PATTERN: RegExp;
|
|
8
5
|
export declare const CSS_EXTENSIONS_PATTERN: RegExp;
|
|
9
6
|
export declare const DTS_EXTENSIONS_PATTERN: RegExp;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type EnvironmentConfig } from '@rsbuild/core';
|
|
2
|
-
export declare const composeEntryChunkConfig: ({ enabledImportMetaUrlShim, contextToWatch, }: {
|
|
2
|
+
export declare const composeEntryChunkConfig: ({ enabledImportMetaUrlShim, useLoader, contextToWatch, }: {
|
|
3
|
+
useLoader: boolean;
|
|
3
4
|
enabledImportMetaUrlShim: boolean;
|
|
4
5
|
contextToWatch: string | null;
|
|
5
6
|
}) => EnvironmentConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rslib/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.1",
|
|
4
4
|
"description": "The Rsbuild-based library development tool.",
|
|
5
5
|
"homepage": "https://rslib.rs",
|
|
6
6
|
"bugs": {
|
|
@@ -36,21 +36,21 @@
|
|
|
36
36
|
"types.d.ts"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@rsbuild/core": "~1.6.
|
|
40
|
-
"rsbuild-plugin-dts": "0.
|
|
39
|
+
"@rsbuild/core": "~1.6.8",
|
|
40
|
+
"rsbuild-plugin-dts": "0.18.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@module-federation/rsbuild-plugin": "^0.21.
|
|
43
|
+
"@module-federation/rsbuild-plugin": "^0.21.6",
|
|
44
44
|
"@types/fs-extra": "^11.0.4",
|
|
45
45
|
"cac": "^6.7.14",
|
|
46
46
|
"chokidar": "^4.0.3",
|
|
47
47
|
"fs-extra": "^11.3.2",
|
|
48
|
-
"memfs": "^4.
|
|
48
|
+
"memfs": "^4.51.0",
|
|
49
49
|
"path-serializer": "0.5.1",
|
|
50
50
|
"picocolors": "1.1.1",
|
|
51
|
-
"prebundle": "1.
|
|
51
|
+
"prebundle": "1.6.0",
|
|
52
52
|
"rsbuild-plugin-publint": "^0.3.3",
|
|
53
|
-
"rslib": "npm:@rslib/core@0.
|
|
53
|
+
"rslib": "npm:@rslib/core@0.18.0",
|
|
54
54
|
"rslog": "^1.3.0",
|
|
55
55
|
"tinyglobby": "0.2.14",
|
|
56
56
|
"tsconfck": "3.1.6",
|
package/dist/121.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
const DEFAULT_CONFIG_NAME = 'rslib.config';
|
|
2
|
-
const DEFAULT_CONFIG_EXTENSIONS = [
|
|
3
|
-
'.js',
|
|
4
|
-
'.ts',
|
|
5
|
-
'.mjs',
|
|
6
|
-
'.mts',
|
|
7
|
-
'.cjs',
|
|
8
|
-
'.cts'
|
|
9
|
-
];
|
|
10
|
-
const SWC_HELPERS = '@swc/helpers';
|
|
11
|
-
const SHEBANG_REGEX = /#!.*[\s\n\r]*$/;
|
|
12
|
-
const REACT_DIRECTIVE_REGEX = /^['"]use (client|server)['"](;?)[\s\n\r]*$/;
|
|
13
|
-
const DTS_EXTENSIONS = [
|
|
14
|
-
'd.ts',
|
|
15
|
-
'd.mts',
|
|
16
|
-
'd.cts'
|
|
17
|
-
];
|
|
18
|
-
const JS_EXTENSIONS = [
|
|
19
|
-
'js',
|
|
20
|
-
'mjs',
|
|
21
|
-
'jsx',
|
|
22
|
-
'(?<!\\.d\\.)ts',
|
|
23
|
-
'(?<!\\.d\\.)mts',
|
|
24
|
-
'(?<!\\.d\\.)cts',
|
|
25
|
-
'tsx',
|
|
26
|
-
'cjs',
|
|
27
|
-
'cjsx',
|
|
28
|
-
'mjsx',
|
|
29
|
-
'mtsx',
|
|
30
|
-
'ctsx'
|
|
31
|
-
];
|
|
32
|
-
const CSS_EXTENSIONS = [
|
|
33
|
-
'css',
|
|
34
|
-
'sass',
|
|
35
|
-
'scss',
|
|
36
|
-
'less',
|
|
37
|
-
'styl',
|
|
38
|
-
'stylus'
|
|
39
|
-
];
|
|
40
|
-
const JS_EXTENSIONS_PATTERN = new RegExp(`\\.(${JS_EXTENSIONS.join('|')})$`);
|
|
41
|
-
const CSS_EXTENSIONS_PATTERN = new RegExp(`\\.(${CSS_EXTENSIONS.join('|')})$`);
|
|
42
|
-
const DTS_EXTENSIONS_PATTERN = new RegExp(`\\.(${DTS_EXTENSIONS.join('|')})$`);
|
|
43
|
-
export { CSS_EXTENSIONS_PATTERN, DEFAULT_CONFIG_EXTENSIONS, DEFAULT_CONFIG_NAME, DTS_EXTENSIONS_PATTERN, JS_EXTENSIONS_PATTERN, REACT_DIRECTIVE_REGEX, SHEBANG_REGEX, SWC_HELPERS };
|