extension-develop 4.0.21 → 4.0.22
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/0~dev-server.mjs +2 -1
- package/dist/0~rspack-config.mjs +137 -189
- package/dist/0~stats-handler.mjs +74 -10
- package/dist/101.mjs +98 -107
- package/dist/266.mjs +41 -9
- package/dist/839.mjs +68 -17
- package/dist/845.mjs +25 -29
- package/dist/dev-server/compiler-hooks.d.ts +1 -0
- package/dist/dev-server/messages.d.ts +1 -1
- package/dist/lib/messages.d.ts +6 -8
- package/dist/lib/stats-handler.d.ts +13 -0
- package/dist/plugin-compilation/boring.d.ts +1 -1
- package/dist/plugin-compilation/compilation-lib/messages.d.ts +0 -2
- package/dist/plugin-compilation/index.d.ts +2 -0
- package/dist/plugin-compilation/zip-artifacts.d.ts +7 -0
- package/package.json +1 -1
- package/dist/0~branding.mjs +0 -26
- package/dist/plugin-compilation/compilation-lib/shared-state.d.ts +0 -7
package/dist/839.mjs
CHANGED
|
@@ -2,10 +2,10 @@ import { createRequire as __extjsCreateRequire } from "node:module"; const requi
|
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { execFileSync, spawn, spawnSync as external_node_child_process_spawnSync } from "node:child_process";
|
|
4
4
|
import { buildExecEnv, detectPackageManagerFromLockfile } from "prefers-yarn";
|
|
5
|
-
import
|
|
5
|
+
import "pintor";
|
|
6
6
|
import { EventEmitter } from "node:events";
|
|
7
7
|
import { browserRowValue, isDebug, CODES, ENVELOPE, prefix as messaging_prefix, claimCardKey, card } from "./349.mjs";
|
|
8
|
-
import { package_namespaceObject, buildWarningsDetails, sanitize, getDirs, projectInstallFallbackToNpm, assertNoManagedDependencyConflicts, debugDirs, browserLaunchFailed,
|
|
8
|
+
import { package_namespaceObject, buildWarningsDetails, sanitize, buildFailed, getDirs, zipArtifactReady, projectInstallFallbackToNpm, assertNoManagedDependencyConflicts, debugDirs, browserLaunchFailed, extensionLoadRecovered, extensionLoadStillRefused, writingTypeDefinitionsError, projectInstallScriptsDisabled, authorInstallNotice, getSpecialFoldersDataForProjectRoot, buildAssetsTree, loadCommandConfig, needsInstall, buildCommandFailed, writingTypeDefinitions, buildComplete, normalizeBrowser, debugBrowser, debugOutputPath, loadCustomConfig, devCommandFailed, getProjectStructure, getDistPath, resolveCompanionExtensionsConfig, loadBrowserConfig } from "./101.mjs";
|
|
9
9
|
import { stripBom, parseJsonSafe } from "./23.mjs";
|
|
10
10
|
import { hasProjectDependency, findNearestProjectManifestDirSync } from "./80.mjs";
|
|
11
11
|
import { buildSummaryPath, ensureSessionArtifactsIgnoreFile } from "./494.mjs";
|
|
@@ -14,6 +14,7 @@ import { fileURLToPath as __rspack_fileURLToPath } from "node:url";
|
|
|
14
14
|
import { dirname as __rspack_dirname } from "node:path";
|
|
15
15
|
var __rspack_import_meta_dirname__ = __rspack_dirname(__rspack_fileURLToPath(import.meta.url));
|
|
16
16
|
import * as __rspack_external_node_fs_5ea92f0c from "node:fs";
|
|
17
|
+
import * as __rspack_external_node_os_74b4b876 from "node:os";
|
|
17
18
|
import * as __rspack_external_node_path_c5b9b54f from "node:path";
|
|
18
19
|
import * as __rspack_external_node_fs_promises_153e37e0 from "node:fs/promises";
|
|
19
20
|
const MAX_OUTPUT_CHARS = 2000;
|
|
@@ -804,7 +805,7 @@ function isUsingIntegration(name) {
|
|
|
804
805
|
return `integration use=${name}`;
|
|
805
806
|
}
|
|
806
807
|
function creatingTSConfig() {
|
|
807
|
-
return `${messaging_prefix('info')}
|
|
808
|
+
return `${messaging_prefix('info')} Creating a default tsconfig.json…`;
|
|
808
809
|
}
|
|
809
810
|
function isUsingCustomLoader(loaderPath) {
|
|
810
811
|
return `${messaging_prefix('debug')} loader custom=${loaderPath}`;
|
|
@@ -918,6 +919,32 @@ function writeTsConfig(projectPath) {
|
|
|
918
919
|
mode: 'development'
|
|
919
920
|
}), null, 2));
|
|
920
921
|
}
|
|
922
|
+
const ARTIFACTS_KEY = '__extensionJsZipArtifacts';
|
|
923
|
+
function recordZipArtifact(carrier, artifact) {
|
|
924
|
+
if (!carrier || 'object' != typeof carrier) return;
|
|
925
|
+
const host = carrier;
|
|
926
|
+
if (!Array.isArray(host[ARTIFACTS_KEY])) host[ARTIFACTS_KEY] = [];
|
|
927
|
+
host[ARTIFACTS_KEY].push(artifact);
|
|
928
|
+
}
|
|
929
|
+
function getZipArtifacts(carrier) {
|
|
930
|
+
if (!carrier || 'object' != typeof carrier) return [];
|
|
931
|
+
const host = carrier;
|
|
932
|
+
return Array.isArray(host[ARTIFACTS_KEY]) ? host[ARTIFACTS_KEY] : [];
|
|
933
|
+
}
|
|
934
|
+
function collapseHomeDir(value) {
|
|
935
|
+
const home = __rspack_external_node_os_74b4b876.homedir();
|
|
936
|
+
if (!home || !value.startsWith(home)) return value;
|
|
937
|
+
const rest = value.slice(home.length);
|
|
938
|
+
if ('' === rest) return '~';
|
|
939
|
+
if (rest.startsWith(__rspack_external_node_path_c5b9b54f.sep) || rest.startsWith('/')) return `~${rest}`;
|
|
940
|
+
return value;
|
|
941
|
+
}
|
|
942
|
+
function relativeToCwd(target) {
|
|
943
|
+
const relative = __rspack_external_node_path_c5b9b54f.relative(process.cwd(), target);
|
|
944
|
+
if (relative && !relative.startsWith('..') && !__rspack_external_node_path_c5b9b54f.isAbsolute(relative)) return relative;
|
|
945
|
+
return null;
|
|
946
|
+
}
|
|
947
|
+
const reportedBuildFailures = new WeakSet();
|
|
921
948
|
function printBuildCard(manifestPath, browser, distPath) {
|
|
922
949
|
if (!claimCardKey(`${browser}::${__rspack_external_node_path_c5b9b54f.resolve(distPath)}`)) return;
|
|
923
950
|
let extensionLabel = '';
|
|
@@ -945,7 +972,7 @@ function printBuildCard(manifestPath, browser, distPath) {
|
|
|
945
972
|
},
|
|
946
973
|
{
|
|
947
974
|
label: 'Output',
|
|
948
|
-
value: distPath
|
|
975
|
+
value: collapseHomeDir(distPath)
|
|
949
976
|
}
|
|
950
977
|
]
|
|
951
978
|
}));
|
|
@@ -960,7 +987,6 @@ async function extensionBuild(pathOrRemoteUrl, buildOptions) {
|
|
|
960
987
|
const { manifestDir, packageJsonDir } = getDirs(projectStructure);
|
|
961
988
|
const distPath = getDistPath(packageJsonDir, browser);
|
|
962
989
|
const isAuthor = isDebug();
|
|
963
|
-
printBuildCard(projectStructure.manifestPath, browser, distPath);
|
|
964
990
|
try {
|
|
965
991
|
await ensureDevelopArtifacts();
|
|
966
992
|
if (buildOptions?.install !== false) await ensureUserProjectDependencies(packageJsonDir);
|
|
@@ -969,7 +995,7 @@ async function extensionBuild(pathOrRemoteUrl, buildOptions) {
|
|
|
969
995
|
const [{ rspack }, { merge }, { handleStatsErrors }, { default: webpackConfig }] = await Promise.all([
|
|
970
996
|
import("@rspack/core"),
|
|
971
997
|
import("webpack-merge"),
|
|
972
|
-
import("./0~stats-handler.mjs"),
|
|
998
|
+
import("./0~stats-handler.mjs").then((m)=>m.stats_handler_namespaceObject),
|
|
973
999
|
import("./0~rspack-config.mjs").then((m)=>m.rspack_config_namespaceObject)
|
|
974
1000
|
]);
|
|
975
1001
|
const debug = isAuthor;
|
|
@@ -1033,12 +1059,29 @@ async function extensionBuild(pathOrRemoteUrl, buildOptions) {
|
|
|
1033
1059
|
return reject(err);
|
|
1034
1060
|
}
|
|
1035
1061
|
if (!stats || 'function' != typeof stats.hasErrors) return reject(new Error('Build failed: bundler returned invalid stats output (no reliable compilation result).'));
|
|
1036
|
-
|
|
1037
|
-
|
|
1062
|
+
try {
|
|
1063
|
+
printBuildCard(projectStructure.manifestPath, browser, distPath);
|
|
1064
|
+
if (!buildOptions?.silent) {
|
|
1065
|
+
const assetsTree = buildAssetsTree(stats);
|
|
1066
|
+
if (assetsTree) humanLine(assetsTree);
|
|
1067
|
+
}
|
|
1038
1068
|
} catch {}
|
|
1039
1069
|
if (stats.hasErrors()) {
|
|
1040
1070
|
handleStatsErrors(stats);
|
|
1041
|
-
|
|
1071
|
+
let errorCount = 1;
|
|
1072
|
+
try {
|
|
1073
|
+
const info = stats.toJson({
|
|
1074
|
+
all: false,
|
|
1075
|
+
errors: true
|
|
1076
|
+
});
|
|
1077
|
+
errorCount = Math.max(1, info?.errors?.length || 1);
|
|
1078
|
+
} catch {}
|
|
1079
|
+
console.error(buildFailed(errorCount));
|
|
1080
|
+
if (!shouldExitOnError) {
|
|
1081
|
+
const failure = new Error('Build failed with errors');
|
|
1082
|
+
reportedBuildFailures.add(failure);
|
|
1083
|
+
return reject(failure);
|
|
1084
|
+
}
|
|
1042
1085
|
process.exit(1);
|
|
1043
1086
|
} else {
|
|
1044
1087
|
const info = stats?.toJson({
|
|
@@ -1057,10 +1100,15 @@ async function extensionBuild(pathOrRemoteUrl, buildOptions) {
|
|
|
1057
1100
|
__rspack_external_node_fs_5ea92f0c.writeFileSync(summaryFile, JSON.stringify(summary));
|
|
1058
1101
|
} catch {}
|
|
1059
1102
|
if (summary.warnings_count > 0) {
|
|
1060
|
-
humanLine(buildSuccessWithWarnings(summary.warnings_count));
|
|
1061
1103
|
const warningDetails = buildWarningsDetails(info?.warnings || []);
|
|
1062
|
-
if (warningDetails) humanLine(
|
|
1063
|
-
}
|
|
1104
|
+
if (warningDetails) humanLine(warningDetails);
|
|
1105
|
+
}
|
|
1106
|
+
const distDisplay = relativeToCwd(distPath) || collapseHomeDir(distPath);
|
|
1107
|
+
humanLine(buildComplete(browser, distDisplay, summary.total_bytes));
|
|
1108
|
+
for (const artifact of getZipArtifacts(stats.compilation)){
|
|
1109
|
+
const zipDisplay = relativeToCwd(artifact.path) || artifact.path;
|
|
1110
|
+
humanLine(zipArtifactReady(zipDisplay, artifact.size));
|
|
1111
|
+
}
|
|
1064
1112
|
resolve();
|
|
1065
1113
|
}
|
|
1066
1114
|
});
|
|
@@ -1086,9 +1134,12 @@ async function extensionBuild(pathOrRemoteUrl, buildOptions) {
|
|
|
1086
1134
|
}
|
|
1087
1135
|
return summary;
|
|
1088
1136
|
} catch (error) {
|
|
1089
|
-
const
|
|
1090
|
-
if (
|
|
1091
|
-
|
|
1137
|
+
const alreadyReported = error instanceof Error && reportedBuildFailures.has(error);
|
|
1138
|
+
if (!alreadyReported) {
|
|
1139
|
+
if (isDebug()) console.error(error);
|
|
1140
|
+
else console.error(buildCommandFailed(error));
|
|
1141
|
+
console.error(buildFailed(1));
|
|
1142
|
+
}
|
|
1092
1143
|
if (!shouldExitOnError) throw error;
|
|
1093
1144
|
process.exit(1);
|
|
1094
1145
|
}
|
|
@@ -1102,7 +1153,7 @@ function viaBroker(broker, instruction) {
|
|
|
1102
1153
|
});
|
|
1103
1154
|
}
|
|
1104
1155
|
function formatReloadingLine(label) {
|
|
1105
|
-
return
|
|
1156
|
+
return `${messaging_prefix('info')} Reloading ${label}…`;
|
|
1106
1157
|
}
|
|
1107
1158
|
async function dispatchReload(instruction, executor) {
|
|
1108
1159
|
if (!instruction) return;
|
|
@@ -1612,4 +1663,4 @@ async function extensionDev(pathOrRemoteUrl, devOptions) {
|
|
|
1612
1663
|
process.exit(1);
|
|
1613
1664
|
}
|
|
1614
1665
|
}
|
|
1615
|
-
export { BuildEmitter, attachLifecycleStream, buildSourceFeatureIndex, classifyReloadFromSources, createChangedSourcesTracker, createLifecycleStream, dispatchReload, ensureTypeScriptConfig, extensionBuild, extensionDev, getUserTypeScriptConfigFile, hasDependency, humanLine, isUsingCustomLoader, isUsingIntegration, isUsingTypeScript, jsFrameworksConfigsDetected, jsFrameworksHmrSummary, jsFrameworksIntegrationsEnabled, readContentScriptCount, resolveDevelopDistFile, resolveDevelopInstallRoot, resolvePackageManager };
|
|
1666
|
+
export { BuildEmitter, attachLifecycleStream, buildSourceFeatureIndex, classifyReloadFromSources, createChangedSourcesTracker, createLifecycleStream, dispatchReload, ensureTypeScriptConfig, extensionBuild, extensionDev, getUserTypeScriptConfigFile, hasDependency, humanLine, isUsingCustomLoader, isUsingIntegration, isUsingTypeScript, jsFrameworksConfigsDetected, jsFrameworksHmrSummary, jsFrameworksIntegrationsEnabled, readContentScriptCount, recordZipArtifact, resolveDevelopDistFile, resolveDevelopInstallRoot, resolvePackageManager };
|
package/dist/845.mjs
CHANGED
|
@@ -15,56 +15,52 @@ function isUsingIntegration(name) {
|
|
|
15
15
|
function missingSassDependency() {
|
|
16
16
|
return [
|
|
17
17
|
`${messaging_prefix('error')} Couldn't compile the Sass styles.`,
|
|
18
|
-
`The ${pintor.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
` ${pintor.gray('pnpm add -D sass')}`,
|
|
23
|
-
'',
|
|
24
|
-
'Sample package.json:',
|
|
25
|
-
' {',
|
|
26
|
-
' "devDependencies": {',
|
|
27
|
-
` "sass": ${pintor.yellow('"<version>"')}`,
|
|
28
|
-
' }',
|
|
29
|
-
' }'
|
|
18
|
+
`The ${pintor.blue('sass')} package isn't installed in your project.`,
|
|
19
|
+
"Add it to your devDependencies:",
|
|
20
|
+
`- ${pintor.blue('npm install --save-dev sass')}`,
|
|
21
|
+
`- ${pintor.blue('pnpm add -D sass')}`
|
|
30
22
|
].join('\n');
|
|
31
23
|
}
|
|
32
24
|
function postCssPluginNotResolved(pluginName, projectPath) {
|
|
33
25
|
return [
|
|
34
|
-
`${messaging_prefix('warn')} PostCSS plugin ${pintor.
|
|
26
|
+
`${messaging_prefix('warn')} Couldn't resolve the PostCSS plugin ${pintor.blue(pluginName)}.`,
|
|
35
27
|
'The plugin was skipped so the build can continue.',
|
|
36
28
|
'Styles it would generate are missing from the output.',
|
|
37
|
-
|
|
29
|
+
`${pintor.gray('PATH')} ${pintor.underline(projectPath)}`,
|
|
30
|
+
`Install it in your project to re-enable it: ${pintor.blue(`npm install --save-dev ${pluginName}`)}`
|
|
38
31
|
].join('\n');
|
|
39
32
|
}
|
|
40
33
|
function cssParseErrorShippedVerbatim(resourcePath, error) {
|
|
41
34
|
const errObj = error;
|
|
42
35
|
const reason = error && 'object' == typeof error && 'reason' in error ? String(errObj?.reason) : String(errObj?.message || error);
|
|
43
36
|
return [
|
|
44
|
-
`${messaging_prefix('warn')}
|
|
45
|
-
|
|
46
|
-
'
|
|
47
|
-
'
|
|
48
|
-
'
|
|
37
|
+
`${messaging_prefix('warn')} The CSS in this file doesn't parse, so it was copied as-is.`,
|
|
38
|
+
`${pintor.gray('PATH')} ${pintor.underline(resourcePath)}`,
|
|
39
|
+
`${pintor.gray('REASON')} ${reason}`,
|
|
40
|
+
"Browsers skip rules they can't parse, so the build kept going.",
|
|
41
|
+
"PostCSS and Tailwind processing wasn't applied to this file.",
|
|
42
|
+
'Fix the CSS to re-enable processing.'
|
|
49
43
|
].join('\n');
|
|
50
44
|
}
|
|
51
45
|
function preprocessorShippedUncompiled(resourcePath, tool) {
|
|
52
46
|
const pkg = 'sass' === tool ? 'sass' : 'less';
|
|
47
|
+
const language = 'sass' === tool ? 'Sass/SCSS' : 'Less';
|
|
53
48
|
return [
|
|
54
|
-
`${messaging_prefix('warn')} ${
|
|
55
|
-
|
|
56
|
-
`The
|
|
57
|
-
`
|
|
49
|
+
`${messaging_prefix('warn')} This ${language} file shipped uncompiled.`,
|
|
50
|
+
`${pintor.gray('PATH')} ${pintor.underline(resourcePath)}`,
|
|
51
|
+
`The ${pintor.blue(pkg)} package isn't installed in this project.`,
|
|
52
|
+
`The raw ${language} source was copied as-is into the output .css.`,
|
|
53
|
+
"Browsers treat it as broken CSS, so those surfaces render unstyled.",
|
|
54
|
+
`Install it to compile this file: ${pintor.blue(`npm install --save-dev ${pkg}`)}`
|
|
58
55
|
].join('\n');
|
|
59
56
|
}
|
|
60
57
|
function deadCssUrlRef(issuerPath, request) {
|
|
61
58
|
return [
|
|
62
|
-
`
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
''
|
|
67
|
-
`${pintor.red('NOT FOUND')} ${pintor.underline(request)}`
|
|
59
|
+
`A ${pintor.blue(`url(${request})`)} reference points to a file that exists nowhere in the project.`,
|
|
60
|
+
`${pintor.gray('PATH')} ${pintor.underline(issuerPath)}`,
|
|
61
|
+
`${pintor.gray('NOT FOUND')} ${pintor.underline(request)}`,
|
|
62
|
+
"Chrome applies the rest of the stylesheet and 404s this reference silently, so it's likely dead code.",
|
|
63
|
+
`Set ${pintor.blue('EXTENSION_STRICT_REFS=true')} to make this a build error.`
|
|
68
64
|
].join('\n');
|
|
69
65
|
}
|
|
70
66
|
export { cssConfigsDetected, cssIntegrationsEnabled, cssParseErrorShippedVerbatim, deadCssUrlRef, isUsingIntegration, missingSassDependency, postCssPluginNotResolved, preprocessorShippedUncompiled };
|
|
@@ -3,7 +3,7 @@ export declare function browserRunnerDisabled(args: {
|
|
|
3
3
|
browser: string;
|
|
4
4
|
manifestPath: string;
|
|
5
5
|
readyPath: string;
|
|
6
|
-
|
|
6
|
+
distPath?: string;
|
|
7
7
|
}): string;
|
|
8
8
|
export declare function portInUse(requestedPort: number, newPort: number): string;
|
|
9
9
|
export declare function extensionJsRunnerError(error: unknown): string;
|
package/dist/lib/messages.d.ts
CHANGED
|
@@ -7,18 +7,17 @@ export declare function remoteFetchTimedOut(target: string, ms: number): string;
|
|
|
7
7
|
export declare function manifestInvalidJson(manifestPath: string, error: unknown): string;
|
|
8
8
|
export declare function notAnExtensionManifestError(manifestPath: string): string;
|
|
9
9
|
export declare function manifestNotFoundError(manifestPath: string, candidates?: string[]): string;
|
|
10
|
-
export declare function
|
|
11
|
-
export declare function
|
|
12
|
-
export declare function starting(browser: DevOptions['browser']): string;
|
|
13
|
-
export declare function previewSkippedNoBrowser(browser: DevOptions['browser']): string;
|
|
10
|
+
export declare function previewing(browser: DevOptions['browser'], noBrowser?: boolean): string;
|
|
11
|
+
export declare function starting(browser: DevOptions['browser'], noBrowser?: boolean): string;
|
|
14
12
|
export declare function extensionLoadRecovered(): string;
|
|
15
13
|
export declare function extensionLoadStillRefused(reason: string): string;
|
|
16
14
|
export declare function browserLaunchFailed(browser: DevOptions['browser'], reason: string): string;
|
|
17
15
|
export declare function authorInstallNotice(target: string): string;
|
|
18
16
|
export declare function projectInstallFallbackToNpm(pmName: string): string;
|
|
19
17
|
export declare function projectInstallScriptsDisabled(pmName: string): string;
|
|
20
|
-
export declare function
|
|
21
|
-
export declare function
|
|
18
|
+
export declare function buildAssetsTree(stats: Stats | undefined): string;
|
|
19
|
+
export declare function buildComplete(browser: DevOptions['browser'], distDisplayPath: string, totalBytes?: number): string;
|
|
20
|
+
export declare function buildFailed(errorCount: number): string;
|
|
22
21
|
type LooseBuildWarning = string | null | undefined | {
|
|
23
22
|
message?: unknown;
|
|
24
23
|
details?: unknown;
|
|
@@ -32,14 +31,13 @@ type LooseBuildWarning = string | null | undefined | {
|
|
|
32
31
|
file?: unknown;
|
|
33
32
|
chunkName?: unknown;
|
|
34
33
|
};
|
|
35
|
-
export declare function buildSuccessWithWarnings(warningCount: number): string;
|
|
36
34
|
export declare function buildWarningsDetails(warnings: LooseBuildWarning[]): string;
|
|
37
35
|
export declare function fetchingProjectPath(owner: string, project: string): string;
|
|
38
36
|
export declare function downloadingProjectPath(projectName: string): string;
|
|
39
37
|
export declare function creatingProjectPath(projectPath: string): string;
|
|
40
38
|
export declare function downloadedProjectFolderNotFound(cwd: string, candidates: string[]): string;
|
|
41
39
|
export declare function packagingSourceFiles(zipPath: string): string;
|
|
42
|
-
export declare function zipArtifactReady(
|
|
40
|
+
export declare function zipArtifactReady(zipPath: string, sizeInBytes: number): string;
|
|
43
41
|
export declare function packagingDistributionFiles(zipPath: string): string;
|
|
44
42
|
export declare function treeWithSourceAndDistFiles(browser: DevOptions['browser'], name: string, sourceZip: string, destZip: string): string;
|
|
45
43
|
export declare function treeWithDistFilesBrowser(name: string, ext: string, browser: DevOptions['browser'], zipPath: string): string;
|
|
@@ -1 +1,14 @@
|
|
|
1
|
+
export interface StatsToStringLike {
|
|
2
|
+
toString: (options?: {
|
|
3
|
+
colors?: boolean;
|
|
4
|
+
all?: boolean;
|
|
5
|
+
errors?: boolean;
|
|
6
|
+
warnings?: boolean;
|
|
7
|
+
}) => string;
|
|
8
|
+
}
|
|
9
|
+
export declare function wrapStatsBlocks(raw: string): string;
|
|
10
|
+
export declare function renderStatsBlocks(stats: StatsToStringLike, opts: {
|
|
11
|
+
errors: boolean;
|
|
12
|
+
warnings: boolean;
|
|
13
|
+
}): string;
|
|
1
14
|
export declare function handleStatsErrors(stats: import('@rspack/core').Stats): void;
|
|
@@ -5,7 +5,7 @@ export declare class BoringPlugin {
|
|
|
5
5
|
readonly manifestPath: string;
|
|
6
6
|
readonly browser: PluginInterface['browser'];
|
|
7
7
|
private sawUserInvalidation;
|
|
8
|
-
private
|
|
8
|
+
private printedStartupSuccess;
|
|
9
9
|
private lastKnownManifestName?;
|
|
10
10
|
constructor(options: PluginInterface);
|
|
11
11
|
apply(compiler: Compiler): void;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { Stats } from '@rspack/core';
|
|
2
2
|
export declare function boring(manifestName: string, durationMs: number, stats: Stats): string;
|
|
3
|
-
export declare function portInUse(requestedPort: number, newPort: number): string;
|
|
4
|
-
export declare function extensionJsRunnerError(error: unknown): string;
|
|
5
3
|
export declare function cleanDistStarting(distPath: string): string;
|
|
6
4
|
export declare function cleanDistRemovedSummary(removedCount: number, distPath: string): string;
|
|
7
5
|
export declare function cleanDistSkippedNotFound(distPath: string): string;
|
|
@@ -9,6 +9,7 @@ export declare class CompilationPlugin {
|
|
|
9
9
|
readonly zipSource?: boolean;
|
|
10
10
|
readonly zipFilename?: string;
|
|
11
11
|
readonly port?: number;
|
|
12
|
+
readonly command?: 'dev' | 'start' | 'preview' | 'build';
|
|
12
13
|
constructor(options: PluginInterface & {
|
|
13
14
|
clean: boolean;
|
|
14
15
|
} & {
|
|
@@ -16,6 +17,7 @@ export declare class CompilationPlugin {
|
|
|
16
17
|
zipSource?: boolean;
|
|
17
18
|
zipFilename?: string;
|
|
18
19
|
port?: number;
|
|
20
|
+
command?: 'dev' | 'start' | 'preview' | 'build';
|
|
19
21
|
});
|
|
20
22
|
private applyIgnoreWarnings;
|
|
21
23
|
apply(compiler: Compiler): void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface ZipArtifactRecord {
|
|
2
|
+
kind: 'source' | 'dist';
|
|
3
|
+
path: string;
|
|
4
|
+
size: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function recordZipArtifact(carrier: unknown, artifact: ZipArtifactRecord): void;
|
|
7
|
+
export declare function getZipArtifacts(carrier: unknown): ZipArtifactRecord[];
|
package/package.json
CHANGED
package/dist/0~branding.mjs
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
|
|
2
|
-
function scrubBrand(txt, brand = 'Extension.js') {
|
|
3
|
-
if (!txt) return txt;
|
|
4
|
-
const safeBrand = brand.replace(/\$/g, '$$$$');
|
|
5
|
-
const preserved = [];
|
|
6
|
-
const preserve = (value)=>{
|
|
7
|
-
const token = `__EXT_BRAND_PRESERVE_${preserved.length}__`;
|
|
8
|
-
preserved.push(value);
|
|
9
|
-
return token;
|
|
10
|
-
};
|
|
11
|
-
let output = txt.replace(/\bRspack\b(?=\s+performance recommendations:)/gi, preserve).replace(/https?:\/\/rspack\.(?:rs|dev)\/[^\s)]+/gi, preserve).replace(/(?<!@)\bRspack\b/gi, safeBrand).replace(/(?<!@)\bWebpack\b/gi, safeBrand).replace(/(?<!@)\bwebpack-dev-server\b/gi, `${safeBrand} dev server`).replace(/(?<!@)\bRspackDevServer\b/gi, `${safeBrand} dev server`).replace(/ModuleBuildError:\s*/g, '').replace(/ModuleParseError:\s*/g, '').replace(/Error:\s*Module\s+build\s+failed.*?\n/gi, '').replace(/\n{3,}/g, '\n\n').replace(/\n{2}(?=WARNING in )/g, '\n');
|
|
12
|
-
preserved.forEach((value, index)=>{
|
|
13
|
-
output = output.replace(`__EXT_BRAND_PRESERVE_${index}__`, value);
|
|
14
|
-
});
|
|
15
|
-
return output;
|
|
16
|
-
}
|
|
17
|
-
function makeSanitizedConsole(brand = 'Extension.js') {
|
|
18
|
-
const sanitize = (a)=>'string' == typeof a ? scrubBrand(a, brand) : a;
|
|
19
|
-
return {
|
|
20
|
-
log: (...args)=>console.log(...args.map(sanitize)),
|
|
21
|
-
info: (...args)=>console.info(...args.map(sanitize)),
|
|
22
|
-
warn: (...args)=>console.warn(...args.map(sanitize)),
|
|
23
|
-
error: (...args)=>console.error(...args.map(sanitize))
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
export { makeSanitizedConsole, scrubBrand };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare const sharedState: {
|
|
2
|
-
bannerPrinted: boolean;
|
|
3
|
-
pendingCompilationLine: string;
|
|
4
|
-
};
|
|
5
|
-
export declare function markBannerPrinted(): void;
|
|
6
|
-
export declare function isBannerPrinted(): boolean;
|
|
7
|
-
export declare function setPendingCompilationLine(line: string): void;
|