@ohos-ports/rsbuild-core 2.2.9-beta.0
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/LICENSE +21 -0
- package/README.md +27 -0
- package/bin/rsbuild.js +20 -0
- package/compiled/@rstackjs/load-config/index.d.ts +87 -0
- package/compiled/@rstackjs/load-config/license +21 -0
- package/compiled/@rstackjs/load-config/package.json +1 -0
- package/compiled/chokidar/index.d.ts +385 -0
- package/compiled/chokidar/license +21 -0
- package/compiled/chokidar/package.json +1 -0
- package/compiled/connect-next/index.d.ts +57 -0
- package/compiled/connect-next/license +26 -0
- package/compiled/connect-next/package.json +1 -0
- package/compiled/cors/index.d.ts +56 -0
- package/compiled/cors/license +22 -0
- package/compiled/cors/package.json +1 -0
- package/compiled/css-loader/api.js +85 -0
- package/compiled/css-loader/getUrl.js +26 -0
- package/compiled/css-loader/index.d.ts +1 -0
- package/compiled/css-loader/index.js +2 -0
- package/compiled/css-loader/license +20 -0
- package/compiled/css-loader/noSourceMaps.js +5 -0
- package/compiled/css-loader/package.json +1 -0
- package/compiled/css-loader/sourceMaps.js +16 -0
- package/compiled/html-rspack-plugin/default_index.ejs +9 -0
- package/compiled/html-rspack-plugin/htmlLoader.js +157 -0
- package/compiled/html-rspack-plugin/index.d.ts +395 -0
- package/compiled/html-rspack-plugin/index.js +2400 -0
- package/compiled/html-rspack-plugin/license +20 -0
- package/compiled/html-rspack-plugin/package.json +1 -0
- package/compiled/http-proxy-middleware/index.d.ts +455 -0
- package/compiled/http-proxy-middleware/license +22 -0
- package/compiled/http-proxy-middleware/package.json +1 -0
- package/compiled/jiti/LICENSE +21 -0
- package/compiled/jiti/README.md +258 -0
- package/compiled/jiti/dist/babel.cjs +47446 -0
- package/compiled/jiti/dist/jiti.cjs +5990 -0
- package/compiled/jiti/lib/jiti-cli.mjs +19 -0
- package/compiled/jiti/lib/jiti-hooks.mjs +89 -0
- package/compiled/jiti/lib/jiti-native.mjs +76 -0
- package/compiled/jiti/lib/jiti-register.d.mts +1 -0
- package/compiled/jiti/lib/jiti-register.mjs +2 -0
- package/compiled/jiti/lib/jiti-static.mjs +19 -0
- package/compiled/jiti/lib/jiti.cjs +24 -0
- package/compiled/jiti/lib/jiti.d.cts +8 -0
- package/compiled/jiti/lib/jiti.d.mts +8 -0
- package/compiled/jiti/lib/jiti.mjs +23 -0
- package/compiled/jiti/lib/types.d.ts +420 -0
- package/compiled/jiti/package.json +146 -0
- package/compiled/postcss/index.js +1 -0
- package/compiled/postcss/lib/at-rule.d.ts +139 -0
- package/compiled/postcss/lib/comment.d.ts +67 -0
- package/compiled/postcss/lib/container.d.ts +474 -0
- package/compiled/postcss/lib/css-syntax-error.d.ts +247 -0
- package/compiled/postcss/lib/declaration.d.ts +150 -0
- package/compiled/postcss/lib/document.d.ts +68 -0
- package/compiled/postcss/lib/fromJSON.d.ts +9 -0
- package/compiled/postcss/lib/input.d.ts +226 -0
- package/compiled/postcss/lib/lazy-result.d.ts +189 -0
- package/compiled/postcss/lib/list.d.ts +60 -0
- package/compiled/postcss/lib/no-work-result.d.ts +45 -0
- package/compiled/postcss/lib/node.d.ts +555 -0
- package/compiled/postcss/lib/parse.d.ts +9 -0
- package/compiled/postcss/lib/postcss.d.ts +464 -0
- package/compiled/postcss/lib/previous-map.d.ts +80 -0
- package/compiled/postcss/lib/processor.d.ts +114 -0
- package/compiled/postcss/lib/result.d.ts +204 -0
- package/compiled/postcss/lib/root.d.ts +86 -0
- package/compiled/postcss/lib/rule.d.ts +126 -0
- package/compiled/postcss/lib/source-map-js.d.ts +4 -0
- package/compiled/postcss/lib/stringifier.d.ts +45 -0
- package/compiled/postcss/lib/stringify.d.ts +9 -0
- package/compiled/postcss/lib/warning.d.ts +146 -0
- package/compiled/postcss/license +20 -0
- package/compiled/postcss/package.json +1 -0
- package/compiled/postcss-loader/index.d.ts +1 -0
- package/compiled/postcss-loader/index.js +721 -0
- package/compiled/postcss-loader/license +20 -0
- package/compiled/postcss-loader/package.json +1 -0
- package/compiled/rslog/index.d.ts +98 -0
- package/compiled/rslog/license +21 -0
- package/compiled/rslog/package.json +1 -0
- package/compiled/rspack-chain/license +22 -0
- package/compiled/rspack-chain/package.json +1 -0
- package/compiled/rspack-chain/types/index.d.ts +515 -0
- package/compiled/rspack-manifest-plugin/index.d.ts +52 -0
- package/compiled/rspack-manifest-plugin/license +21 -0
- package/compiled/rspack-manifest-plugin/package.json +1 -0
- package/compiled/style-loader/index.d.ts +1 -0
- package/compiled/style-loader/index.js +370 -0
- package/compiled/style-loader/license +20 -0
- package/compiled/style-loader/package.json +1 -0
- package/compiled/style-loader/runtime/injectStylesIntoLinkTag.js +29 -0
- package/compiled/style-loader/runtime/injectStylesIntoStyleTag.js +84 -0
- package/compiled/style-loader/runtime/insertBySelector.js +34 -0
- package/compiled/style-loader/runtime/insertStyleElement.js +10 -0
- package/compiled/style-loader/runtime/isEqualLocals.js +28 -0
- package/compiled/style-loader/runtime/isOldIE.js +17 -0
- package/compiled/style-loader/runtime/setAttributesWithAttributes.js +13 -0
- package/compiled/style-loader/runtime/setAttributesWithAttributesAndNonce.js +9 -0
- package/compiled/style-loader/runtime/setAttributesWithoutAttributes.js +10 -0
- package/compiled/style-loader/runtime/singletonStyleDomAPI.js +86 -0
- package/compiled/style-loader/runtime/styleDomAPI.js +61 -0
- package/compiled/style-loader/runtime/styleTagTransform.js +14 -0
- package/compiled/ws/index.d.ts +445 -0
- package/compiled/ws/license +21 -0
- package/compiled/ws/package.json +1 -0
- package/dist/build.d.ts +4 -0
- package/dist/c.js +10 -0
- package/dist/chokidar.js +2 -0
- package/dist/chokidar.js.LICENSE.txt +1 -0
- package/dist/cli/commands.d.ts +31 -0
- package/dist/cli/index.d.ts +7 -0
- package/dist/cli/init.d.ts +7 -0
- package/dist/client/f~0.js +22 -0
- package/dist/client/hmr.js +267 -0
- package/dist/client/overlay.js +214 -0
- package/dist/configChain.d.ts +84 -0
- package/dist/connect-next.js +2 -0
- package/dist/connect-next.js.LICENSE.txt +57 -0
- package/dist/constants.d.ts +67 -0
- package/dist/cors.js +188 -0
- package/dist/cors.js.LICENSE.txt +11 -0
- package/dist/createCompiler.d.ts +6 -0
- package/dist/createContext.d.ts +12 -0
- package/dist/createRsbuild.d.ts +4 -0
- package/dist/cssUrlLoader.mjs +34 -0
- package/dist/defaultConfig.d.ts +23 -0
- package/dist/freshImport.js +90 -0
- package/dist/helpers/cachedImport.d.ts +2 -0
- package/dist/helpers/compiler.d.ts +5 -0
- package/dist/helpers/css.d.ts +3 -0
- package/dist/helpers/exitHook.d.ts +3 -0
- package/dist/helpers/format.d.ts +4 -0
- package/dist/helpers/fs.d.ts +16 -0
- package/dist/helpers/html.d.ts +2 -0
- package/dist/helpers/index.d.ts +29 -0
- package/dist/helpers/overlayConfig.d.ts +4 -0
- package/dist/helpers/packageJson.d.ts +9 -0
- package/dist/helpers/path.d.ts +22 -0
- package/dist/helpers/restartManager.d.ts +15 -0
- package/dist/helpers/stats.d.ts +17 -0
- package/dist/helpers/url.d.ts +11 -0
- package/dist/helpers/vendors.d.ts +12 -0
- package/dist/helpers/version.d.ts +7 -0
- package/dist/hooks.d.ts +41 -0
- package/dist/http-proxy-middleware.js +14 -0
- package/dist/http-proxy-middleware.js.LICENSE.txt +34 -0
- package/dist/ignoreCssLoader.mjs +9 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +1 -0
- package/dist/initConfigs.d.ts +18 -0
- package/dist/initPlugins.d.ts +7 -0
- package/dist/inspectConfig.d.ts +7 -0
- package/dist/launch-editor-middleware.js +1 -0
- package/dist/loadConfig.d.ts +31 -0
- package/dist/loadEnv.d.ts +54 -0
- package/dist/loader/cssUrlLoader.d.ts +9 -0
- package/dist/loader/ignoreCssLoader.d.ts +10 -0
- package/dist/loader/transformLoader.d.ts +8 -0
- package/dist/loader/transformRawLoader.d.ts +4 -0
- package/dist/loader/workerLoader.d.ts +6 -0
- package/dist/logger.d.ts +24 -0
- package/dist/m.js +10348 -0
- package/dist/m.js.LICENSE.txt +26 -0
- package/dist/manifest-plugin.js +1 -0
- package/dist/memfs.js +1 -0
- package/dist/mergeConfig.d.ts +7 -0
- package/dist/open.js +2 -0
- package/dist/pluginHelper.d.ts +4 -0
- package/dist/pluginManager.d.ts +19 -0
- package/dist/plugins/appIcon.d.ts +2 -0
- package/dist/plugins/asset.d.ts +3 -0
- package/dist/plugins/basic.d.ts +4 -0
- package/dist/plugins/cache.d.ts +2 -0
- package/dist/plugins/cleanOutput.d.ts +2 -0
- package/dist/plugins/css.d.ts +8 -0
- package/dist/plugins/define.d.ts +2 -0
- package/dist/plugins/entry.d.ts +2 -0
- package/dist/plugins/externals.d.ts +9 -0
- package/dist/plugins/fileSize.d.ts +7 -0
- package/dist/plugins/html.d.ts +9 -0
- package/dist/plugins/inlineChunk.d.ts +6 -0
- package/dist/plugins/lazyCompilation.d.ts +2 -0
- package/dist/plugins/manifest.d.ts +2 -0
- package/dist/plugins/minimize.d.ts +10 -0
- package/dist/plugins/moduleFederation.d.ts +2 -0
- package/dist/plugins/nodeAddons.d.ts +2 -0
- package/dist/plugins/nonce.d.ts +2 -0
- package/dist/plugins/output.d.ts +2 -0
- package/dist/plugins/progress.d.ts +2 -0
- package/dist/plugins/resolve.d.ts +2 -0
- package/dist/plugins/resourceHints.d.ts +2 -0
- package/dist/plugins/rsdoctor.d.ts +2 -0
- package/dist/plugins/rspackProfile.d.ts +4 -0
- package/dist/plugins/server.d.ts +3 -0
- package/dist/plugins/sourceMap.d.ts +2 -0
- package/dist/plugins/splitChunks.d.ts +4 -0
- package/dist/plugins/sri.d.ts +2 -0
- package/dist/plugins/swc.d.ts +4 -0
- package/dist/plugins/target.d.ts +2 -0
- package/dist/plugins/wasm.d.ts +2 -0
- package/dist/plugins/worker.d.ts +2 -0
- package/dist/r.js +7 -0
- package/dist/range-parser.js +55 -0
- package/dist/range-parser.js.LICENSE.txt +6 -0
- package/dist/remapping.js +201 -0
- package/dist/restart.d.ts +15 -0
- package/dist/rslib-runtime.js +49 -0
- package/dist/rspack-plugins/RsbuildHtmlPlugin.d.ts +37 -0
- package/dist/rspack-plugins/resource-hints/HtmlResourceHintsPlugin.d.ts +36 -0
- package/dist/rspack-plugins/resource-hints/doesChunkBelongToHtml.d.ts +27 -0
- package/dist/rspack-plugins/resource-hints/extractChunks.d.ts +22 -0
- package/dist/rspack-plugins/resource-hints/getResourceType.d.ts +21 -0
- package/dist/rspackConfig.d.ts +8 -0
- package/dist/server/ansiHTML.d.ts +3 -0
- package/dist/server/assets-middleware/getFileFromUrl.d.ts +11 -0
- package/dist/server/assets-middleware/index.d.ts +35 -0
- package/dist/server/assets-middleware/memoryFileSystem.d.ts +2 -0
- package/dist/server/assets-middleware/middleware.d.ts +7 -0
- package/dist/server/assets-middleware/parseTokenList.d.ts +1 -0
- package/dist/server/assets-middleware/setupOutputFileSystem.d.ts +3 -0
- package/dist/server/assets-middleware/setupWriteToDisk.d.ts +15 -0
- package/dist/server/browserLogs.d.ts +8 -0
- package/dist/server/buildManager.d.ts +32 -0
- package/dist/server/cliShortcuts.d.ts +19 -0
- package/dist/server/compileState.d.ts +5 -0
- package/dist/server/devMiddlewares.d.ts +18 -0
- package/dist/server/devServer.d.ts +47 -0
- package/dist/server/environment.d.ts +8 -0
- package/dist/server/gracefulShutdown.d.ts +8 -0
- package/dist/server/gzipMiddleware.d.ts +2 -0
- package/dist/server/helper.d.ts +118 -0
- package/dist/server/historyApiFallback.d.ts +10 -0
- package/dist/server/hmrFallback.d.ts +1 -0
- package/dist/server/httpServer.d.ts +7 -0
- package/dist/server/middlewares.d.ts +31 -0
- package/dist/server/open.d.ts +12 -0
- package/dist/server/overlay.d.ts +3 -0
- package/dist/server/previewServer.d.ts +4 -0
- package/dist/server/proxy.d.ts +7 -0
- package/dist/server/publicPathnames.d.ts +2 -0
- package/dist/server/runner/asModule.d.ts +2 -0
- package/dist/server/runner/basic.d.ts +25 -0
- package/dist/server/runner/cjs.d.ts +10 -0
- package/dist/server/runner/esm.d.ts +6 -0
- package/dist/server/runner/index.d.ts +6 -0
- package/dist/server/runner/type.d.ts +42 -0
- package/dist/server/serverSetup.d.ts +2 -0
- package/dist/server/socketServer.d.ts +113 -0
- package/dist/server/watchFiles.d.ts +15 -0
- package/dist/sirv.js +122 -0
- package/dist/tinyglobby.js +1 -0
- package/dist/trace-mapping.js +548 -0
- package/dist/transformLoader.mjs +36 -0
- package/dist/transformRawLoader.mjs +4 -0
- package/dist/types/config.d.ts +1796 -0
- package/dist/types/context.d.ts +89 -0
- package/dist/types/hooks.d.ts +261 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/plugin.d.ts +479 -0
- package/dist/types/rsbuild.d.ts +241 -0
- package/dist/types/rspack.d.ts +10 -0
- package/dist/types/thirdParty.d.ts +161 -0
- package/dist/types/utils.d.ts +16 -0
- package/dist/workerLoader.mjs +94 -0
- package/dist/ws.js +2 -0
- package/package.json +107 -0
- package/static/openChrome.applescript +95 -0
- package/types.d.ts +422 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { RsbuildConfig } from './types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Deeply merges multiple Rsbuild configuration objects.
|
|
4
|
+
*
|
|
5
|
+
* This function returns a new merged configuration object and does not modify
|
|
6
|
+
* the input configuration objects.
|
|
7
|
+
*/ export declare const mergeRsbuildConfig: <T = RsbuildConfig>(...originalConfigs: (T | undefined)[]) => T;
|
package/dist/open.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
let e,r,o,t,a;import i from"node:process";import n from"node:path";import{fileURLToPath as s}from"node:url";import l,{execFile as c}from"node:child_process";import m,{constants as p}from"node:fs/promises";import{promisify as d}from"node:util";import f from"node:os";import u from"node:fs";import{Buffer as w}from"node:buffer";function g(){return void 0===r&&(r=(()=>{try{return u.statSync("/run/.containerenv"),!0}catch{return!1}})()||(void 0===e&&(e=function(){try{return u.statSync("/.dockerenv"),!0}catch{return!1}}()||function(){try{return u.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}()),e)),r}let h=()=>{if("linux"!==i.platform)return!1;if(f.release().toLowerCase().includes("microsoft"))return!g();try{if(u.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft"))return!g()}catch{}return!!(u.existsSync("/proc/sys/fs/binfmt_misc/WSLInterop")||u.existsSync("/run/WSL"))&&!g()},v=i.env.__IS_WSL_TEST__?h:h(),S=d(l.execFile),x=()=>`${i.env.SYSTEMROOT||i.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`,y=async(e,r={})=>{let{powerShellPath:o,...t}=r,a=y.encodeCommand(e);return S(o??x(),[...y.argumentsPrefix,a],{encoding:"utf8",...t})};y.argumentsPrefix=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"],y.encodeCommand=e=>w.from(e,"utf16le").toString("base64"),y.escapeArgument=e=>`'${String(e).replaceAll("'","''")}'`;let b=d(l.execFile),E=(a="/mnt/",async function(){if(t)return t;let e="/etc/wsl.conf",r=!1;try{await m.access(e,p.F_OK),r=!0}catch{}if(!r)return a;let o=function(e){for(let r of e.split("\n")){if(/^\s*#/.test(r))continue;let e=/^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(r);if(e)return e.groups.mountPoint.trim().replaceAll(/^["']|["']$/g,"")}}(await m.readFile(e,{encoding:"utf8"}));return void 0===o?a:t=(t=o).endsWith("/")?t:`${t}/`}),P=async()=>{let e=await E();return`${e}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`},C=v?P:x,A=async()=>o??=(async()=>{try{let e=await C();return await m.access(e,p.X_OK),!0}catch{return!1}})(),B=async()=>{let e=await C(),r=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{stdout:o}=await y(r,{powerShellPath:e,cwd:n.dirname(e)});return o.trim()},T=e=>/^[a-z]+:\/\//i.test(e),O=async e=>{let r=Array.isArray(e),o=r?e:[e],t=[],a=[];for(let[e,r]of o.entries())T(r)||(t.push(e),a.push(r));let i=[...o];if(a.length>0)try{let{stdout:e}=await b("wslpath",["-aw",...a],{encoding:"utf8"}),r=e.split(/\r?\n/).filter(Boolean);for(let[e,a]of t.entries())i[a]=r[e]??o[a]}catch{}return r?i:i[0]},F=d(l.execFile),L=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"],M=e=>w.from(e,"utf16le").toString("base64"),H=e=>[...L,M(e)],_=async(e,r={})=>{let{powerShellPath:o,...t}=r;return F(o??`${i.env.SYSTEMROOT||i.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`,H(e),{encoding:"utf8",...t,shell:!1})};function I(e,r,o){let t=o=>Object.defineProperty(e,r,{value:o,enumerable:!0,writable:!0});return Object.defineProperty(e,r,{configurable:!0,enumerable:!0,get(){let e=o();return t(e),e},set(e){t(e)}}),e}_.argumentsPrefix=L,_.encodeCommand=M,_.escapeArgument=e=>`'${String(e).replaceAll(/['‘’‚‛]/g,e=>e+e)}'`,_.createArguments=H;let $=d(c);async function W(){if("darwin"!==i.platform)throw Error("macOS only");let{stdout:e}=await $("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),r=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e),o=r?.groups.id??"com.apple.Safari";return"com.apple.safari"===o?"com.apple.Safari":o}let N=d(c);async function k(e,{humanReadableOutput:r=!0,signal:o}={}){if("darwin"!==i.platform)throw Error("macOS only");let t={};o&&(t.signal=o);let{stdout:a}=await N("osascript",["-e",e,r?[]:["-ss"]],t);return a.trim()}async function R(e){return k(`tell application "Finder" to set app_path to application file id "${e}" as string
|
|
2
|
+
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}let U=d(c),z={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},j=new Map(Object.entries(z));class D extends Error{}async function Y(e=U){let r=`${i.env.SYSTEMROOT??i.env.windir??"C:\\Windows"}\\System32\\reg.exe`,{stdout:o}=await e(r,["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),t=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(o);if(!t)throw new D(`Cannot find Windows browser in stdout: ${JSON.stringify(o)}`);let{id:a}=t.groups,n=a.lastIndexOf("."),s=a.lastIndexOf("-"),l=-1===n?void 0:a.slice(0,n),c=-1===s?void 0:a.slice(0,s);return z[a]??z[l]??z[c]??{name:a,id:a}}let G=d(c);async function K(){if("darwin"===i.platform){let e=await W();return{name:await R(e),id:e}}if("linux"===i.platform){let{stdout:e}=await G("xdg-mime",["query","default","x-scheme-handler/http"]),r=e.trim();return{name:r.replace(/.desktop$/,"").replace("-"," ").toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase()),id:r}}if("win32"===i.platform)return Y();throw Error("Only macOS, Linux, and Windows are supported")}let V=!!(i.env.SSH_CONNECTION||i.env.SSH_CLIENT||i.env.SSH_TTY),q=Symbol("fallbackAttempt"),X=import.meta.url?n.dirname(s(import.meta.url)):"",J=n.join(X,"xdg-open"),{platform:Q,arch:Z}=i,ee=async(e,r)=>{if(0===e.length)return;let o=[];for(let t of e)try{return await r(t)}catch(e){o.push(e)}throw AggregateError(o,"Failed to open in all supported apps")},er=async e=>{let r,o=!0===(e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e})[q];if(delete e[q],Array.isArray(e.app))return ee(e.app,r=>er({...e,app:r,[q]:!0}));let{name:t,arguments:a=[]}=e.app??{};if(a=[...a],Array.isArray(t))return ee(t,r=>er({...e,app:{name:r,arguments:a},[q]:!0}));if("browser"===t||"browserPrivate"===t){let r,o={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge","com.apple.safari":"safari"};if(v){let e=await B();r=j.get(e)??{}}else r=await K();let i=r.id?.toLowerCase();if(Object.hasOwn(o,i)){let r=o[i];if("browserPrivate"===t){if("safari"===r)throw Error("Safari doesn't support opening in private mode via command line");a.push({chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"}[r])}return er({...e,app:{name:ea[r],arguments:a}})}throw Error(`${r.name} is not supported as a default browser`)}let s=[],c={},d=!1;if(!v||g()||V||t||(d=await A()),"darwin"===Q)r="open",e.wait&&s.push("--wait-apps"),e.background&&s.push("--background"),e.newInstance&&s.push("--new"),t&&s.push("-a",t);else if("win32"===Q||d){r=await C(),s.push(..._.argumentsPrefix),v||(c.windowsVerbatimArguments=!0),v&&e.target&&(e.target=await O(e.target));let o=["$ProgressPreference = 'SilentlyContinue';","Start"];e.wait&&o.push("-Wait"),t?(o.push(_.escapeArgument(t)),e.target&&a.push(e.target)):e.target&&o.push(_.escapeArgument(e.target)),a.length>0&&o.push("-ArgumentList",(a=a.map(e=>_.escapeArgument(e))).join(",")),e.target=_.encodeCommand(o.join(" ")),e.wait||(c.stdio="ignore"),v&&(c.cwd=n.dirname(r))}else{if(t)r=t;else{let e=!1;try{await m.access(J,p.X_OK),e=!0}catch{}r=i.versions.electron??("android"===Q||!X||"/"===X||!e)?"xdg-open":J}a.length>0&&s.push(...a),e.wait||(c.stdio="ignore",c.detached=!0)}"darwin"===Q&&a.length>0&&s.push("--args",...a),e.target&&s.push(e.target);let f=l.spawn(r,s,c);return e.wait?new Promise((r,o)=>{f.once("error",o),f.once("close",t=>{e.allowNonzeroExitCode||0===t?r(f):o(Error(`Exited with code ${t}`))})}):o||"win32"===Q||d?new Promise((e,r)=>{f.once("error",r),f.once("spawn",()=>{f.once("close",t=>{(f.off("error",r),o&&0!==t)?r(Error(`Exited with code ${t}`)):(f.unref(),e(f))})})}):(f.unref(),new Promise((e,r)=>{f.once("error",r),f.once("spawn",()=>{f.off("error",r),e(f)})}))};function eo(e){if("string"==typeof e||Array.isArray(e))return e;let{[Z]:r}=e;if(!r)throw Error(`${Z} is not supported`);return r}function et({[Q]:e},{wsl:r}={}){if(r&&v)return eo(r);if(!e)throw Error(`${Q} is not supported`);return eo(e)}let ea={browser:"browser",browserPrivate:"browserPrivate"};I(ea,"chrome",()=>et({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium","chromium-browser"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}})),I(ea,"brave",()=>et({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}})),I(ea,"firefox",()=>et({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"})),I(ea,"edge",()=>et({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"})),I(ea,"safari",()=>et({darwin:"Safari"}));export default((e,r)=>{if("string"!=typeof e)throw TypeError("Expected a `target`");return er({...r,target:e})});export{ea as apps};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Logger } from './logger.js';
|
|
2
|
+
import type { InternalContext, PluginManager, PluginMeta } from './types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Determines whether the plugin is registered in the specified environment.
|
|
5
|
+
* If the pluginEnvironment is undefined, it means it can match any environment.
|
|
6
|
+
*/ export declare const isEnvironmentMatch: (pluginEnvironment?: string, specifiedEnvironment?: string) => boolean;
|
|
7
|
+
export declare function createPluginManager(logger: Logger): PluginManager;
|
|
8
|
+
/**
|
|
9
|
+
* Sorts plugins by their `enforce` property.
|
|
10
|
+
*/ export declare const sortPluginsByEnforce: (plugins: PluginMeta[]) => PluginMeta[];
|
|
11
|
+
/**
|
|
12
|
+
* Performs topological sorting on plugins based on their dependencies.
|
|
13
|
+
* Uses the `pre` and `post` properties of plugins to determine the correct
|
|
14
|
+
* execution order.
|
|
15
|
+
*/ export declare const sortPluginsByDependencies: (plugins: PluginMeta[]) => PluginMeta[];
|
|
16
|
+
export declare function initPlugins({ context, pluginManager }: {
|
|
17
|
+
context: InternalContext;
|
|
18
|
+
pluginManager: PluginManager;
|
|
19
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CSSLoaderOptions, NormalizedEnvironmentConfig, RsbuildPlugin, Rspack } from '../types/index.js';
|
|
2
|
+
export declare function getLightningCSSLoaderOptions(config: NormalizedEnvironmentConfig, targets: string[], minify: boolean): Promise<Rspack.LightningcssLoaderOptions>;
|
|
3
|
+
// If the target is not `web` and the modules option of css-loader is enabled,
|
|
4
|
+
// we must enable exportOnlyLocals to only exports the modules identifier mappings.
|
|
5
|
+
// Otherwise, the compiled CSS code may contain invalid code, such as `new URL`.
|
|
6
|
+
// https://github.com/webpack/css-loader#exportonlylocals
|
|
7
|
+
export declare const normalizeCssLoaderOptions: (options: CSSLoaderOptions, exportOnlyLocals: boolean) => CSSLoaderOptions;
|
|
8
|
+
export declare const pluginCss: () => RsbuildPlugin;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Externals } from '@rspack/core';
|
|
2
|
+
import { type PackageJson } from '../helpers/packageJson.js';
|
|
3
|
+
import type { AutoExternal, RsbuildPlugin } from '../types/index.js';
|
|
4
|
+
export declare const composeAutoExternalRules: (options: {
|
|
5
|
+
autoExternal?: AutoExternal;
|
|
6
|
+
pkgJson?: PackageJson;
|
|
7
|
+
userExternals?: Externals;
|
|
8
|
+
}) => RegExp[] | undefined;
|
|
9
|
+
export declare function pluginExternals(): RsbuildPlugin;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* modified from https://github.com/facebook/create-react-app
|
|
3
|
+
* license at https://github.com/facebook/create-react-app/blob/master/LICENSE
|
|
4
|
+
*/ import type { InternalContext, PrintFileSizeAsset, RsbuildPlugin } from '../types/index.js';
|
|
5
|
+
/** Normalize file path by removing hash for comparison across builds */ export declare function normalizeFilePath(filePath: string): string;
|
|
6
|
+
/** Exclude source map, license, and type declaration files by default */ export declare const excludeAsset: (asset: PrintFileSizeAsset) => boolean;
|
|
7
|
+
export declare const pluginFileSize: (context: InternalContext) => RsbuildPlugin;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { InternalContext, NormalizedEnvironmentConfig, RsbuildPlugin } from '../types/index.js';
|
|
2
|
+
export declare function getTemplate(entryName: string, config: NormalizedEnvironmentConfig, rootPath: string): Promise<{
|
|
3
|
+
templatePath: string;
|
|
4
|
+
templateContent?: string;
|
|
5
|
+
} | {
|
|
6
|
+
templatePath: undefined;
|
|
7
|
+
templateContent: string;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const pluginHtml: (context: InternalContext) => RsbuildPlugin;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { InlineChunkTest, NormalizedEnvironmentConfig, RsbuildPlugin } from '../types/index.js';
|
|
2
|
+
export declare function getInlineTests(config: NormalizedEnvironmentConfig): {
|
|
3
|
+
scriptTests: InlineChunkTest[];
|
|
4
|
+
styleTests: InlineChunkTest[];
|
|
5
|
+
};
|
|
6
|
+
export declare const pluginInlineChunk: () => RsbuildPlugin;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { LightningCssMinimizerRspackPluginOptions, SwcJsMinimizerRspackPluginOptions } from '@rspack/core';
|
|
2
|
+
import type { NormalizedEnvironmentConfig, OneOrMany, RsbuildPlugin } from '../types/index.js';
|
|
3
|
+
export declare function getSwcMinimizerOptions(config: NormalizedEnvironmentConfig, jsOptions?: SwcJsMinimizerRspackPluginOptions): SwcJsMinimizerRspackPluginOptions;
|
|
4
|
+
export declare function parseMinifyOptions(config: NormalizedEnvironmentConfig): {
|
|
5
|
+
minifyJs: boolean;
|
|
6
|
+
minifyCss: boolean;
|
|
7
|
+
jsOptions?: OneOrMany<SwcJsMinimizerRspackPluginOptions>;
|
|
8
|
+
cssOptions?: OneOrMany<LightningCssMinimizerRspackPluginOptions>;
|
|
9
|
+
};
|
|
10
|
+
export declare const pluginMinimize: () => RsbuildPlugin;
|
package/dist/r.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
let cachedImport = (importer)=>{
|
|
2
|
+
let promise;
|
|
3
|
+
return ()=>promise ??= importer().catch((error)=>{
|
|
4
|
+
throw promise = void 0, error;
|
|
5
|
+
});
|
|
6
|
+
}, getTinyglobby = cachedImport(()=>import("./tinyglobby.js").then((m)=>m.dist_namespaceObject));
|
|
7
|
+
export { cachedImport, getTinyglobby };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*! LICENSE: range-parser.js.LICENSE.txt */
|
|
2
|
+
import { rspackRequire, moduleFactories } from "./rslib-runtime.js";
|
|
3
|
+
moduleFactories.add({
|
|
4
|
+
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/range-parser/1.3.0/d49e5dcb9d0e39475844e240fad8cd1db6a58f4144f7ede43d9755e2fce5babc/node_modules/range-parser/index.js" (module) {
|
|
5
|
+
function parsePos(str) {
|
|
6
|
+
return /^\d+$/.test(str) ? Number(str) : 0 / 0;
|
|
7
|
+
}
|
|
8
|
+
function combineRanges(ranges) {
|
|
9
|
+
for(var ordered = ranges.map(mapWithIndex).sort(sortByRangeStart), j = 0, i = 1; i < ordered.length; i++){
|
|
10
|
+
var range = ordered[i], current = ordered[j];
|
|
11
|
+
range.start > current.end + 1 ? ordered[++j] = range : range.end > current.end && (current.end = range.end, current.index = Math.min(current.index, range.index));
|
|
12
|
+
}
|
|
13
|
+
ordered.length = j + 1;
|
|
14
|
+
var combined = ordered.sort(sortByRangeIndex).map(mapWithoutIndex);
|
|
15
|
+
return combined.type = ranges.type, combined;
|
|
16
|
+
}
|
|
17
|
+
function mapWithIndex(range, index) {
|
|
18
|
+
return {
|
|
19
|
+
start: range.start,
|
|
20
|
+
end: range.end,
|
|
21
|
+
index: index
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function mapWithoutIndex(range) {
|
|
25
|
+
return {
|
|
26
|
+
start: range.start,
|
|
27
|
+
end: range.end
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function sortByRangeIndex(a, b) {
|
|
31
|
+
return a.index - b.index;
|
|
32
|
+
}
|
|
33
|
+
function sortByRangeStart(a, b) {
|
|
34
|
+
return a.start - b.start;
|
|
35
|
+
}
|
|
36
|
+
module.exports = function rangeParser(size, str, options) {
|
|
37
|
+
if ('string' != typeof str) throw TypeError('argument str must be a string');
|
|
38
|
+
var index = str.indexOf('=');
|
|
39
|
+
if (-1 === index) return -2;
|
|
40
|
+
var arr = str.slice(index + 1).split(','), ranges = [];
|
|
41
|
+
ranges.type = str.slice(0, index);
|
|
42
|
+
for(var i = 0; i < arr.length; i++){
|
|
43
|
+
var indexOf = arr[i].indexOf('-');
|
|
44
|
+
if (-1 === indexOf) return -2;
|
|
45
|
+
var startStr = arr[i].slice(0, indexOf).trim(), endStr = arr[i].slice(indexOf + 1).trim(), start = parsePos(startStr), end = parsePos(endStr);
|
|
46
|
+
if (0 === startStr.length ? (start = size - end, end = size - 1) : 0 === endStr.length && (end = size - 1), end > size - 1 && (end = size - 1), isNaN(start) || isNaN(end)) return -2;
|
|
47
|
+
start > end || start < 0 || ranges.push({
|
|
48
|
+
start: start,
|
|
49
|
+
end: end
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return ranges.length < 1 ? -1 : options && options.combine ? combineRanges(ranges) : ranges;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}), rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/range-parser/1.3.0/d49e5dcb9d0e39475844e240fad8cd1db6a58f4144f7ede43d9755e2fce5babc/node_modules/range-parser/index.js");
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { definePropertyGetters, makeNamespaceObject } from "./rslib-runtime.js";
|
|
2
|
+
import { decodedMappings as trace_mapping_decodedMappings, encode, traceSegment, TraceMap as trace_mapping_TraceMap } from "./trace-mapping.js";
|
|
3
|
+
var remapping_namespaceObject = {};
|
|
4
|
+
makeNamespaceObject(remapping_namespaceObject), definePropertyGetters(remapping_namespaceObject, {
|
|
5
|
+
default: ()=>remapping
|
|
6
|
+
});
|
|
7
|
+
var SetArray = class {
|
|
8
|
+
constructor(){
|
|
9
|
+
this._indexes = {
|
|
10
|
+
__proto__: null
|
|
11
|
+
}, this.array = [];
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
function put(setarr, key) {
|
|
15
|
+
var setarr1, key1;
|
|
16
|
+
let index = (setarr1 = setarr, key1 = key, setarr1._indexes[key1]);
|
|
17
|
+
if (void 0 !== index) return index;
|
|
18
|
+
let { array, _indexes: indexes } = setarr, length = array.push(key);
|
|
19
|
+
return indexes[key] = length - 1;
|
|
20
|
+
}
|
|
21
|
+
function remove(setarr, key) {
|
|
22
|
+
var setarr1, key1;
|
|
23
|
+
let index = (setarr1 = setarr, key1 = key, setarr1._indexes[key1]);
|
|
24
|
+
if (void 0 === index) return;
|
|
25
|
+
let { array, _indexes: indexes } = setarr;
|
|
26
|
+
for(let i = index + 1; i < array.length; i++){
|
|
27
|
+
let k = array[i];
|
|
28
|
+
array[i - 1] = k, indexes[k]--;
|
|
29
|
+
}
|
|
30
|
+
indexes[key] = void 0, array.pop();
|
|
31
|
+
}
|
|
32
|
+
var GenMapping = class {
|
|
33
|
+
constructor({ file, sourceRoot } = {}){
|
|
34
|
+
this._names = new SetArray(), this._sources = new SetArray(), this._sourcesContent = [], this._mappings = [], this.file = file, this.sourceRoot = sourceRoot, this._ignoreList = new SetArray();
|
|
35
|
+
}
|
|
36
|
+
}, maybeAddSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content)=>addSegmentInternal(!0, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content);
|
|
37
|
+
function setSourceContent(map, source, content) {
|
|
38
|
+
let { _sources: sources, _sourcesContent: sourcesContent } = map;
|
|
39
|
+
sourcesContent[put(sources, source)] = content;
|
|
40
|
+
}
|
|
41
|
+
function setIgnore(map, source, ignore = !0) {
|
|
42
|
+
let { _sources: sources, _sourcesContent: sourcesContent, _ignoreList: ignoreList } = map, index = put(sources, source);
|
|
43
|
+
index === sourcesContent.length && (sourcesContent[index] = null), ignore ? put(ignoreList, index) : remove(ignoreList, index);
|
|
44
|
+
}
|
|
45
|
+
function toDecodedMap(map) {
|
|
46
|
+
let { _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names, _ignoreList: ignoreList } = map;
|
|
47
|
+
return removeEmptyFinalLines(mappings), {
|
|
48
|
+
version: 3,
|
|
49
|
+
file: map.file || void 0,
|
|
50
|
+
names: names.array,
|
|
51
|
+
sourceRoot: map.sourceRoot || void 0,
|
|
52
|
+
sources: sources.array,
|
|
53
|
+
sourcesContent,
|
|
54
|
+
mappings,
|
|
55
|
+
ignoreList: ignoreList.array
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function toEncodedMap(map) {
|
|
59
|
+
let decoded = toDecodedMap(map);
|
|
60
|
+
return Object.assign({}, decoded, {
|
|
61
|
+
mappings: encode(decoded.mappings)
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function addSegmentInternal(skipable, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) {
|
|
65
|
+
let { _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names } = map, line = getIndex(mappings, genLine), index = getColumnIndex(line, genColumn);
|
|
66
|
+
if (!source) {
|
|
67
|
+
if (skipable && skipSourceless(line, index)) return;
|
|
68
|
+
return insert(line, index, [
|
|
69
|
+
genColumn
|
|
70
|
+
]);
|
|
71
|
+
}
|
|
72
|
+
let sourcesIndex = put(sources, source), namesIndex = name ? put(names, name) : -1;
|
|
73
|
+
if (sourcesIndex === sourcesContent.length && (sourcesContent[sourcesIndex] = null != content ? content : null), !(skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex))) return insert(line, index, name ? [
|
|
74
|
+
genColumn,
|
|
75
|
+
sourcesIndex,
|
|
76
|
+
sourceLine,
|
|
77
|
+
sourceColumn,
|
|
78
|
+
namesIndex
|
|
79
|
+
] : [
|
|
80
|
+
genColumn,
|
|
81
|
+
sourcesIndex,
|
|
82
|
+
sourceLine,
|
|
83
|
+
sourceColumn
|
|
84
|
+
]);
|
|
85
|
+
}
|
|
86
|
+
function getIndex(arr, index) {
|
|
87
|
+
for(let i = arr.length; i <= index; i++)arr[i] = [];
|
|
88
|
+
return arr[index];
|
|
89
|
+
}
|
|
90
|
+
function getColumnIndex(line, genColumn) {
|
|
91
|
+
let index = line.length;
|
|
92
|
+
for(let i = index - 1; i >= 0 && !(genColumn >= line[i][0]); index = i--);
|
|
93
|
+
return index;
|
|
94
|
+
}
|
|
95
|
+
function insert(array, index, value) {
|
|
96
|
+
for(let i = array.length; i > index; i--)array[i] = array[i - 1];
|
|
97
|
+
array[index] = value;
|
|
98
|
+
}
|
|
99
|
+
function removeEmptyFinalLines(mappings) {
|
|
100
|
+
let { length } = mappings, len = length;
|
|
101
|
+
for(let i = len - 1; i >= 0 && !(mappings[i].length > 0); len = i, i--);
|
|
102
|
+
len < length && (mappings.length = len);
|
|
103
|
+
}
|
|
104
|
+
function skipSourceless(line, index) {
|
|
105
|
+
return 0 === index || 1 === line[index - 1].length;
|
|
106
|
+
}
|
|
107
|
+
function skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex) {
|
|
108
|
+
if (0 === index) return !1;
|
|
109
|
+
let prev = line[index - 1];
|
|
110
|
+
return 1 !== prev.length && sourcesIndex === prev[1] && sourceLine === prev[2] && sourceColumn === prev[3] && namesIndex === (5 === prev.length ? prev[4] : -1);
|
|
111
|
+
}
|
|
112
|
+
var SOURCELESS_MAPPING = SegmentObject("", -1, -1, "", null, !1), EMPTY_SOURCES = [];
|
|
113
|
+
function SegmentObject(source, line, column, name, content, ignore) {
|
|
114
|
+
return {
|
|
115
|
+
source,
|
|
116
|
+
line,
|
|
117
|
+
column,
|
|
118
|
+
name,
|
|
119
|
+
content,
|
|
120
|
+
ignore
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function Source(map, sources, source, content, ignore) {
|
|
124
|
+
return {
|
|
125
|
+
map,
|
|
126
|
+
sources,
|
|
127
|
+
source,
|
|
128
|
+
content,
|
|
129
|
+
ignore
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
function MapSource(map, sources) {
|
|
133
|
+
return Source(map, sources, "", null, !1);
|
|
134
|
+
}
|
|
135
|
+
function OriginalSource(source, content, ignore) {
|
|
136
|
+
return Source(null, EMPTY_SOURCES, source, content, ignore);
|
|
137
|
+
}
|
|
138
|
+
function traceMappings(tree) {
|
|
139
|
+
let gen = new GenMapping({
|
|
140
|
+
file: tree.map.file
|
|
141
|
+
}), { sources: rootSources, map } = tree, rootNames = map.names, rootMappings = trace_mapping_decodedMappings(map);
|
|
142
|
+
for(let i = 0; i < rootMappings.length; i++){
|
|
143
|
+
let segments = rootMappings[i];
|
|
144
|
+
for(let j = 0; j < segments.length; j++){
|
|
145
|
+
let segment = segments[j], genCol = segment[0], traced = SOURCELESS_MAPPING;
|
|
146
|
+
if (1 !== segment.length && null == (traced = originalPositionFor(rootSources[segment[1]], segment[2], segment[3], 5 === segment.length ? rootNames[segment[4]] : ""))) continue;
|
|
147
|
+
let { column, line, name, content, source, ignore } = traced;
|
|
148
|
+
maybeAddSegment(gen, i, genCol, source, line, column, name), source && null != content && setSourceContent(gen, source, content), ignore && setIgnore(gen, source, !0);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return gen;
|
|
152
|
+
}
|
|
153
|
+
function originalPositionFor(source, line, column, name) {
|
|
154
|
+
if (!source.map) return SegmentObject(source.source, line, column, name, source.content, source.ignore);
|
|
155
|
+
let segment = traceSegment(source.map, line, column);
|
|
156
|
+
return null == segment ? null : 1 === segment.length ? SOURCELESS_MAPPING : originalPositionFor(source.sources[segment[1]], segment[2], segment[3], 5 === segment.length ? source.map.names[segment[4]] : name);
|
|
157
|
+
}
|
|
158
|
+
function asArray(value) {
|
|
159
|
+
return Array.isArray(value) ? value : [
|
|
160
|
+
value
|
|
161
|
+
];
|
|
162
|
+
}
|
|
163
|
+
function buildSourceMapTree(input, loader) {
|
|
164
|
+
let maps = asArray(input).map((m)=>new trace_mapping_TraceMap(m, "")), map = maps.pop();
|
|
165
|
+
for(let i = 0; i < maps.length; i++)if (maps[i].sources.length > 1) throw Error(`Transformation map ${i} must have exactly one source file.
|
|
166
|
+
Did you specify these with the most recent transformation maps first?`);
|
|
167
|
+
let tree = build(map, loader, "", 0);
|
|
168
|
+
for(let i = maps.length - 1; i >= 0; i--)tree = MapSource(maps[i], [
|
|
169
|
+
tree
|
|
170
|
+
]);
|
|
171
|
+
return tree;
|
|
172
|
+
}
|
|
173
|
+
function build(map, loader, importer, importerDepth) {
|
|
174
|
+
let { resolvedSources, sourcesContent, ignoreList } = map, depth = importerDepth + 1;
|
|
175
|
+
return MapSource(map, resolvedSources.map((sourceFile, i)=>{
|
|
176
|
+
let ctx = {
|
|
177
|
+
importer,
|
|
178
|
+
depth,
|
|
179
|
+
source: sourceFile || "",
|
|
180
|
+
content: void 0,
|
|
181
|
+
ignore: void 0
|
|
182
|
+
}, sourceMap = loader(ctx.source, ctx), { source, content, ignore } = ctx;
|
|
183
|
+
return sourceMap ? build(new trace_mapping_TraceMap(sourceMap, source), loader, source, depth) : OriginalSource(source, void 0 !== content ? content : sourcesContent ? sourcesContent[i] : null, void 0 !== ignore ? ignore : !!ignoreList && ignoreList.includes(i));
|
|
184
|
+
}));
|
|
185
|
+
}
|
|
186
|
+
var SourceMap = class {
|
|
187
|
+
constructor(map, options){
|
|
188
|
+
let out = options.decodedMappings ? toDecodedMap(map) : toEncodedMap(map);
|
|
189
|
+
this.version = out.version, this.file = out.file, this.mappings = out.mappings, this.names = out.names, this.ignoreList = out.ignoreList, this.sourceRoot = out.sourceRoot, this.sources = out.sources, options.excludeContent || (this.sourcesContent = out.sourcesContent);
|
|
190
|
+
}
|
|
191
|
+
toString() {
|
|
192
|
+
return JSON.stringify(this);
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
function remapping(input, loader, options) {
|
|
196
|
+
return new SourceMap(traceMappings(buildSourceMapTree(input, loader)), "object" == typeof options ? options : {
|
|
197
|
+
excludeContent: !!options,
|
|
198
|
+
decodedMappings: !1
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
export { remapping_namespaceObject };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { RestartManager } from './helpers/restartManager.js';
|
|
2
|
+
import type { Logger } from './logger.js';
|
|
3
|
+
import { type WatchFilesResult } from './server/watchFiles.js';
|
|
4
|
+
import type { InternalContext, RestartContext, WatchFiles } from './types/index.js';
|
|
5
|
+
export declare const requestRestart: ({ clear, logger, restartContext, restartManager }: {
|
|
6
|
+
clear?: boolean;
|
|
7
|
+
logger: Logger;
|
|
8
|
+
restartContext: RestartContext;
|
|
9
|
+
restartManager: RestartManager;
|
|
10
|
+
}) => Promise<boolean>;
|
|
11
|
+
export declare function watchFilesForRestart({ watchFiles, context, restartContext }: {
|
|
12
|
+
watchFiles: WatchFiles[];
|
|
13
|
+
context: InternalContext;
|
|
14
|
+
restartContext: RestartContext;
|
|
15
|
+
}): WatchFilesResult | undefined;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var leafPrototypes, modules = {}, moduleCache = {};
|
|
2
|
+
function rspackRequire(moduleId) {
|
|
3
|
+
var cachedModule = moduleCache[moduleId];
|
|
4
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
5
|
+
var module = moduleCache[moduleId] = {
|
|
6
|
+
exports: {}
|
|
7
|
+
};
|
|
8
|
+
return modules[moduleId](module, module.exports, rspackRequire), module.exports;
|
|
9
|
+
}
|
|
10
|
+
var moduleFactories = modules, compatGetDefaultExport = (module)=>{
|
|
11
|
+
var getter = module && module.__esModule ? ()=>module.default : ()=>module;
|
|
12
|
+
return definePropertyGetters(getter, {
|
|
13
|
+
a: getter
|
|
14
|
+
}), getter;
|
|
15
|
+
}, getProto = Object.getPrototypeOf ? (obj)=>Object.getPrototypeOf(obj) : (obj)=>obj.__proto__, createFakeNamespaceObject = function(value, mode) {
|
|
16
|
+
if (1 & mode && (value = ("function" == typeof this ? this : this.r)(value)), 8 & mode || 'object' == typeof value && value && (4 & mode && value.__esModule || 16 & mode && 'function' == typeof value.then)) return value;
|
|
17
|
+
var ns = Object.create(null);
|
|
18
|
+
makeNamespaceObject(ns);
|
|
19
|
+
var def = {};
|
|
20
|
+
leafPrototypes = leafPrototypes || [
|
|
21
|
+
null,
|
|
22
|
+
getProto({}),
|
|
23
|
+
getProto([]),
|
|
24
|
+
getProto(getProto)
|
|
25
|
+
];
|
|
26
|
+
for(var current = 2 & mode && value; ('object' == typeof current || 'function' == typeof current) && !~leafPrototypes.indexOf(current); current = getProto(current))Object.getOwnPropertyNames(current).forEach((key)=>{
|
|
27
|
+
def[key] = ()=>value[key];
|
|
28
|
+
});
|
|
29
|
+
return def.default = ()=>value, definePropertyGetters(ns, def), ns;
|
|
30
|
+
}, definePropertyGetters = (exports, getters, values)=>{
|
|
31
|
+
var define = (defs, kind)=>{
|
|
32
|
+
for(var key in defs)hasOwnProperty(defs, key) && !hasOwnProperty(exports, key) && Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: !0,
|
|
34
|
+
[kind]: defs[key]
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
define(getters, "get"), define(values, "value");
|
|
38
|
+
};
|
|
39
|
+
moduleFactories.add = function registerModules(modules) {
|
|
40
|
+
Object.assign(moduleFactories, modules);
|
|
41
|
+
};
|
|
42
|
+
var hasOwnProperty = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), makeNamespaceObject = (exports)=>{
|
|
43
|
+
"u" > typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports, Symbol.toStringTag, {
|
|
44
|
+
value: 'Module'
|
|
45
|
+
}), Object.defineProperty(exports, '__esModule', {
|
|
46
|
+
value: !0
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
export { rspackRequire, moduleFactories, compatGetDefaultExport, createFakeNamespaceObject, definePropertyGetters, makeNamespaceObject };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type Compiler } from '@rspack/core';
|
|
2
|
+
import type { EnvironmentContext, HtmlRspackPlugin, HtmlTag, HtmlTagDescriptor, InternalContext } from '../types/index.js';
|
|
3
|
+
type HtmlTagObject = HtmlRspackPlugin.HtmlTagObject;
|
|
4
|
+
export type TagConfig = {
|
|
5
|
+
tags?: HtmlTagDescriptor[];
|
|
6
|
+
hash?: HtmlTag['hash'];
|
|
7
|
+
append?: HtmlTag['append'];
|
|
8
|
+
publicPath?: HtmlTag['publicPath'];
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* A unique identifier for providing extra data to RsbuildHtmlPlugin
|
|
12
|
+
*/ export declare const entryNameSymbol: unique symbol;
|
|
13
|
+
export type HtmlExtraData = {
|
|
14
|
+
entryName: string;
|
|
15
|
+
context: InternalContext;
|
|
16
|
+
environment: EnvironmentContext;
|
|
17
|
+
favicon?: string;
|
|
18
|
+
faviconDistPath: string;
|
|
19
|
+
tagConfig?: TagConfig;
|
|
20
|
+
templateContent?: string;
|
|
21
|
+
};
|
|
22
|
+
export type AlterAssetTagGroupsData = {
|
|
23
|
+
headTags: HtmlTagObject[];
|
|
24
|
+
bodyTags: HtmlTagObject[];
|
|
25
|
+
outputName: string;
|
|
26
|
+
publicPath: string;
|
|
27
|
+
plugin: HtmlRspackPlugin;
|
|
28
|
+
};
|
|
29
|
+
export declare const hasTitle: (html?: string) => boolean;
|
|
30
|
+
export declare class RsbuildHtmlPlugin {
|
|
31
|
+
readonly name: string;
|
|
32
|
+
readonly getExtraData: (entryName: string) => HtmlExtraData | undefined;
|
|
33
|
+
readonly getHTMLPlugin: () => typeof HtmlRspackPlugin;
|
|
34
|
+
constructor(getExtraData: (entryName: string) => HtmlExtraData | undefined, getHTMLPlugin: () => typeof HtmlRspackPlugin);
|
|
35
|
+
apply(compiler: Compiler): void;
|
|
36
|
+
}
|
|
37
|
+
export { };
|