extension-develop 4.1.34 → 4.1.35
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/206~0.mjs +33 -0
- package/dist/363~0.mjs +1 -1
- package/dist/469~0.mjs +98 -16
- package/dist/519~0.mjs +12 -1
- package/dist/771~0.mjs +49 -8
- package/dist/832~0.mjs +127 -25
- package/dist/840~0.mjs +215 -54
- package/dist/846~0.mjs +16 -14
- package/dist/852~0.mjs +2 -0
- package/dist/88~0.mjs +10 -1
- package/dist/command-preview.d.ts +2 -0
- package/dist/contract/codes.json +9 -0
- package/dist/contracts-entry.d.ts +1 -1
- package/dist/contracts.mjs +109 -1
- package/dist/css-parse-guard-loader.mjs +7 -2
- package/dist/dev-server/control-bridge/log-rule.d.ts +38 -0
- package/dist/dev-server/control-bridge/logs-query.d.ts +2 -55
- package/dist/dev-server/control-bridge/producer-runtime.d.ts +1 -1
- package/dist/dev-server/html-refresh.d.ts +10 -0
- package/dist/dev-server/port-manager.d.ts +14 -0
- package/dist/dev-server/reserved-listen.d.ts +9 -0
- package/dist/dev-server/session-restart.d.ts +1 -1
- package/dist/dev-server~0.mjs +155 -30
- package/dist/extension-js-devtools/build-stamp.json +2 -2
- package/dist/extension-js-devtools/chrome/background/service_worker.js +2 -2
- package/dist/extension-js-devtools/chrome/pages/welcome.css +1 -1
- package/dist/extension-js-devtools/chromium/background/service_worker.js +2 -2
- package/dist/extension-js-devtools/chromium/pages/welcome.css +1 -1
- package/dist/extension-js-devtools/edge/background/service_worker.js +2 -2
- package/dist/extension-js-devtools/edge/pages/welcome.css +1 -1
- package/dist/extension-js-devtools/firefox/background/scripts.js +2 -2
- package/dist/extension-js-devtools/firefox/pages/welcome.css +1 -1
- package/dist/extension-js-theme/build-stamp.json +2 -2
- package/dist/feature-scripts-classic-concat-loader.js +45 -2
- package/dist/feature-scripts-classic-concat-loader.mjs +45 -2
- package/dist/feature-scripts-classic-traced-globals-loader.mjs +111 -0
- package/dist/feature-scripts-content-script-wrapper.js +10 -6
- package/dist/feature-scripts-content-script-wrapper.mjs +10 -6
- package/dist/lib/config-loader.d.ts +1 -0
- package/dist/lib/css-minimizer-options.d.ts +8 -0
- package/dist/lib/develop-context.d.ts +1 -1
- package/dist/lib/live-dev-session.d.ts +5 -0
- package/dist/lib/messages.d.ts +9 -1
- package/dist/lib/messaging.d.ts +2 -0
- package/dist/lib/package-manager.d.ts +7 -1
- package/dist/lib/paths.d.ts +1 -0
- package/dist/lib/project.d.ts +10 -2
- package/dist/lib/remote-archive.d.ts +11 -0
- package/dist/lib/rename-with-retry.d.ts +6 -0
- package/dist/lib/session-paths.d.ts +1 -0
- package/dist/lib/zip.d.ts +5 -1
- package/dist/plugin-browsers/index.d.ts +2 -0
- package/dist/plugin-css/css-in-content-script-loader.d.ts +1 -1
- package/dist/plugin-css/css-in-html-loader.d.ts +1 -1
- package/dist/plugin-css/css-lib/build-css-rules.d.ts +2 -1
- package/dist/plugin-css/css-lib/verbatim-css.d.ts +1 -0
- package/dist/plugin-js-frameworks/js-tools/typescript.d.ts +1 -0
- package/dist/plugin-playwright/index.d.ts +3 -0
- package/dist/plugin-special-folders/messages.d.ts +1 -0
- package/dist/plugin-special-folders/warn-upon-folder-changes.d.ts +1 -1
- package/dist/plugin-web-extension/feature-html/html-lib/options-dialog-floor.d.ts +7 -0
- package/dist/plugin-web-extension/feature-html/html-lib/patch-html.d.ts +3 -1
- package/dist/plugin-web-extension/feature-html/steps/update-html-file.d.ts +1 -0
- package/dist/plugin-web-extension/feature-manifest/steps/apply-dev-defaults-lib/dev-injected-hosts.d.ts +4 -1
- package/dist/plugin-web-extension/feature-scripts/messages.d.ts +1 -0
- package/dist/plugin-web-extension/feature-scripts/steps/add-content-script-wrapper/classic-concat-loader.d.ts +1 -0
- package/dist/plugin-web-extension/feature-scripts/steps/add-content-script-wrapper/content-script-wrapper.d.ts +1 -0
- package/dist/plugin-web-extension/feature-scripts/steps/add-content-script-wrapper/index.d.ts +1 -0
- package/dist/plugin-web-extension/feature-scripts/steps/classic-traced-globals-loader.d.ts +7 -0
- package/dist/plugin-web-extension/feature-scripts/steps/warn-unshipped-runtime-assets.d.ts +32 -0
- package/dist/plugin-web-extension/feature-web-resources/web-resources-lib/messages.d.ts +1 -0
- package/dist/plugin-web-extension/shared/discover-runtime-surfaces.d.ts +2 -0
- package/dist/plugin-web-extension/shared/script-graph.d.ts +4 -0
- package/dist/rspack-config~0.mjs +799 -196
- package/dist/types.d.ts +7 -1
- package/dist/zip~0.mjs +14 -7
- package/package.json +3 -3
- package/dist/plugin-css/css-lib/is-content-script.d.ts +0 -2
package/dist/206~0.mjs
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
|
|
2
|
+
import * as __rspack_external_node_fs_1b05aee1 from "node:fs";
|
|
3
|
+
const RETRYABLE_RENAME_CODES = new Set([
|
|
4
|
+
'EPERM',
|
|
5
|
+
'EACCES',
|
|
6
|
+
'EBUSY'
|
|
7
|
+
]);
|
|
8
|
+
const RENAME_RETRY_DELAYS_MS = [
|
|
9
|
+
10,
|
|
10
|
+
20,
|
|
11
|
+
40,
|
|
12
|
+
80,
|
|
13
|
+
160,
|
|
14
|
+
320
|
|
15
|
+
];
|
|
16
|
+
function sleepSync(ms) {
|
|
17
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
18
|
+
}
|
|
19
|
+
function renameSyncWithRetry(from, to, options = {}) {
|
|
20
|
+
const platform = options.platform ?? process.platform;
|
|
21
|
+
const rename = options.rename ?? __rspack_external_node_fs_1b05aee1.renameSync;
|
|
22
|
+
const sleep = options.sleep ?? sleepSync;
|
|
23
|
+
for(let attempt = 0;; attempt++)try {
|
|
24
|
+
rename(from, to);
|
|
25
|
+
return;
|
|
26
|
+
} catch (error) {
|
|
27
|
+
const code = error?.code;
|
|
28
|
+
const delay = RENAME_RETRY_DELAYS_MS[attempt];
|
|
29
|
+
if ('win32' !== platform || !code || !RETRYABLE_RENAME_CODES.has(code) || void 0 === delay) throw error;
|
|
30
|
+
sleep(delay);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export { renameSyncWithRetry };
|
package/dist/363~0.mjs
CHANGED
|
@@ -1871,4 +1871,4 @@ function buildTemplateVars(combinedVars, browser, mode) {
|
|
|
1871
1871
|
vars.EXTENSION_PUBLIC_MODE = modeValue;
|
|
1872
1872
|
return vars;
|
|
1873
1873
|
}
|
|
1874
|
-
export { DevSessionRestartScheduler, EnvPlugin, applyIndependentHtmlSurfaces, bindDevSessionRestart, boring, buildCanonicalManifestWithOverrides, cleanDistRemovedSummary, cleanDistSkippedNotFound, cleanDistStarting, collectRootAbsoluteRefs, contentScriptEntryDroppedForBrowser, dropWebkitUnsupportedKeys, edgeStoreKeyDropped, externalAssetOutputPath, fatalManifestShapeFixed, geckoActionUnsupportedOnMv2, geckoSidePanelUnsupported, getCurrentManifestContent, getManifestContent, getOriginalManifestContent, hasMv2SandboxPolicy, hasMv3StringPolicy, iconOutputPath, importMetaUrlForEmitPath, invalidThemeValue, isCompilerRestarting, isFolder, isFromFilepathList, isHollowContentScript, isManifestAddress, isWebkitUnsupportedPermission, legacyManifestPathWarning, manifestDepsTracked, manifestEmitSuccess, manifestFieldMistyped, manifestFilesInTurnedOffPublic, manifestIncludeSummary, manifestInvalidError, manifestLegacyWarningsSummary, manifestOverridesSummary, manifestVersionLostForBrowser, missingGeckoDataCollectionPermissions, mv2ActionFoldedIntoBrowserAction, mv2SandboxPolicyDropped, mv3BackgroundPageUnsupported, mv3BrowserActionFoldedIntoAction, mv3StringPolicyRewritten, normalizeManifestOutputPath, omitWebkitDroppedEntries, pageActionDropReason, pageActionDroppedForBrowserAction, pageActionNotSupportedByBrowser, projectConfigChangedRestartRequired, requestDevSessionRestart, resolveRootAbsoluteRef, safariBookmarksUnsupported, safariDownloadsUnsupported, safariHistoryUnsupported, safariIdentityUnsupported, safariIdleUnsupported, safariManagementUnsupported, safariMemberUnsupported, safariNotificationsUnsupported, safariOffscreenUnsupported, safariOmniboxUnsupported, safariSidePanelUnsupported, safariTabGroupsUnsupported, safariUserScriptsUnsupported, serverRestartRequiredFromManifestError, setCurrentManifestContent, setOriginalManifestContent, shouldFoldActionIntoBrowserAction, shouldFoldBrowserActionIntoAction, sidebarFoldTarget, sidebarKeyTranslatedForBrowser, themeIconOutputPath, themeImageOutputPath, themeNotSupportedByBrowser, toJsStringLiteral, unbindDevSessionRestart, unixify, vendorPrefixedKeyDropped, zipPackagingSkipped };
|
|
1874
|
+
export { DevSessionRestartScheduler, EnvPlugin, OPTIONS_HTML_FEATURE, applyIndependentHtmlSurfaces, bindDevSessionRestart, boring, buildCanonicalManifestWithOverrides, cleanDistRemovedSummary, cleanDistSkippedNotFound, cleanDistStarting, collectRootAbsoluteRefs, contentScriptEntryDroppedForBrowser, dropWebkitUnsupportedKeys, edgeStoreKeyDropped, externalAssetOutputPath, fatalManifestShapeFixed, geckoActionUnsupportedOnMv2, geckoSidePanelUnsupported, getCurrentManifestContent, getManifestContent, getOriginalManifestContent, hasMv2SandboxPolicy, hasMv3StringPolicy, iconOutputPath, importMetaUrlForEmitPath, invalidThemeValue, isCompilerRestarting, isFolder, isFromFilepathList, isHollowContentScript, isManifestAddress, isWebkitUnsupportedPermission, legacyManifestPathWarning, manifestDepsTracked, manifestEmitSuccess, manifestFieldMistyped, manifestFilesInTurnedOffPublic, manifestIncludeSummary, manifestInvalidError, manifestLegacyWarningsSummary, manifestOverridesSummary, manifestVersionLostForBrowser, missingGeckoDataCollectionPermissions, mv2ActionFoldedIntoBrowserAction, mv2SandboxPolicyDropped, mv3BackgroundPageUnsupported, mv3BrowserActionFoldedIntoAction, mv3StringPolicyRewritten, normalizeManifestOutputPath, omitWebkitDroppedEntries, pageActionDropReason, pageActionDroppedForBrowserAction, pageActionNotSupportedByBrowser, projectConfigChangedRestartRequired, requestDevSessionRestart, resolveRootAbsoluteRef, safariBookmarksUnsupported, safariDownloadsUnsupported, safariHistoryUnsupported, safariIdentityUnsupported, safariIdleUnsupported, safariManagementUnsupported, safariMemberUnsupported, safariNotificationsUnsupported, safariOffscreenUnsupported, safariOmniboxUnsupported, safariSidePanelUnsupported, safariTabGroupsUnsupported, safariUserScriptsUnsupported, serverRestartRequiredFromManifestError, setCurrentManifestContent, setOriginalManifestContent, shouldFoldActionIntoBrowserAction, shouldFoldBrowserActionIntoAction, sidebarFoldTarget, sidebarKeyTranslatedForBrowser, themeIconOutputPath, themeImageOutputPath, themeNotSupportedByBrowser, toJsStringLiteral, unbindDevSessionRestart, unixify, vendorPrefixedKeyDropped, zipPackagingSkipped };
|
package/dist/469~0.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createRequire as __extjsCreateRequire } from "node:module"; const require = __extjsCreateRequire(import.meta.url);
|
|
2
2
|
import pintor from "pintor";
|
|
3
|
+
import { createHash } from "node:crypto";
|
|
3
4
|
import { findNearestDenoConfigSync, validateDenoConfig, PROJECT_MANIFEST_FILENAMES, readProjectDependencies } from "./731~0.mjs";
|
|
4
5
|
import { isEmulatorLaneEnabled, isEmulatorBrowser, parseJsonSafe } from "./937~0.mjs";
|
|
5
6
|
import { stripChannelPrefix, artifactNoun, prefix as messaging_prefix, CODES, humanLine, fmt, isDebug, hasChannelPrefix } from "./852~0.mjs";
|
|
@@ -153,6 +154,10 @@ function normalizeBrowser(browser, chromiumBinary, geckoBinary, safariBinary) {
|
|
|
153
154
|
function getDistPath(packageJsonDir, browser) {
|
|
154
155
|
return asAbsolute(__rspack_external_node_path_806ed179.join(packageJsonDir, 'dist', browser));
|
|
155
156
|
}
|
|
157
|
+
function getBuildDistPath(packageJsonDir, browser, outDir) {
|
|
158
|
+
if (!outDir) return getDistPath(packageJsonDir, browser);
|
|
159
|
+
return asAbsolute(__rspack_external_node_path_806ed179.resolve(packageJsonDir, outDir, browser));
|
|
160
|
+
}
|
|
156
161
|
function computePreviewOutputPath(struct, browser, explicitOutputPath) {
|
|
157
162
|
const { manifestDir, packageJsonDir } = getDirs(struct);
|
|
158
163
|
if (explicitOutputPath) return asAbsolute(explicitOutputPath);
|
|
@@ -299,8 +304,8 @@ function browserLaunchFailed(browser, reason) {
|
|
|
299
304
|
function authorInstallNotice(target) {
|
|
300
305
|
return `${messaging_prefix('debug')} install target=${target}`;
|
|
301
306
|
}
|
|
302
|
-
function projectInstallInWorkspaceRoot(workspaceRoot) {
|
|
303
|
-
return `${getLoggingPrefix('info')} This project is a
|
|
307
|
+
function projectInstallInWorkspaceRoot(workspaceRoot, managerName = 'pnpm') {
|
|
308
|
+
return `${getLoggingPrefix('info')} This project is a ${managerName} workspace member, installing from the workspace root at ${pintor.blue(workspaceRoot)}.`;
|
|
304
309
|
}
|
|
305
310
|
function projectInstallFallbackToNpm(pmName) {
|
|
306
311
|
return `${getLoggingPrefix('warn')} Dependency install with ${pmName} failed.\nExtension.js retries once with npm so the build can continue.`;
|
|
@@ -312,6 +317,15 @@ function anotherDevSessionActive(browser, pid, runId) {
|
|
|
312
317
|
const run = runId ? `, run ${runId}` : '';
|
|
313
318
|
return `${getLoggingPrefix('warn')} Another dev session is already writing dist/${browser} (PID ${pid}${run}).\nBoth sessions rebuild the same output, so the last compile wins.\nStop the other session. A distinct ${fmt.code('EXTENSION_INSTANCE_ID')} keeps the ports apart, but ready.json and the eval token hold one session per browser.`;
|
|
314
319
|
}
|
|
320
|
+
function buildOutDirInvalid(value) {
|
|
321
|
+
return `${getLoggingPrefix('error')} ${fmt.code('--out-dir')} needs a folder path other than the project root, got ${fmt.code(value || '(empty)')}.\nPass a folder such as ${fmt.code('--out-dir build')}, and the build writes ${fmt.code('build/<browser>')}.`;
|
|
322
|
+
}
|
|
323
|
+
function buildSharesDevDist(browser, distDisplay, pid) {
|
|
324
|
+
return `${getLoggingPrefix('warn')} A dev session (PID ${pid}) is serving ${distDisplay}, and this build replaces its files.\nPass ${fmt.code('--out-dir <path>')} to write the ${browser} build next to it and keep the dev session as it is.`;
|
|
325
|
+
}
|
|
326
|
+
function buildSharesDevDistText(distDisplay, pid) {
|
|
327
|
+
return `a dev session (PID ${pid}) is serving ${distDisplay}, so this build replaces its files unless it runs with --out-dir <path>.`;
|
|
328
|
+
}
|
|
315
329
|
function anotherDevSessionRefused(browser, pid, port) {
|
|
316
330
|
const where = port ? ` on port ${port}` : '';
|
|
317
331
|
return `${getLoggingPrefix('error')} Another dev session already owns dist/${browser} (PID ${pid}${where}).\nA second session would overwrite its eval token and leave its contract pointing at the wrong one.\nStop that session first. One dev session per browser owns dist/${browser}, whatever its ${fmt.code('EXTENSION_INSTANCE_ID')}.`;
|
|
@@ -526,6 +540,13 @@ function unpackagedSuccessfully() {
|
|
|
526
540
|
function failedToDownloadOrWriteZIPFileError(error) {
|
|
527
541
|
return `${getLoggingPrefix('error')} Couldn't download the ZIP file or write it to disk.\n${pintor.gray('REASON')} ${pintor.red(String(error))}\nCheck the URL, your network and that the destination is writable, then try again.`;
|
|
528
542
|
}
|
|
543
|
+
function remoteZipAccessRefused(url, status, expiry) {
|
|
544
|
+
const when = expiry ? `${pintor.gray(expiry.expired ? 'EXPIRED' : 'EXPIRES')} ${expiry.at.toISOString()}\n` : '';
|
|
545
|
+
return `${getLoggingPrefix('error')} The server refused access to this link (HTTP ${status}).\n${pintor.gray('URL')} ${pintor.underline(url)}\n` + when + `Its access token may have expired, been revoked, or been changed while copying.\n` + "Copy the link again on one line, or get a new one from where it was shared.";
|
|
546
|
+
}
|
|
547
|
+
function removedWhitespaceFromUrl(url) {
|
|
548
|
+
return `${getLoggingPrefix('warn')} The link had spaces inside it, so they were removed.\n${pintor.gray('URL')} ${pintor.underline(url)}\nA line wrapped by the terminal does that. Copy the link again on one line if the download is refused.`;
|
|
549
|
+
}
|
|
529
550
|
function failedToWriteZIPFileError(error) {
|
|
530
551
|
return `${getLoggingPrefix('error')} Couldn't write the unpacked ZIP file to disk.\n${pintor.gray('REASON')} ${pintor.red(String(error))}\nCheck that the destination is writable, then try again.`;
|
|
531
552
|
}
|
|
@@ -775,6 +796,58 @@ function validatePackageJson(packageJsonPath) {
|
|
|
775
796
|
return false;
|
|
776
797
|
}
|
|
777
798
|
}
|
|
799
|
+
function repairPastedUrl(url) {
|
|
800
|
+
const repaired = url.replace(/\s+/g, '');
|
|
801
|
+
return {
|
|
802
|
+
url: repaired,
|
|
803
|
+
repaired: repaired !== url
|
|
804
|
+
};
|
|
805
|
+
}
|
|
806
|
+
function expClaim(segment) {
|
|
807
|
+
try {
|
|
808
|
+
const parsed = JSON.parse(Buffer.from(segment, 'base64url').toString('utf-8'));
|
|
809
|
+
const exp = parsed?.exp;
|
|
810
|
+
if ('number' == typeof exp && Number.isFinite(exp)) return exp;
|
|
811
|
+
if ('string' == typeof exp && /^\d+$/.test(exp)) return Number(exp);
|
|
812
|
+
} catch {}
|
|
813
|
+
}
|
|
814
|
+
function tokenExpiry(url, now = Date.now()) {
|
|
815
|
+
let params;
|
|
816
|
+
try {
|
|
817
|
+
params = new URL(url).searchParams;
|
|
818
|
+
} catch {
|
|
819
|
+
return;
|
|
820
|
+
}
|
|
821
|
+
for (const name of [
|
|
822
|
+
't',
|
|
823
|
+
'token'
|
|
824
|
+
]){
|
|
825
|
+
const value = params.get(name);
|
|
826
|
+
if (value) for (const segment of value.split('.')){
|
|
827
|
+
const exp = expClaim(segment);
|
|
828
|
+
if (void 0 === exp) continue;
|
|
829
|
+
const ms = exp > 1e12 ? exp : 1000 * exp;
|
|
830
|
+
return {
|
|
831
|
+
at: new Date(ms),
|
|
832
|
+
expired: ms <= now
|
|
833
|
+
};
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
function remoteArchiveCacheRoot(env = process.env, platform = process.platform) {
|
|
838
|
+
const xdg = String(env.XDG_CACHE_HOME || '').trim();
|
|
839
|
+
if (xdg) return __rspack_external_node_path_806ed179.join(xdg, 'extension.js', 'previews');
|
|
840
|
+
const home = String(env.HOME || env.USERPROFILE || '').trim() || __rspack_external_node_os_4f3c9d58.homedir();
|
|
841
|
+
if (home) return 'darwin' === platform ? __rspack_external_node_path_806ed179.join(home, 'Library', 'Caches', 'extension.js', 'previews') : __rspack_external_node_path_806ed179.join(home, '.cache', 'extension.js', 'previews');
|
|
842
|
+
return __rspack_external_node_path_806ed179.resolve(process.cwd(), '.cache', 'extension.js', 'previews');
|
|
843
|
+
}
|
|
844
|
+
function remoteArchiveCacheKey(url) {
|
|
845
|
+
const parsed = new URL(url);
|
|
846
|
+
const pathname = parsed.pathname.replace(/\.zip$/i, '');
|
|
847
|
+
const slug = pathname.split('/').filter(Boolean).map((segment)=>segment.replace(/[^A-Za-z0-9._-]+/g, '-')).join('-').replace(/^[.-]+/, '').slice(0, 80) || 'archive';
|
|
848
|
+
const digest = createHash('sha256').update(`${parsed.host}${parsed.pathname}`).digest('hex').slice(0, 8);
|
|
849
|
+
return `${slug}-${digest}`;
|
|
850
|
+
}
|
|
778
851
|
const EXTENSION_DEPENDENCY_NAMES = [
|
|
779
852
|
'extension',
|
|
780
853
|
'extension-develop',
|
|
@@ -991,10 +1064,16 @@ function listDirectories(dir) {
|
|
|
991
1064
|
return [];
|
|
992
1065
|
}
|
|
993
1066
|
}
|
|
994
|
-
async function importUrlSourceFromZip(pathOrRemoteUrl) {
|
|
1067
|
+
async function importUrlSourceFromZip(pathOrRemoteUrl, remoteArchive) {
|
|
995
1068
|
const cwd = process.cwd();
|
|
996
1069
|
const { downloadAndExtractZip } = await import("./zip~0.mjs");
|
|
997
|
-
const
|
|
1070
|
+
const archive = remoteArchive ? 'destination' in remoteArchive ? {
|
|
1071
|
+
destination: remoteArchive.destination
|
|
1072
|
+
} : {
|
|
1073
|
+
destination: __rspack_external_node_path_806ed179.join(remoteArchive.cacheRoot, remoteArchiveCacheKey(pathOrRemoteUrl)),
|
|
1074
|
+
reuse: true
|
|
1075
|
+
} : {};
|
|
1076
|
+
const extractedPath = await withTimeout(downloadAndExtractZip(pathOrRemoteUrl, cwd, archive), REMOTE_FETCH_TIMEOUT_MS, pathOrRemoteUrl);
|
|
998
1077
|
return extractedPath;
|
|
999
1078
|
}
|
|
1000
1079
|
async function importLocalSourceFromZip(zipFilePath) {
|
|
@@ -1002,21 +1081,24 @@ async function importLocalSourceFromZip(zipFilePath) {
|
|
|
1002
1081
|
const { extractLocalZip } = await import("./zip~0.mjs");
|
|
1003
1082
|
return await extractLocalZip(zipFilePath, cwd);
|
|
1004
1083
|
}
|
|
1005
|
-
async function getProjectPath(pathOrRemoteUrl) {
|
|
1084
|
+
async function getProjectPath(pathOrRemoteUrl, options = {}) {
|
|
1006
1085
|
if (!pathOrRemoteUrl) return process.cwd();
|
|
1007
1086
|
if (project_isUrl(pathOrRemoteUrl)) {
|
|
1008
|
-
const
|
|
1087
|
+
const pasted = /^\s*https?:/i.test(pathOrRemoteUrl) ? repairPastedUrl(pathOrRemoteUrl) : {
|
|
1088
|
+
url: pathOrRemoteUrl,
|
|
1089
|
+
repaired: false
|
|
1090
|
+
};
|
|
1091
|
+
const source = pasted.url;
|
|
1092
|
+
const url = new URL(source);
|
|
1009
1093
|
if (url.protocol.startsWith('http')) {
|
|
1094
|
+
if (pasted.repaired) humanLine(removedWhitespaceFromUrl(source.split('?')[0]));
|
|
1010
1095
|
const pathname = url.pathname.toLowerCase();
|
|
1011
|
-
if (pathname.endsWith('.zip')) return await importUrlSourceFromZip(
|
|
1012
|
-
if ('https://github.com' !== url.origin)
|
|
1013
|
-
const urlSource = await importUrlSourceFromZip(pathOrRemoteUrl);
|
|
1014
|
-
return urlSource;
|
|
1015
|
-
}
|
|
1096
|
+
if (pathname.endsWith('.zip')) return await importUrlSourceFromZip(source, options.remoteArchive);
|
|
1097
|
+
if ('https://github.com' !== url.origin) return await importUrlSourceFromZip(source, options.remoteArchive);
|
|
1016
1098
|
const [owner, project] = url.pathname.split('/').slice(1, 3);
|
|
1017
1099
|
const projectName = __rspack_external_node_path_806ed179.basename(url.pathname);
|
|
1018
|
-
const { projectPath, downloaded } = await importUrlSourceFromGithub(
|
|
1019
|
-
humanLine(downloaded ? creatingProjectPath() : reusingDownloadedProject(projectPath,
|
|
1100
|
+
const { projectPath, downloaded } = await importUrlSourceFromGithub(source, downloadingProjectPath(projectName, `https://github.com/${owner}/${project}`));
|
|
1101
|
+
humanLine(downloaded ? creatingProjectPath() : reusingDownloadedProject(projectPath, source));
|
|
1020
1102
|
return projectPath;
|
|
1021
1103
|
}
|
|
1022
1104
|
}
|
|
@@ -1080,8 +1162,8 @@ function findLoneExtensionUnderCompanionDir(projectPath) {
|
|
|
1080
1162
|
const manifests = findCompanionManifests(projectPath);
|
|
1081
1163
|
return 1 !== manifests.length || isBuiltInCompanionManifest(manifests[0]) ? void 0 : manifests[0];
|
|
1082
1164
|
}
|
|
1083
|
-
async function getProjectStructure(pathOrRemoteUrl) {
|
|
1084
|
-
const projectPath = await getProjectPath(pathOrRemoteUrl);
|
|
1165
|
+
async function getProjectStructure(pathOrRemoteUrl, options = {}) {
|
|
1166
|
+
const projectPath = await getProjectPath(pathOrRemoteUrl, options);
|
|
1085
1167
|
return resolveProjectStructureSync(projectPath);
|
|
1086
1168
|
}
|
|
1087
1169
|
function resolveProjectStructureSync(projectPath, options = {}) {
|
|
@@ -1196,4 +1278,4 @@ function resolveProjectStructureSync(projectPath, options = {}) {
|
|
|
1196
1278
|
} : {}
|
|
1197
1279
|
};
|
|
1198
1280
|
}
|
|
1199
|
-
export { addonLintDependencyAttribution, addonLintFailed, addonLintFailedDebug, addonLintFinding, addonLintMore, addonLintNotInstalled, addonLintSummary, anotherDevSessionActive, anotherDevSessionRefused, asAbsolute, authorInstallNotice, browserLaunchFailed, buildAssetsTree, buildCommandFailed, buildComplete, buildFailed, buildShareHint, buildWarningsDetails, codedError, collapseHomeDir, computePreviewOutputPath, configBrowserOrThrow, configLoadingError, configResolvedChangeIgnored, configUnknownKeys, configWrongShape, debugBrowser, debugContextPath, debugDirs, debugExtensionsToLoad, debugOutputPath, debugPreviewOutput, debugSplitChunksNarrowed, devCommandFailed, devtoolsEngineFor, displayPath, downloadingText, extensionLoadRecovered, extensionLoadStillRefused, failedToDownloadOrWriteZIPFileError, failedToWriteZIPFileError, getDirs, getDistPath, getProjectStructure, invalidRemoteZip, isUsingExperimentalConfig, listOutputFiles, localZipNotFound, localZipUnreadable, managedDependencyCopyWarning, manifestInvalidJson, needsInstall, noCompanionExtensionsResolved, normalizeBrowser, notAZipArchive, operaBuildUnminified, packagingDistributionFiles, packagingSourceFiles, previewHasNothingToRun, previewing, previewingCustomOutput, previewingSourceFallback, productionControlOpen, projectInstallFallbackToNpm, projectInstallInWorkspaceRoot, projectInstallScriptsDisabled, relativeToDir, remoteSourceDestinationTaken, remoteZipDamaged, resolveProjectStructureSync, runtimeChunkKeptInline, safariBuildOutputNotFound, safariInvalidBundleId, sessionStateIgnoreAdded, starting, toPosixPath, treeWithDistFilesBrowser, treeWithSourceAndDistFiles, treeWithSourceFiles, unpackagedSuccessfully, unpackagingExtension, updatingTypeDefinitions, writingTypeDefinitions, writingTypeDefinitionsError, zipArtifactNotCreated, zipArtifactReady, zipEntryOutsideFolder, zipSkippedSymlinks };
|
|
1281
|
+
export { addonLintDependencyAttribution, addonLintFailed, addonLintFailedDebug, addonLintFinding, addonLintMore, addonLintNotInstalled, addonLintSummary, anotherDevSessionActive, anotherDevSessionRefused, asAbsolute, authorInstallNotice, browserLaunchFailed, buildAssetsTree, buildCommandFailed, buildComplete, buildFailed, buildOutDirInvalid, buildShareHint, buildSharesDevDist, buildSharesDevDistText, buildWarningsDetails, codedError, collapseHomeDir, computePreviewOutputPath, configBrowserOrThrow, configLoadingError, configResolvedChangeIgnored, configUnknownKeys, configWrongShape, debugBrowser, debugContextPath, debugDirs, debugExtensionsToLoad, debugOutputPath, debugPreviewOutput, debugSplitChunksNarrowed, devCommandFailed, devtoolsEngineFor, displayPath, downloadingText, extensionLoadRecovered, extensionLoadStillRefused, failedToDownloadOrWriteZIPFileError, failedToWriteZIPFileError, getBuildDistPath, getDirs, getDistPath, getProjectStructure, invalidRemoteZip, isUsingExperimentalConfig, listOutputFiles, localZipNotFound, localZipUnreadable, managedDependencyCopyWarning, manifestInvalidJson, needsInstall, noCompanionExtensionsResolved, normalizeBrowser, notAZipArchive, operaBuildUnminified, packagingDistributionFiles, packagingSourceFiles, previewHasNothingToRun, previewing, previewingCustomOutput, previewingSourceFallback, productionControlOpen, projectInstallFallbackToNpm, projectInstallInWorkspaceRoot, projectInstallScriptsDisabled, relativeToDir, remoteArchiveCacheRoot, remoteSourceDestinationTaken, remoteZipAccessRefused, remoteZipDamaged, resolveProjectStructureSync, reusingDownloadedProject, runtimeChunkKeptInline, safariBuildOutputNotFound, safariInvalidBundleId, sessionStateIgnoreAdded, starting, toPosixPath, tokenExpiry, treeWithDistFilesBrowser, treeWithSourceAndDistFiles, treeWithSourceFiles, unpackagedSuccessfully, unpackagingExtension, updatingTypeDefinitions, writingTypeDefinitions, writingTypeDefinitionsError, zipArtifactNotCreated, zipArtifactReady, zipEntryOutsideFolder, zipSkippedSymlinks };
|
package/dist/519~0.mjs
CHANGED
|
@@ -135,4 +135,15 @@ function compiledSourceSpelling(assetName, api, literal, emittedPath) {
|
|
|
135
135
|
lines.push(`Reference the emitted path: ${pintor.blue(emittedPath)}.`);
|
|
136
136
|
return lines.join('\n');
|
|
137
137
|
}
|
|
138
|
-
|
|
138
|
+
function runtimeAssetFolderNotShipped(assetName, literal, folder, missing) {
|
|
139
|
+
const shown = folder ? `${folder}/` : 'the extension root';
|
|
140
|
+
const publicPath = folder ? `public/${folder}/` : 'public/';
|
|
141
|
+
const lines = [];
|
|
142
|
+
lines.push(`${assetName} names '${literal}' at runtime, but ${missing.length} file${1 === missing.length ? '' : 's'} in ${shown} ${1 === missing.length ? "isn't" : "aren't"} in the output.`);
|
|
143
|
+
for (const file of missing.slice(0, 3))lines.push(`${pintor.gray('NOT SHIPPED')} ${pintor.underline(file)}`);
|
|
144
|
+
if (missing.length > 3) lines.push(pintor.gray(`and ${missing.length - 3} more`));
|
|
145
|
+
lines.push("Paths built from strings at runtime are not traced, so these files fail to load.");
|
|
146
|
+
lines.push(`Move the folder to ${pintor.blue(publicPath)} at the project root so it ships at the same path.`);
|
|
147
|
+
return lines.join('\n');
|
|
148
|
+
}
|
|
149
|
+
export { buildConstantNeverDefined, compiledSourceSpelling, entrySplitAcrossInitialFiles, fetchedFileDependencyMissing, getURLDependencyMissing, importScriptsDependencyMissing, injectedCompiledSourceLiteral, injectedFileDependencyMissing, reservedScriptsFolder, runtimeAssetFolderNotShipped, runtimeSetSurfaceDependencyMissing, staticImportDependencyMissing, workerStartedFromPageContext };
|
package/dist/771~0.mjs
CHANGED
|
@@ -52,18 +52,59 @@ function ensureSessionArtifactsIgnoreFile(projectPath) {
|
|
|
52
52
|
if (!__rspack_external_node_fs_1b05aee1.existsSync(readme)) __rspack_external_node_fs_1b05aee1.writeFileSync(readme, SESSION_ARTIFACTS_README_CONTENT);
|
|
53
53
|
} catch {}
|
|
54
54
|
}
|
|
55
|
+
function runGit(args, cwd) {
|
|
56
|
+
return spawnSync('git', args, {
|
|
57
|
+
cwd,
|
|
58
|
+
encoding: 'utf8',
|
|
59
|
+
stdio: 'pipe'
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function canonicalPath(filePath) {
|
|
63
|
+
return (__rspack_external_node_fs_1b05aee1.realpathSync.native || __rspack_external_node_fs_1b05aee1.realpathSync)(filePath);
|
|
64
|
+
}
|
|
65
|
+
function toPosix(filePath) {
|
|
66
|
+
return filePath.split(__rspack_external_node_path_806ed179.sep).join('/');
|
|
67
|
+
}
|
|
68
|
+
function checkIgnoreSource(stdout) {
|
|
69
|
+
const match = /^(.*?):\d+:[^\t]*\t/.exec(stdout);
|
|
70
|
+
return match?.[1] || void 0;
|
|
71
|
+
}
|
|
55
72
|
function isAlreadyIgnoredByGit(projectPath) {
|
|
56
73
|
try {
|
|
57
|
-
const
|
|
74
|
+
const top = runGit([
|
|
75
|
+
'rev-parse',
|
|
76
|
+
'--show-toplevel'
|
|
77
|
+
], projectPath);
|
|
78
|
+
if (0 !== top.status) return false;
|
|
79
|
+
const repoRoot = String(top.stdout).trim();
|
|
80
|
+
const canonicalRoot = canonicalPath(repoRoot);
|
|
81
|
+
const projectFromRoot = toPosix(__rspack_external_node_path_806ed179.relative(canonicalRoot, canonicalPath(projectPath)));
|
|
82
|
+
const target = projectFromRoot ? `${projectFromRoot}/.extension-js/` : '.extension-js/';
|
|
83
|
+
const match = runGit([
|
|
58
84
|
'check-ignore',
|
|
59
|
-
'-
|
|
85
|
+
'-v',
|
|
60
86
|
'--',
|
|
61
|
-
|
|
62
|
-
],
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
87
|
+
target
|
|
88
|
+
], repoRoot);
|
|
89
|
+
if (0 !== match.status) return false;
|
|
90
|
+
const source = checkIgnoreSource(String(match.stdout));
|
|
91
|
+
if (!source) return false;
|
|
92
|
+
const sourcePath = __rspack_external_node_path_806ed179.resolve(repoRoot, source);
|
|
93
|
+
if ('.gitignore' !== __rspack_external_node_path_806ed179.basename(sourcePath)) return false;
|
|
94
|
+
let sourceFromRoot;
|
|
95
|
+
try {
|
|
96
|
+
sourceFromRoot = __rspack_external_node_path_806ed179.relative(canonicalRoot, canonicalPath(sourcePath));
|
|
97
|
+
} catch {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
if (sourceFromRoot.startsWith('..') || __rspack_external_node_path_806ed179.isAbsolute(sourceFromRoot)) return false;
|
|
101
|
+
const tracked = runGit([
|
|
102
|
+
'ls-files',
|
|
103
|
+
'--error-unmatch',
|
|
104
|
+
'--',
|
|
105
|
+
toPosix(sourceFromRoot)
|
|
106
|
+
], repoRoot);
|
|
107
|
+
return 0 === tracked.status;
|
|
67
108
|
} catch {
|
|
68
109
|
return false;
|
|
69
110
|
}
|