extension-develop 4.1.19 → 4.1.21
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/672~0.mjs +24 -1
- package/dist/747~0.mjs +4 -2
- package/dist/832~0.mjs +26 -6
- package/dist/840~0.mjs +507 -26
- package/dist/950~0.mjs +18 -26
- package/dist/dev-server/control-bridge/actions-file.d.ts +0 -1
- package/dist/dev-server/control-bridge/broker.d.ts +6 -4
- package/dist/dev-server/control-bridge/contracts.d.ts +1 -1
- package/dist/dev-server/control-bridge/logs-file.d.ts +0 -1
- package/dist/dev-server/control-bridge/producer-runtime.d.ts +1 -2
- package/dist/dev-server~0.mjs +19 -5
- package/dist/extension-js-devtools/edge/manifest.json +0 -1
- package/dist/lib/addon-lint.d.ts +4 -1
- package/dist/lib/chunk-dependency-provenance.d.ts +14 -0
- package/dist/lib/constants.d.ts +1 -0
- package/dist/lib/ensure-develop-artifacts.d.ts +0 -7
- package/dist/lib/has-dependency.d.ts +0 -5
- package/dist/lib/manifest-utils.d.ts +2 -0
- package/dist/lib/merge-options.d.ts +0 -40
- package/dist/lib/messages.d.ts +4 -4
- package/dist/lib/package-manager.d.ts +2 -0
- package/dist/lib/project-manifest.d.ts +0 -1
- package/dist/lib/session-paths.d.ts +0 -22
- package/dist/plugin-browsers/index.d.ts +0 -7
- package/dist/plugin-browsers/safari-dev-plugin.d.ts +4 -0
- package/dist/plugin-compatibility/feature-polyfill.d.ts +0 -4
- package/dist/plugin-compilation/env.d.ts +2 -5
- package/dist/plugin-css/css-lib/dead-url-refs.d.ts +0 -6
- package/dist/plugin-css/css-lib/inline-content-script-css.d.ts +0 -15
- package/dist/plugin-css/css-lib/resolve-css-asset.d.ts +0 -8
- package/dist/plugin-js-frameworks/js-frameworks-lib/messages.d.ts +1 -0
- package/dist/plugin-js-frameworks/js-tools/solid.d.ts +3 -0
- package/dist/plugin-js-frameworks/js-tools/typescript.d.ts +16 -0
- package/dist/plugin-perf-budgets/categorize.d.ts +2 -1
- package/dist/plugin-perf-budgets/index.d.ts +1 -22
- package/dist/plugin-playwright/index.d.ts +3 -2
- package/dist/plugin-reload/index.d.ts +1 -1
- package/dist/plugin-reload/reload-dispatch.d.ts +6 -3
- package/dist/plugin-reload/steps/setup-chunk-loading-target.d.ts +0 -13
- package/dist/plugin-special-folders/index.d.ts +0 -9
- package/dist/plugin-web-extension/feature-html/html-lib/utils.d.ts +0 -1
- package/dist/plugin-web-extension/feature-html/index.d.ts +0 -27
- package/dist/plugin-web-extension/feature-icons/index.d.ts +0 -12
- package/dist/plugin-web-extension/feature-json/index.d.ts +0 -9
- package/dist/plugin-web-extension/feature-locales/index.d.ts +0 -4
- package/dist/plugin-web-extension/feature-manifest/index.d.ts +0 -10
- package/dist/plugin-web-extension/feature-manifest/manifest-lib/filter-key-edge.d.ts +5 -0
- package/dist/plugin-web-extension/feature-manifest/manifest-lib/filter-keys-safari.d.ts +11 -0
- package/dist/plugin-web-extension/feature-manifest/manifest-lib/gecko-data-collection.d.ts +0 -12
- package/dist/plugin-web-extension/feature-manifest/manifest-lib/legacy-paths.d.ts +0 -13
- package/dist/plugin-web-extension/feature-manifest/manifest-lib/sanitize-fatal-shapes.d.ts +0 -36
- package/dist/plugin-web-extension/feature-manifest/messages.d.ts +20 -0
- package/dist/plugin-web-extension/feature-manifest/steps/apply-dev-defaults-lib/dev-injected-hosts.d.ts +0 -5
- package/dist/plugin-web-extension/feature-manifest/steps/apply-dev-defaults-lib/emitted-evidence.d.ts +22 -0
- package/dist/plugin-web-extension/feature-manifest/steps/apply-dev-defaults-lib/patch-background.d.ts +9 -0
- package/dist/plugin-web-extension/feature-manifest/steps/apply-dev-defaults-lib/patch-web-resources.d.ts +7 -16
- package/dist/plugin-web-extension/feature-manifest/steps/apply-dev-defaults.d.ts +6 -2
- package/dist/plugin-web-extension/feature-manifest/steps/patch-war.d.ts +0 -5
- package/dist/plugin-web-extension/feature-manifest/steps/patch-webkit-background.d.ts +2 -0
- package/dist/plugin-web-extension/feature-manifest/steps/update-manifest.d.ts +1 -0
- package/dist/plugin-web-extension/feature-manifest/steps/warn-gecko-unsupported-apis.d.ts +119 -26
- package/dist/plugin-web-extension/feature-scripts/index.d.ts +0 -10
- package/dist/plugin-web-extension/feature-scripts/messages.d.ts +5 -0
- package/dist/plugin-web-extension/feature-scripts/steps/native-geturl-import-loader.d.ts +0 -3
- package/dist/plugin-web-extension/feature-scripts/steps/warn-page-context-worker.d.ts +5 -0
- package/dist/plugin-web-extension/feature-web-resources/collect-entry-imports.d.ts +1 -0
- package/dist/plugin-web-extension/feature-web-resources/index.d.ts +0 -10
- package/dist/plugin-web-extension/feature-web-resources/web-resources-lib/clean-matches.d.ts +0 -6
- package/dist/plugin-web-extension/feature-web-resources/web-resources-lib/messages.d.ts +1 -0
- package/dist/plugin-web-extension/feature-web-resources/web-resources-lib/unreachable-resources.d.ts +9 -0
- package/dist/plugin-web-extension/shared/discover-devtools-panels.d.ts +0 -6
- package/dist/plugin-web-extension/shared/paths.d.ts +0 -1
- package/dist/rspack-config.d.ts +1 -1
- package/dist/rspack-config~0.mjs +1074 -574
- package/package.json +1 -1
- package/runtime/process-shim.cjs +2 -0
package/dist/840~0.mjs
CHANGED
|
@@ -3,13 +3,15 @@ import { createRequire } from "node:module";
|
|
|
3
3
|
import { execFileSync } from "node:child_process";
|
|
4
4
|
import { spawn, sync } from "cross-spawn";
|
|
5
5
|
import { buildExecEnv, detectPackageManagerFromLockfile } from "prefers-yarn";
|
|
6
|
-
import "pintor";
|
|
6
|
+
import pintor from "pintor";
|
|
7
|
+
import { DefinePlugin } from "@rspack/core";
|
|
8
|
+
import { pathToFileURL } from "node:url";
|
|
7
9
|
import { EventEmitter } from "node:events";
|
|
8
|
-
import {
|
|
10
|
+
import { humanWarn, browserRowValue, CODES, ENVELOPE, prefix as messaging_prefix, card, isDebug, claimCardKey, isMachineOutput } from "./852~0.mjs";
|
|
9
11
|
import { package_namespaceObject, loadCommandConfig, DEV_COMMAND_DEFAULTS, stampReadyDistExtensionId, loadProjectConfigDefaults, mergeOptionLayers, stampReadyKnownExtensionId, assertNoManagedDependencyConflicts, loadCustomConfig, START_BUILD_DEFAULTS, loadBrowserConfig, resolveCompanionExtensionsConfig, BUILD_COMMAND_DEFAULTS, getSpecialFoldersDataForProjectRoot, withDarkMode } from "./832~0.mjs";
|
|
10
12
|
import { stripBom, hasProjectDependency, parseJsonSafe, findNearestProjectManifestDirSync } from "./731~0.mjs";
|
|
11
13
|
import { isGeckoBasedBrowser } from "./331~0.mjs";
|
|
12
|
-
import { buildWarningsDetails, buildFailed, getDirs, zipArtifactReady, projectInstallFallbackToNpm, debugDirs, browserLaunchFailed, buildSummaryPath, addonLintMore, extensionLoadRecovered, writingTypeDefinitionsError, extensionLoadStillRefused, projectInstallScriptsDisabled, authorInstallNotice, addonLintFailed, buildAssetsTree, addonLintSummary, addonLintFinding, configBrowserOrThrow, needsInstall, projectInstallInWorkspaceRoot, buildCommandFailed, addonLintNotInstalled, writingTypeDefinitions, buildComplete, ensureSessionStateInProjectGitignore, ensureSessionArtifactsIgnoreFile, debugBrowser, normalizeBrowser, debugOutputPath, devCommandFailed,
|
|
14
|
+
import { buildWarningsDetails, buildFailed, getDirs, zipArtifactReady, projectInstallFallbackToNpm, debugDirs, addonLintDependencyAttribution, browserLaunchFailed, buildSummaryPath, addonLintMore, extensionLoadRecovered, writingTypeDefinitionsError, extensionLoadStillRefused, projectInstallScriptsDisabled, authorInstallNotice, addonLintFailed, buildAssetsTree, addonLintSummary, addonLintFinding, configBrowserOrThrow, needsInstall, projectInstallInWorkspaceRoot, buildCommandFailed, addonLintNotInstalled, writingTypeDefinitions, buildComplete, ensureSessionStateInProjectGitignore, ensureSessionArtifactsIgnoreFile, debugBrowser, normalizeBrowser, debugOutputPath, devCommandFailed, buildShareHint, getDistPath, getProjectStructure, debugSplitChunksNarrowed } from "./950~0.mjs";
|
|
13
15
|
import { publicRootsFor } from "./105~0.mjs";
|
|
14
16
|
import { getCanonicalContentScriptEntryName } from "./640~0.mjs";
|
|
15
17
|
import { fileURLToPath as __rspack_fileURLToPath } from "node:url";
|
|
@@ -775,7 +777,7 @@ function readPnpmWorkspacePackages(workspaceRoot) {
|
|
|
775
777
|
for(let j = i + 1; j < lines.length; j++){
|
|
776
778
|
const line = lines[j];
|
|
777
779
|
if (!line.trim() || line.trim().startsWith('#')) continue;
|
|
778
|
-
const item = /^\s
|
|
780
|
+
const item = /^\s*-\s*(.+)$/.exec(line);
|
|
779
781
|
if (!item) break;
|
|
780
782
|
const value = cleanYamlListItem(item[1]);
|
|
781
783
|
if (value) patterns.push(value);
|
|
@@ -900,19 +902,21 @@ function buildSpawnInvocation(command, args) {
|
|
|
900
902
|
args
|
|
901
903
|
};
|
|
902
904
|
}
|
|
903
|
-
function
|
|
905
|
+
function spawnInstallCommand(command, args, options) {
|
|
904
906
|
const invocation = buildSpawnInvocation(command, args);
|
|
905
907
|
const env = buildExecEnv();
|
|
906
|
-
|
|
908
|
+
return spawn(invocation.command, invocation.args, {
|
|
909
|
+
cwd: options?.cwd,
|
|
910
|
+
stdio: options?.stdio ?? 'ignore',
|
|
911
|
+
env: {
|
|
912
|
+
...env || process.env,
|
|
913
|
+
...options?.env
|
|
914
|
+
}
|
|
915
|
+
});
|
|
916
|
+
}
|
|
917
|
+
function execInstallCommand(command, args, options) {
|
|
907
918
|
return new Promise((resolve, reject)=>{
|
|
908
|
-
const child =
|
|
909
|
-
cwd: options?.cwd,
|
|
910
|
-
stdio,
|
|
911
|
-
env: {
|
|
912
|
-
...env || process.env,
|
|
913
|
-
...options?.env
|
|
914
|
-
}
|
|
915
|
-
});
|
|
919
|
+
const child = spawnInstallCommand(command, args, options);
|
|
916
920
|
child.on('close', (code)=>{
|
|
917
921
|
if (0 !== code) reject(new Error(`Install failed with exit code ${code}`));
|
|
918
922
|
else resolve();
|
|
@@ -1340,7 +1344,14 @@ function collectAddonLintLines(output) {
|
|
|
1340
1344
|
...warnings.map((finding)=>toLine('warning', finding))
|
|
1341
1345
|
].filter((line)=>!DUPLICATED_BY_BUILD_WARNINGS.has(line.code));
|
|
1342
1346
|
}
|
|
1343
|
-
function
|
|
1347
|
+
function attributionFor(location, chunkProvenance) {
|
|
1348
|
+
if (!chunkProvenance || 0 === chunkProvenance.size) return '';
|
|
1349
|
+
const file = location.split(':')[0].replace(/\\/g, '/').replace(/^\.?\//, '');
|
|
1350
|
+
const provenance = chunkProvenance.get(file);
|
|
1351
|
+
if (!provenance) return '';
|
|
1352
|
+
return addonLintDependencyAttribution(provenance.packages, provenance.onlyDependencies);
|
|
1353
|
+
}
|
|
1354
|
+
function formatAddonLintFindings(output, distDisplay, maxPrinted = ADDON_LINT_MAX_PRINTED, chunkProvenance) {
|
|
1344
1355
|
const all = collectAddonLintLines(output);
|
|
1345
1356
|
if (0 === all.length) return {
|
|
1346
1357
|
findings: 0,
|
|
@@ -1351,7 +1362,7 @@ function formatAddonLintFindings(output, distDisplay, maxPrinted = ADDON_LINT_MA
|
|
|
1351
1362
|
const shown = all.slice(0, Math.max(0, maxPrinted));
|
|
1352
1363
|
const lines = [
|
|
1353
1364
|
addonLintSummary(errorCount, warningCount, distDisplay),
|
|
1354
|
-
...shown.map((line)=>addonLintFinding(line.level, line.code, line.message, line.location))
|
|
1365
|
+
...shown.map((line)=>addonLintFinding(line.level, line.code, line.message, line.location, attributionFor(line.location, chunkProvenance)))
|
|
1355
1366
|
];
|
|
1356
1367
|
if (all.length > shown.length) lines.push(addonLintMore(all.length - shown.length, distDisplay));
|
|
1357
1368
|
return {
|
|
@@ -1424,7 +1435,7 @@ async function runAddonLint(input) {
|
|
|
1424
1435
|
}), input.timeoutMs ?? ADDON_LINT_TIMEOUT_MS);
|
|
1425
1436
|
return {
|
|
1426
1437
|
status: 'linted',
|
|
1427
|
-
...formatAddonLintFindings(output, input.distDisplay)
|
|
1438
|
+
...formatAddonLintFindings(output, input.distDisplay, ADDON_LINT_MAX_PRINTED, input.chunkProvenance?.())
|
|
1428
1439
|
};
|
|
1429
1440
|
} catch (error) {
|
|
1430
1441
|
return {
|
|
@@ -1514,6 +1525,85 @@ function getBuildSummary(browser, info, outputPath) {
|
|
|
1514
1525
|
} : {}
|
|
1515
1526
|
};
|
|
1516
1527
|
}
|
|
1528
|
+
function packageNameFromPath(candidate) {
|
|
1529
|
+
const normalized = candidate.replace(/\\/g, '/');
|
|
1530
|
+
const marker = '/node_modules/';
|
|
1531
|
+
const at = normalized.lastIndexOf(marker);
|
|
1532
|
+
if (-1 === at) return null;
|
|
1533
|
+
const rest = normalized.slice(at + marker.length);
|
|
1534
|
+
const segments = rest.split('/').filter(Boolean);
|
|
1535
|
+
if (0 === segments.length) return null;
|
|
1536
|
+
if (segments[0].startsWith('@')) return segments.length > 1 ? `${segments[0]}/${segments[1]}` : null;
|
|
1537
|
+
if (segments[0].includes('@') && segments.length > 1) return packageNameFromPath(`/node_modules/${segments.slice(1).join('/')}`);
|
|
1538
|
+
return segments[0];
|
|
1539
|
+
}
|
|
1540
|
+
function isAbsoluteFilePath(candidate) {
|
|
1541
|
+
return /^([a-zA-Z]:[\\/]|[\\/])/.test(candidate);
|
|
1542
|
+
}
|
|
1543
|
+
function pathOfModule(moduleObj) {
|
|
1544
|
+
const candidate = moduleObj;
|
|
1545
|
+
if ('string' == typeof candidate?.resource && candidate.resource) return candidate.resource;
|
|
1546
|
+
if ('function' == typeof candidate?.identifier) {
|
|
1547
|
+
const identifier = candidate.identifier();
|
|
1548
|
+
if ('string' == typeof identifier && identifier) return identifier;
|
|
1549
|
+
}
|
|
1550
|
+
return null;
|
|
1551
|
+
}
|
|
1552
|
+
function collectChunkDependencyProvenance(compilation) {
|
|
1553
|
+
const provenance = new Map();
|
|
1554
|
+
const chunkGraph = compilation?.chunkGraph;
|
|
1555
|
+
const chunks = compilation?.chunks;
|
|
1556
|
+
if (!chunkGraph?.getChunkModulesIterable || !chunks) return provenance;
|
|
1557
|
+
for (const chunk of chunks){
|
|
1558
|
+
const files = chunk?.files;
|
|
1559
|
+
if (!files) continue;
|
|
1560
|
+
let modules = [];
|
|
1561
|
+
try {
|
|
1562
|
+
modules = Array.from(chunkGraph.getChunkModulesIterable(chunk));
|
|
1563
|
+
} catch {
|
|
1564
|
+
continue;
|
|
1565
|
+
}
|
|
1566
|
+
const packages = new Set();
|
|
1567
|
+
let counted = 0;
|
|
1568
|
+
let fromDependencies = 0;
|
|
1569
|
+
for (const moduleObj of modules){
|
|
1570
|
+
const modulePath = pathOfModule(moduleObj);
|
|
1571
|
+
if (!modulePath) continue;
|
|
1572
|
+
if (!isAbsoluteFilePath(modulePath)) continue;
|
|
1573
|
+
counted += 1;
|
|
1574
|
+
const packageName = packageNameFromPath(modulePath);
|
|
1575
|
+
if (packageName) {
|
|
1576
|
+
fromDependencies += 1;
|
|
1577
|
+
packages.add(packageName);
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
if (0 === packages.size) continue;
|
|
1581
|
+
const entry = {
|
|
1582
|
+
packages: [
|
|
1583
|
+
...packages
|
|
1584
|
+
].sort(),
|
|
1585
|
+
onlyDependencies: counted > 0 && fromDependencies === counted
|
|
1586
|
+
};
|
|
1587
|
+
for (const file of files){
|
|
1588
|
+
if ('string' != typeof file || !file.endsWith('.js')) continue;
|
|
1589
|
+
const existing = provenance.get(file);
|
|
1590
|
+
if (!existing) {
|
|
1591
|
+
provenance.set(file, entry);
|
|
1592
|
+
continue;
|
|
1593
|
+
}
|
|
1594
|
+
provenance.set(file, {
|
|
1595
|
+
packages: [
|
|
1596
|
+
...new Set([
|
|
1597
|
+
...existing.packages,
|
|
1598
|
+
...entry.packages
|
|
1599
|
+
])
|
|
1600
|
+
].sort(),
|
|
1601
|
+
onlyDependencies: existing.onlyDependencies && entry.onlyDependencies
|
|
1602
|
+
});
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
return provenance;
|
|
1606
|
+
}
|
|
1517
1607
|
async function ensureUserProjectDependencies(packageJsonDir) {
|
|
1518
1608
|
const member = findPnpmWorkspaceMember(packageJsonDir);
|
|
1519
1609
|
if (!needsInstall(packageJsonDir, member?.root)) return;
|
|
@@ -1805,6 +1895,9 @@ function isUsingJSFramework(projectPath) {
|
|
|
1805
1895
|
function isUsingIntegration(name) {
|
|
1806
1896
|
return `integration use=${name}`;
|
|
1807
1897
|
}
|
|
1898
|
+
function solidIsNotSupported() {
|
|
1899
|
+
return `${messaging_prefix('warn')} Solid is not a supported framework, so this project compiles through the JSX runtime only.\nA signal read in a child position, like ${pintor.yellow('{count()}')}, renders once and does not update.\nOnly Solid's own compiler makes that expression reactive, and the JSX runtime cannot recover it.`;
|
|
1900
|
+
}
|
|
1808
1901
|
function creatingTSConfig() {
|
|
1809
1902
|
return `${messaging_prefix('info')} Creating a default tsconfig.json…`;
|
|
1810
1903
|
}
|
|
@@ -1824,6 +1917,319 @@ function jsFrameworksHmrSummary(enabled, frameworks) {
|
|
|
1824
1917
|
const names = frameworks.length > 0 ? frameworks.join(',') : 'none';
|
|
1825
1918
|
return `${messaging_prefix('debug')} js hmr=${enabled ? 'enabled' : 'disabled'} frameworks=${names}`;
|
|
1826
1919
|
}
|
|
1920
|
+
let userMessageDelivered = false;
|
|
1921
|
+
function isUsingPreact(projectPath) {
|
|
1922
|
+
if (hasDependency(projectPath, 'preact')) {
|
|
1923
|
+
if (!userMessageDelivered) {
|
|
1924
|
+
if (isDebug()) console.log(`${messaging_prefix('debug')} ${isUsingIntegration('Preact')}`);
|
|
1925
|
+
userMessageDelivered = true;
|
|
1926
|
+
}
|
|
1927
|
+
return true;
|
|
1928
|
+
}
|
|
1929
|
+
return false;
|
|
1930
|
+
}
|
|
1931
|
+
async function maybeUsePreact(projectPath) {
|
|
1932
|
+
if (!isUsingPreact(projectPath)) return;
|
|
1933
|
+
const requireFromProject = createRequire(__rspack_external_node_path_806ed179.join(projectPath, 'package.json'));
|
|
1934
|
+
const resolveFromProject = (id)=>{
|
|
1935
|
+
try {
|
|
1936
|
+
return requireFromProject.resolve(id);
|
|
1937
|
+
} catch {
|
|
1938
|
+
return;
|
|
1939
|
+
}
|
|
1940
|
+
};
|
|
1941
|
+
const preactPkgJson = resolveFromProject('preact/package.json');
|
|
1942
|
+
const preactDir = preactPkgJson ? __rspack_external_node_path_806ed179.dirname(preactPkgJson) : void 0;
|
|
1943
|
+
const preactCompat = resolveFromProject('preact/compat');
|
|
1944
|
+
const preactTestUtils = resolveFromProject('preact/test-utils');
|
|
1945
|
+
const preactJsxRuntime = resolveFromProject('preact/jsx-runtime');
|
|
1946
|
+
const preactJsxDevRuntime = resolveFromProject('preact/jsx-dev-runtime');
|
|
1947
|
+
const alias = {};
|
|
1948
|
+
if (preactJsxRuntime) alias['preact/jsx-runtime'] = preactJsxRuntime;
|
|
1949
|
+
if (preactJsxDevRuntime) alias['preact/jsx-dev-runtime'] = preactJsxDevRuntime;
|
|
1950
|
+
if (preactDir) alias.preact = preactDir;
|
|
1951
|
+
if (preactCompat) {
|
|
1952
|
+
alias.react = preactCompat;
|
|
1953
|
+
alias['react-dom'] = preactCompat;
|
|
1954
|
+
}
|
|
1955
|
+
if (preactTestUtils) alias['react-dom/test-utils'] = preactTestUtils;
|
|
1956
|
+
if (preactJsxRuntime) alias['react/jsx-runtime'] = preactJsxRuntime;
|
|
1957
|
+
if (preactJsxDevRuntime) alias['react/jsx-dev-runtime'] = preactJsxDevRuntime;
|
|
1958
|
+
return {
|
|
1959
|
+
plugins: [],
|
|
1960
|
+
loaders: void 0,
|
|
1961
|
+
alias
|
|
1962
|
+
};
|
|
1963
|
+
}
|
|
1964
|
+
let react_userMessageDelivered = false;
|
|
1965
|
+
function isUsingReact(projectPath) {
|
|
1966
|
+
if (hasDependency(projectPath, 'react')) {
|
|
1967
|
+
if (!react_userMessageDelivered) {
|
|
1968
|
+
if (isDebug()) console.log(`${messaging_prefix('debug')} ${isUsingIntegration('React')}`);
|
|
1969
|
+
react_userMessageDelivered = true;
|
|
1970
|
+
}
|
|
1971
|
+
return true;
|
|
1972
|
+
}
|
|
1973
|
+
return false;
|
|
1974
|
+
}
|
|
1975
|
+
async function maybeUseReact(projectPath, options = {}) {
|
|
1976
|
+
if (!isUsingReact(projectPath)) return;
|
|
1977
|
+
const requireFromProject = createRequire(__rspack_external_node_path_806ed179.join(projectPath, 'package.json'));
|
|
1978
|
+
let reactPath;
|
|
1979
|
+
let reactDomPath;
|
|
1980
|
+
let reactDomClientPath;
|
|
1981
|
+
let jsxRuntimePath;
|
|
1982
|
+
let jsxDevRuntimePath;
|
|
1983
|
+
try {
|
|
1984
|
+
reactPath = requireFromProject.resolve('react');
|
|
1985
|
+
} catch {}
|
|
1986
|
+
try {
|
|
1987
|
+
reactDomPath = requireFromProject.resolve('react-dom');
|
|
1988
|
+
} catch {}
|
|
1989
|
+
try {
|
|
1990
|
+
reactDomClientPath = requireFromProject.resolve('react-dom/client');
|
|
1991
|
+
} catch {}
|
|
1992
|
+
try {
|
|
1993
|
+
jsxRuntimePath = requireFromProject.resolve('react/jsx-runtime');
|
|
1994
|
+
} catch {}
|
|
1995
|
+
try {
|
|
1996
|
+
jsxDevRuntimePath = requireFromProject.resolve('react/jsx-dev-runtime');
|
|
1997
|
+
} catch {}
|
|
1998
|
+
const alias = {};
|
|
1999
|
+
if (reactPath) alias.react$ = reactPath;
|
|
2000
|
+
if (reactDomPath) alias['react-dom$'] = reactDomPath;
|
|
2001
|
+
if (reactDomClientPath) alias['react-dom/client'] = reactDomClientPath;
|
|
2002
|
+
if (jsxRuntimePath) alias['react/jsx-runtime'] = jsxRuntimePath;
|
|
2003
|
+
if (jsxDevRuntimePath) alias['react/jsx-dev-runtime'] = jsxDevRuntimePath;
|
|
2004
|
+
if (true === options.disableRefresh) return {
|
|
2005
|
+
plugins: [],
|
|
2006
|
+
loaders: void 0,
|
|
2007
|
+
alias
|
|
2008
|
+
};
|
|
2009
|
+
resolveOptionalContractPackageWithoutInstall({
|
|
2010
|
+
contractId: 'react-refresh',
|
|
2011
|
+
projectPath,
|
|
2012
|
+
dependencyId: 'react-refresh'
|
|
2013
|
+
});
|
|
2014
|
+
const ReactRefreshPlugin = loadOptionalContractModuleWithoutInstall({
|
|
2015
|
+
contractId: 'react-refresh',
|
|
2016
|
+
projectPath,
|
|
2017
|
+
dependencyId: '@rspack/plugin-react-refresh',
|
|
2018
|
+
moduleAdapter: (mod)=>mod && (mod.default || mod.ReactRefreshRspackPlugin) || mod
|
|
2019
|
+
});
|
|
2020
|
+
const reactPlugins = [
|
|
2021
|
+
new ReactRefreshPlugin({
|
|
2022
|
+
overlay: false,
|
|
2023
|
+
...void 0 === options.refreshExclude ? {} : {
|
|
2024
|
+
exclude: options.refreshExclude
|
|
2025
|
+
}
|
|
2026
|
+
})
|
|
2027
|
+
];
|
|
2028
|
+
return {
|
|
2029
|
+
plugins: reactPlugins,
|
|
2030
|
+
loaders: void 0,
|
|
2031
|
+
alias
|
|
2032
|
+
};
|
|
2033
|
+
}
|
|
2034
|
+
let solid_userMessageDelivered = false;
|
|
2035
|
+
function isUsingSolid(projectPath) {
|
|
2036
|
+
if (hasDependency(projectPath, 'solid-js')) {
|
|
2037
|
+
if (!solid_userMessageDelivered) {
|
|
2038
|
+
if (isDebug()) console.log(`${messaging_prefix('debug')} ${isUsingIntegration('Solid')}`);
|
|
2039
|
+
humanWarn(solidIsNotSupported());
|
|
2040
|
+
solid_userMessageDelivered = true;
|
|
2041
|
+
}
|
|
2042
|
+
return true;
|
|
2043
|
+
}
|
|
2044
|
+
return false;
|
|
2045
|
+
}
|
|
2046
|
+
function pickEsmCondition(entry) {
|
|
2047
|
+
if ('string' == typeof entry) return entry;
|
|
2048
|
+
if (!entry || 'object' != typeof entry) return;
|
|
2049
|
+
const conditions = entry;
|
|
2050
|
+
for (const name of [
|
|
2051
|
+
'browser',
|
|
2052
|
+
'import',
|
|
2053
|
+
'module',
|
|
2054
|
+
'default'
|
|
2055
|
+
]){
|
|
2056
|
+
const picked = pickEsmCondition(conditions[name]);
|
|
2057
|
+
if (picked) return picked;
|
|
2058
|
+
}
|
|
2059
|
+
}
|
|
2060
|
+
function resolveSolidHyperscript(resolveFromProject) {
|
|
2061
|
+
const packageJsonPath = resolveFromProject('solid-js/package.json');
|
|
2062
|
+
if (packageJsonPath) try {
|
|
2063
|
+
const packageJson = JSON.parse(__rspack_external_node_fs_1b05aee1.readFileSync(packageJsonPath, 'utf-8'));
|
|
2064
|
+
const subpath = pickEsmCondition(packageJson?.exports?.['./h']);
|
|
2065
|
+
if (subpath) {
|
|
2066
|
+
const esmPath = __rspack_external_node_path_806ed179.resolve(__rspack_external_node_path_806ed179.dirname(packageJsonPath), subpath);
|
|
2067
|
+
if (__rspack_external_node_fs_1b05aee1.existsSync(esmPath)) return esmPath;
|
|
2068
|
+
}
|
|
2069
|
+
} catch {}
|
|
2070
|
+
return resolveFromProject('solid-js/h/dist/h.js') || resolveFromProject('solid-js/h');
|
|
2071
|
+
}
|
|
2072
|
+
async function maybeUseSolid(projectPath) {
|
|
2073
|
+
if (!isUsingSolid(projectPath)) return;
|
|
2074
|
+
const requireFromProject = createRequire(__rspack_external_node_path_806ed179.join(projectPath, 'package.json'));
|
|
2075
|
+
const resolveFromProject = (id)=>{
|
|
2076
|
+
try {
|
|
2077
|
+
return requireFromProject.resolve(id);
|
|
2078
|
+
} catch {
|
|
2079
|
+
return;
|
|
2080
|
+
}
|
|
2081
|
+
};
|
|
2082
|
+
const adapter = resolveDevelopDistFile('solid-jsx-runtime');
|
|
2083
|
+
const hyperscript = resolveSolidHyperscript(resolveFromProject);
|
|
2084
|
+
const alias = {
|
|
2085
|
+
'solid-js/jsx-runtime$': adapter,
|
|
2086
|
+
'solid-js/jsx-dev-runtime$': adapter
|
|
2087
|
+
};
|
|
2088
|
+
if (hyperscript) alias['solid-js/h$'] = hyperscript;
|
|
2089
|
+
return {
|
|
2090
|
+
plugins: [],
|
|
2091
|
+
loaders: void 0,
|
|
2092
|
+
alias
|
|
2093
|
+
};
|
|
2094
|
+
}
|
|
2095
|
+
let load_loader_options_userMessageDelivered = false;
|
|
2096
|
+
function resolveLoaderConfigPath(projectPath, framework) {
|
|
2097
|
+
const candidates = [
|
|
2098
|
+
__rspack_external_node_path_806ed179.join(projectPath, `${framework}.loader.ts`),
|
|
2099
|
+
__rspack_external_node_path_806ed179.join(projectPath, `${framework}.loader.mts`),
|
|
2100
|
+
__rspack_external_node_path_806ed179.join(projectPath, `${framework}.loader.js`),
|
|
2101
|
+
__rspack_external_node_path_806ed179.join(projectPath, `${framework}.loader.mjs`)
|
|
2102
|
+
];
|
|
2103
|
+
return candidates.find((p)=>__rspack_external_node_fs_1b05aee1.existsSync(p)) || null;
|
|
2104
|
+
}
|
|
2105
|
+
async function loadLoaderOptions(projectPath, framework) {
|
|
2106
|
+
const configPath = resolveLoaderConfigPath(projectPath, framework);
|
|
2107
|
+
if (configPath) {
|
|
2108
|
+
if (!load_loader_options_userMessageDelivered && isDebug()) {
|
|
2109
|
+
const display = __rspack_external_node_path_806ed179.basename(configPath);
|
|
2110
|
+
console.log(isUsingCustomLoader(display));
|
|
2111
|
+
load_loader_options_userMessageDelivered = true;
|
|
2112
|
+
}
|
|
2113
|
+
try {
|
|
2114
|
+
const module = await import(pathToFileURL(configPath).href);
|
|
2115
|
+
return module.default || module;
|
|
2116
|
+
} catch (err) {
|
|
2117
|
+
const error = err;
|
|
2118
|
+
console.error(`Error loading ${framework} loader options: ${error.message}`);
|
|
2119
|
+
throw err;
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2122
|
+
return null;
|
|
2123
|
+
}
|
|
2124
|
+
let vue_userMessageDelivered = false;
|
|
2125
|
+
function isUsingVue(projectPath) {
|
|
2126
|
+
const using = hasDependency(projectPath, 'vue');
|
|
2127
|
+
if (using && !vue_userMessageDelivered) {
|
|
2128
|
+
if (isDebug()) console.log(`${messaging_prefix('debug')} ${isUsingIntegration('Vue')}`);
|
|
2129
|
+
vue_userMessageDelivered = true;
|
|
2130
|
+
}
|
|
2131
|
+
return using;
|
|
2132
|
+
}
|
|
2133
|
+
function resolveVueBundlerEntry(requireFromProject, id) {
|
|
2134
|
+
try {
|
|
2135
|
+
const manifestPath = requireFromProject.resolve(`${id}/package.json`);
|
|
2136
|
+
const manifest = JSON.parse(__rspack_external_node_fs_1b05aee1.readFileSync(manifestPath, 'utf8'));
|
|
2137
|
+
if ('string' == typeof manifest.module && manifest.module) {
|
|
2138
|
+
const entry = __rspack_external_node_path_806ed179.join(__rspack_external_node_path_806ed179.dirname(manifestPath), manifest.module);
|
|
2139
|
+
if (__rspack_external_node_fs_1b05aee1.existsSync(entry)) return entry;
|
|
2140
|
+
}
|
|
2141
|
+
} catch {}
|
|
2142
|
+
try {
|
|
2143
|
+
return requireFromProject.resolve(id);
|
|
2144
|
+
} catch {
|
|
2145
|
+
return;
|
|
2146
|
+
}
|
|
2147
|
+
}
|
|
2148
|
+
async function maybeUseVue(projectPath, mode = 'development') {
|
|
2149
|
+
if (!isUsingVue(projectPath)) return;
|
|
2150
|
+
const vueLoaderPath = await ensureOptionalContractPackageResolved({
|
|
2151
|
+
contractId: 'vue',
|
|
2152
|
+
projectPath,
|
|
2153
|
+
dependencyId: 'vue-loader'
|
|
2154
|
+
});
|
|
2155
|
+
const VueLoaderPlugin = await ensureOptionalContractModuleLoaded({
|
|
2156
|
+
contractId: 'vue',
|
|
2157
|
+
projectPath,
|
|
2158
|
+
dependencyId: 'vue-loader',
|
|
2159
|
+
moduleAdapter: (mod)=>mod?.VueLoaderPlugin || mod?.default?.VueLoaderPlugin
|
|
2160
|
+
});
|
|
2161
|
+
const customOptions = await loadLoaderOptions(projectPath, 'vue');
|
|
2162
|
+
const defaultLoaders = [
|
|
2163
|
+
{
|
|
2164
|
+
test: /\.vue$/,
|
|
2165
|
+
loader: vueLoaderPath,
|
|
2166
|
+
options: {
|
|
2167
|
+
experimentalInlineMatchResource: true,
|
|
2168
|
+
...customOptions || {}
|
|
2169
|
+
},
|
|
2170
|
+
include: projectPath,
|
|
2171
|
+
exclude: /node_modules/
|
|
2172
|
+
}
|
|
2173
|
+
];
|
|
2174
|
+
const isProd = 'production' === mode;
|
|
2175
|
+
const defaultPlugins = [
|
|
2176
|
+
new VueLoaderPlugin(),
|
|
2177
|
+
new DefinePlugin({
|
|
2178
|
+
__VUE_OPTIONS_API__: JSON.stringify(true),
|
|
2179
|
+
__VUE_PROD_DEVTOOLS__: JSON.stringify(!isProd),
|
|
2180
|
+
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: JSON.stringify(!isProd)
|
|
2181
|
+
})
|
|
2182
|
+
];
|
|
2183
|
+
const requireFromProject = createRequire(__rspack_external_node_path_806ed179.join(projectPath, 'package.json'));
|
|
2184
|
+
const resolveFromProject = (id)=>resolveVueBundlerEntry(requireFromProject, id);
|
|
2185
|
+
const alias = {};
|
|
2186
|
+
const vuePath = resolveFromProject('vue');
|
|
2187
|
+
const vueRuntimeDom = resolveFromProject('@vue/runtime-dom');
|
|
2188
|
+
const vueRuntimeCore = resolveFromProject('@vue/runtime-core');
|
|
2189
|
+
const vueShared = resolveFromProject('@vue/shared');
|
|
2190
|
+
if (vuePath) alias.vue$ = vuePath;
|
|
2191
|
+
if (vueRuntimeDom) alias['@vue/runtime-dom'] = vueRuntimeDom;
|
|
2192
|
+
if (vueRuntimeCore) alias['@vue/runtime-core'] = vueRuntimeCore;
|
|
2193
|
+
if (vueShared) alias['@vue/shared'] = vueShared;
|
|
2194
|
+
return {
|
|
2195
|
+
plugins: defaultPlugins,
|
|
2196
|
+
loaders: defaultLoaders,
|
|
2197
|
+
alias
|
|
2198
|
+
};
|
|
2199
|
+
}
|
|
2200
|
+
function isUsingJsxFramework(projectPath) {
|
|
2201
|
+
return isUsingReact(projectPath) || isUsingPreact(projectPath) || isUsingSolid(projectPath) || isUsingVue(projectPath);
|
|
2202
|
+
}
|
|
2203
|
+
function getJsxImportSource(projectPath) {
|
|
2204
|
+
if (isUsingSolid(projectPath)) return 'solid-js';
|
|
2205
|
+
if (isUsingPreact(projectPath) && !isUsingReact(projectPath)) return 'preact';
|
|
2206
|
+
if (isUsingVue(projectPath) && !isUsingReact(projectPath) && !isUsingPreact(projectPath)) return 'vue';
|
|
2207
|
+
return 'react';
|
|
2208
|
+
}
|
|
2209
|
+
function swcParserForFile(resourcePath, jsxInPlainJs) {
|
|
2210
|
+
const clean = String(resourcePath || '').split('?')[0];
|
|
2211
|
+
const ext = __rspack_external_node_path_806ed179.extname(clean).toLowerCase();
|
|
2212
|
+
if ('.tsx' === ext || '.mtsx' === ext) return {
|
|
2213
|
+
syntax: "typescript",
|
|
2214
|
+
tsx: true,
|
|
2215
|
+
dynamicImport: true
|
|
2216
|
+
};
|
|
2217
|
+
if ('.ts' === ext || '.mts' === ext || '.cts' === ext) return {
|
|
2218
|
+
syntax: "typescript",
|
|
2219
|
+
tsx: false,
|
|
2220
|
+
dynamicImport: true
|
|
2221
|
+
};
|
|
2222
|
+
if ('.jsx' === ext || '.mjsx' === ext) return {
|
|
2223
|
+
syntax: "ecmascript",
|
|
2224
|
+
jsx: true,
|
|
2225
|
+
dynamicImport: true
|
|
2226
|
+
};
|
|
2227
|
+
return {
|
|
2228
|
+
syntax: "ecmascript",
|
|
2229
|
+
jsx: jsxInPlainJs,
|
|
2230
|
+
dynamicImport: true
|
|
2231
|
+
};
|
|
2232
|
+
}
|
|
1827
2233
|
let hasShownUserMessage = false;
|
|
1828
2234
|
function findNearestPackageJsonDirectory(startPath) {
|
|
1829
2235
|
return findNearestProjectManifestDirSync(startPath, 6);
|
|
@@ -1884,13 +2290,18 @@ function ensureTypeScriptConfig(projectPath) {
|
|
|
1884
2290
|
}
|
|
1885
2291
|
}
|
|
1886
2292
|
function defaultTypeScriptConfig(projectPath, _opts) {
|
|
2293
|
+
const usesJsFramework = isUsingJSFramework(projectPath);
|
|
2294
|
+
const jsxImportSource = usesJsFramework ? {
|
|
2295
|
+
jsxImportSource: getJsxImportSource(projectPath)
|
|
2296
|
+
} : {};
|
|
1887
2297
|
return {
|
|
1888
2298
|
compilerOptions: {
|
|
1889
2299
|
allowJs: true,
|
|
1890
2300
|
allowSyntheticDefaultImports: true,
|
|
1891
2301
|
esModuleInterop: true,
|
|
1892
2302
|
forceConsistentCasingInFileNames: true,
|
|
1893
|
-
jsx:
|
|
2303
|
+
jsx: usesJsFramework ? 'react-jsx' : 'preserve',
|
|
2304
|
+
...jsxImportSource,
|
|
1894
2305
|
lib: [
|
|
1895
2306
|
'dom',
|
|
1896
2307
|
'dom.iterable',
|
|
@@ -2122,7 +2533,8 @@ async function extensionBuild(pathOrRemoteUrl, buildOptions) {
|
|
|
2122
2533
|
distDisplay,
|
|
2123
2534
|
browser,
|
|
2124
2535
|
mode: resolvedMode,
|
|
2125
|
-
enabled: mergedBuildOptions.addonLint
|
|
2536
|
+
enabled: mergedBuildOptions.addonLint,
|
|
2537
|
+
chunkProvenance: ()=>collectChunkDependencyProvenance(stats.compilation)
|
|
2126
2538
|
});
|
|
2127
2539
|
if ('missing' === lint.status && lint.hint) lintLines.push(lint.hint);
|
|
2128
2540
|
else if ('failed' === lint.status && isDebug()) lintLines.push(lint.debugLine);
|
|
@@ -2152,7 +2564,7 @@ async function extensionBuild(pathOrRemoteUrl, buildOptions) {
|
|
|
2152
2564
|
if (warningDetails) humanLine(warningDetails);
|
|
2153
2565
|
}
|
|
2154
2566
|
for (const line of lintLines)humanLine(line);
|
|
2155
|
-
humanLine(buildComplete(browser, distDisplay, summary.total_bytes));
|
|
2567
|
+
humanLine(buildComplete(browser, distDisplay, summary.total_bytes, resolvedMode));
|
|
2156
2568
|
for (const artifact of getZipArtifacts(stats.compilation)){
|
|
2157
2569
|
const artifactPath = useStagingSwap && artifact.path.startsWith(stagingDistPath) ? distPath + artifact.path.slice(stagingDistPath.length) : artifact.path;
|
|
2158
2570
|
const zipDisplay = relativeToCwd(artifactPath) || artifactPath;
|
|
@@ -2212,6 +2624,9 @@ function viaBroker(broker, instruction) {
|
|
|
2212
2624
|
function formatReloadingLine(label) {
|
|
2213
2625
|
return `${messaging_prefix('info')} Reloading ${label}…`;
|
|
2214
2626
|
}
|
|
2627
|
+
function formatQueuedReloadLine(label) {
|
|
2628
|
+
return `${messaging_prefix('info')} Queued ${label} for the extension to apply when it reconnects.`;
|
|
2629
|
+
}
|
|
2215
2630
|
async function dispatchReload(instruction, executor) {
|
|
2216
2631
|
if (!instruction) return;
|
|
2217
2632
|
if ('true' === process.env.EXTENSION_NO_RELOAD) return;
|
|
@@ -2221,8 +2636,11 @@ async function dispatchReload(instruction, executor) {
|
|
|
2221
2636
|
if (instruction.label) console.log(formatReloadingLine(instruction.label));
|
|
2222
2637
|
return;
|
|
2223
2638
|
}
|
|
2224
|
-
const warning = executor.broker.undeliveredReloadWarning?.(
|
|
2225
|
-
|
|
2639
|
+
const warning = executor.broker.undeliveredReloadWarning?.(executor.producerRestartExpected ? {
|
|
2640
|
+
producerRestartExpected: true
|
|
2641
|
+
} : void 0);
|
|
2642
|
+
if (warning) return void console.warn(warning);
|
|
2643
|
+
if (executor.producerRestartExpected && instruction.label) console.log(formatQueuedReloadLine(instruction.label));
|
|
2226
2644
|
}
|
|
2227
2645
|
}
|
|
2228
2646
|
function isForcedFullPath(normalized) {
|
|
@@ -2674,6 +3092,43 @@ class BrowsersPlugin {
|
|
|
2674
3092
|
});
|
|
2675
3093
|
}
|
|
2676
3094
|
}
|
|
3095
|
+
function union(previous, next) {
|
|
3096
|
+
return [
|
|
3097
|
+
...new Set([
|
|
3098
|
+
...previous || [],
|
|
3099
|
+
...next || []
|
|
3100
|
+
])
|
|
3101
|
+
].sort();
|
|
3102
|
+
}
|
|
3103
|
+
function reloadSurvivingPackage(instruction) {
|
|
3104
|
+
if (!instruction) return;
|
|
3105
|
+
if ("content-scripts" === instruction.type || 'page' === instruction.type) return instruction;
|
|
3106
|
+
const entries = instruction.changedContentScriptEntries || [];
|
|
3107
|
+
if (0 === entries.length) return;
|
|
3108
|
+
return {
|
|
3109
|
+
...instruction,
|
|
3110
|
+
type: "content-scripts",
|
|
3111
|
+
label: formatReloadContextLabel("content_script", instruction.changedAssets || [])
|
|
3112
|
+
};
|
|
3113
|
+
}
|
|
3114
|
+
function mergeInstructions(previous, next) {
|
|
3115
|
+
if (!previous) return next;
|
|
3116
|
+
if (!next) return previous;
|
|
3117
|
+
const entries = union(previous.changedContentScriptEntries, next.changedContentScriptEntries);
|
|
3118
|
+
const scriptFiles = union(previous.changedScriptFiles, next.changedScriptFiles);
|
|
3119
|
+
if (0 === entries.length) return scriptFiles.length > 0 ? {
|
|
3120
|
+
...next,
|
|
3121
|
+
changedScriptFiles: scriptFiles
|
|
3122
|
+
} : next;
|
|
3123
|
+
const base = "content-scripts" === next.type ? next : previous;
|
|
3124
|
+
return {
|
|
3125
|
+
...base,
|
|
3126
|
+
changedContentScriptEntries: entries,
|
|
3127
|
+
...scriptFiles.length > 0 ? {
|
|
3128
|
+
changedScriptFiles: scriptFiles
|
|
3129
|
+
} : {}
|
|
3130
|
+
};
|
|
3131
|
+
}
|
|
2677
3132
|
class SafariDevPlugin {
|
|
2678
3133
|
packager;
|
|
2679
3134
|
static name = 'safari-dev';
|
|
@@ -2683,23 +3138,45 @@ class SafariDevPlugin {
|
|
|
2683
3138
|
active = false;
|
|
2684
3139
|
pending = null;
|
|
2685
3140
|
idleWaiters = [];
|
|
3141
|
+
reloadBroker;
|
|
2686
3142
|
constructor(packager){
|
|
2687
3143
|
this.packager = packager;
|
|
2688
3144
|
}
|
|
3145
|
+
setReloadBroker(broker) {
|
|
3146
|
+
this.reloadBroker = broker;
|
|
3147
|
+
}
|
|
2689
3148
|
apply(compiler) {
|
|
3149
|
+
const changedSources = compiler.hooks?.watchRun ? createChangedSourcesTracker(compiler) : void 0;
|
|
2690
3150
|
compiler.hooks.done.tapPromise(SafariDevPlugin.name, async (stats)=>{
|
|
2691
3151
|
const compilation = stats.compilation;
|
|
2692
3152
|
const hasErrors = compilation.errors && compilation.errors.length > 0;
|
|
2693
3153
|
if (hasErrors) return void this.emitter.emit('error', {
|
|
2694
3154
|
errors: compilation.errors.map((e)=>'string' == typeof e ? e : e.message || String(e))
|
|
2695
3155
|
});
|
|
3156
|
+
const outputPath = String(compilation.options?.output?.path || '');
|
|
3157
|
+
const contextDir = String(compilation.options?.context || '');
|
|
3158
|
+
let instruction;
|
|
3159
|
+
if (!this.firstRun && changedSources) {
|
|
3160
|
+
const { forcedFull, changedSources: sources } = changedSources.snapshot();
|
|
3161
|
+
instruction = reloadSurvivingPackage(classifyReloadFromSources({
|
|
3162
|
+
changedSources: sources,
|
|
3163
|
+
forcedFull,
|
|
3164
|
+
getContentScriptCount: ()=>readContentScriptCount(compilation, outputPath),
|
|
3165
|
+
getSourceFeatureIndex: ()=>buildSourceFeatureIndex(compilation, contextDir),
|
|
3166
|
+
outputPath
|
|
3167
|
+
}));
|
|
3168
|
+
}
|
|
2696
3169
|
const target = {
|
|
2697
|
-
outputPath
|
|
2698
|
-
contextDir
|
|
3170
|
+
outputPath,
|
|
3171
|
+
contextDir,
|
|
3172
|
+
instruction
|
|
2699
3173
|
};
|
|
2700
3174
|
if (this.firstRun) return void await this.runOne(target, 'full');
|
|
2701
3175
|
if (this.active) {
|
|
2702
|
-
this.pending =
|
|
3176
|
+
this.pending = {
|
|
3177
|
+
...target,
|
|
3178
|
+
instruction: mergeInstructions(this.pending?.instruction, target.instruction)
|
|
3179
|
+
};
|
|
2703
3180
|
return;
|
|
2704
3181
|
}
|
|
2705
3182
|
this.active = true;
|
|
@@ -2736,6 +3213,10 @@ class SafariDevPlugin {
|
|
|
2736
3213
|
return;
|
|
2737
3214
|
}
|
|
2738
3215
|
if (wasFirstRun) this.firstRun = false;
|
|
3216
|
+
if (!wasFirstRun && target.instruction && this.reloadBroker) await dispatchReload(target.instruction, {
|
|
3217
|
+
broker: this.reloadBroker,
|
|
3218
|
+
producerRestartExpected: true
|
|
3219
|
+
});
|
|
2739
3220
|
this.emitter.emit('compiled', {
|
|
2740
3221
|
outputPath: target.outputPath,
|
|
2741
3222
|
contextDir: target.contextDir,
|
|
@@ -2838,4 +3319,4 @@ async function extensionDev(pathOrRemoteUrl, devOptions) {
|
|
|
2838
3319
|
process.exit(1);
|
|
2839
3320
|
}
|
|
2840
3321
|
}
|
|
2841
|
-
export { BuildEmitter, applySplitChunksGuard, attachLifecycleStream, buildSourceFeatureIndex, classifyEntrySurface, classifyReloadFromSources, createChangedSourcesTracker, createLifecycleStream, defaultSplitChunks, dispatchReload,
|
|
3322
|
+
export { BuildEmitter, applySplitChunksGuard, attachLifecycleStream, buildSourceFeatureIndex, classifyEntrySurface, classifyReloadFromSources, createChangedSourcesTracker, createLifecycleStream, defaultSplitChunks, dispatchReload, ensureOptionalContractPackageResolved, ensureTypeScriptConfig, extensionBuild, extensionDev, getJsxImportSource, getUserTypeScriptConfigFile, hasDependency, humanLine, isUsingIntegration, isUsingJsxFramework, isUsingReact, isUsingTypeScript, isUsingVue, jsFrameworksConfigsDetected, jsFrameworksHmrSummary, jsFrameworksIntegrationsEnabled, loadLoaderOptions, maybeUsePreact, maybeUseReact, maybeUseSolid, maybeUseVue, readContentScriptCount, recordZipArtifact, resolveDevelopDistFile, resolveDevelopInstallRoot, swcParserForFile };
|