@extenso/parcel-core 0.1.11 → 0.1.12
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/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var le=Object.create;var v=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var he=Object.getOwnPropertyNames;var de=Object.getPrototypeOf,ce=Object.prototype.hasOwnProperty;var pe=(e,t)=>{for(var r in t)v(e,r,{get:t[r],enumerable:!0})},N=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of he(t))!ce.call(e,s)&&s!==r&&v(e,s,{get:()=>t[s],enumerable:!(i=ue(t,s))||i.enumerable});return e};var l=(e,t,r)=>(r=e!=null?le(de(e)):{},N(t||!e||!e.__esModule?v(r,"default",{value:e,enumerable:!0}):r,e)),fe=e=>N(v({},"__esModule",{value:!0}),e);var ve={};pe(ve,{INTERNAL_RESOLVE:()=>be,INTERNAL_TRANSFORM:()=>ye,Parcel:()=>T});module.exports=fe(ve);var k=l(require("assert")),G=require("@parcel/core"),z=l(require("@parcel/core/lib/dumpGraphToGraphViz")),H=l(require("@parcel/core/lib/ParcelConfig")),V=require("@parcel/core/lib/projectPath"),U=require("@parcel/core/lib/public/Asset"),$=require("@parcel/core/lib/public/Bundle"),K=l(require("@parcel/core/lib/public/BundleGraph")),O=l(require("@parcel/core/lib/ReporterRunner")),Q=l(require("@parcel/core/lib/requests/ParcelBuildRequest")),J=require("@parcel/core/lib/requests/ParcelConfigRequest"),X=l(require("@parcel/core/lib/requests/ValidationRequest")),m=l(require("@parcel/core/lib/RequestTracker")),Y=require("@parcel/core/lib/registerCoreWithSerializer"),I=require("@parcel/core/lib/utils"),C=l(require("@parcel/diagnostic")),D=require("@parcel/events"),Z=require("@parcel/hash"),B=l(require("@parcel/logger")),ee=require("@parcel/source-map"),te=require("@parcel/utils"),Re=require("@parcel/watcher"),re=require("abortcontroller-polyfill/dist/cjs-ponyfill"),F=l(require("nullthrows"));var a=l(require("path")),R=require("@parcel/cache"),P=require("@parcel/core/lib/projectPath"),x=require("@parcel/core/lib/requests/ParcelConfigRequest"),S=require("@parcel/fs"),M=require("@parcel/hash"),W=require("@parcel/package-manager"),c=require("@parcel/utils"),me=["yarn.lock","package-lock.json","pnpm-lock.yaml"];function ge(e){return(0,M.hashString)(`${e.join(",")}-${Date.now()}-${Math.round(Math.random()*100)}`)}async function j(e){let t=e.inputFS||new S.NodeFS,r=e.outputFS||new S.NodeFS,i=t.cwd(),s=r.cwd(),o;e.entries==null||e.entries===""?o=[]:Array.isArray(e.entries)?o=e.entries.map(f=>a.default.resolve(i,f)):o=[a.default.resolve(i,e.entries)];let h=!1;if(o.length===1&&!(0,c.isGlob)(o[0])){let[f]=o;try{h=(await t.stat(f)).isDirectory()}catch{}}let p=(0,c.getRootDir)(h?[a.default.join(o[0],"index")]:o),w=await(0,c.resolveConfig)(t,a.default.join(p,"index"),[...me],a.default.parse(p).root)||a.default.join(i,"index"),n=a.default.dirname(w),d=e.packageManager||new W.NodePackageManager(t,n),u=a.default.resolve(s,e.cacheDir),y=e.watchDir!=null?a.default.resolve(e.watchDir):n,g=e.cache??(r instanceof S.NodeFS?new R.LMDBCache(u):new R.FSCache(r,u)),b=e.mode??"development",se=e?.defaultTargetOptions?.shouldOptimize??b==="production",ie=e?.defaultTargetOptions?.publicUrl??"/",E=e?.defaultTargetOptions?.distDir!=null?a.default.resolve(i,e?.defaultTargetOptions?.distDir):void 0,_=e.shouldBuildLazily??!1,q=e.shouldContentHash??e.mode==="production";if(_&&q)throw new Error("Lazy bundling does not work with content hashing");let oe=e.env,ae=we(e.serveOptions,process.env.PORT);return{config:L(t,n,e.config),defaultConfig:L(t,n,e.defaultConfig),shouldPatchConsole:e.shouldPatchConsole??!1,env:oe,mode:b,shouldAutoInstall:e.shouldAutoInstall??!1,hmrOptions:e.hmrOptions??null,shouldBuildLazily:_,shouldBundleIncrementally:e.shouldBundleIncrementally??!0,shouldContentHash:q,serveOptions:e.serveOptions?{...e.serveOptions,distDir:E??a.default.join(s,"dist"),port:ae}:!1,shouldDisableCache:e.shouldDisableCache??!1,shouldProfile:e.shouldProfile??!1,cacheDir:u,watchDir:y,watchBackend:e.watchBackend,watchIgnore:e.watchIgnore,entries:o.map(f=>(0,P.toProjectPath)(n,f)),targets:e.targets,logLevel:e.logLevel??"info",projectRoot:n,inputFS:t,outputFS:r,cache:g,packageManager:d,additionalReporters:e.additionalReporters?.map(({packageName:f,resolveFrom:ne})=>({packageName:f,resolveFrom:(0,P.toProjectPath)(n,ne)}))??[],instanceId:ge(o),detailedReport:e.detailedReport,defaultTargetOptions:{shouldOptimize:se,shouldScopeHoist:e?.defaultTargetOptions?.shouldScopeHoist,sourceMaps:e?.defaultTargetOptions?.sourceMaps??!0,publicUrl:ie,...E!=null?{distDir:(0,P.toProjectPath)(n,E)}:{},engines:e?.defaultTargetOptions?.engines,outputFormat:e?.defaultTargetOptions?.outputFormat,isLibrary:e?.defaultTargetOptions?.isLibrary}}}function L(e,t,r){if(r!=null)if(a.default.isAbsolute(r)){let i=(0,x.getResolveFrom)(e,t),s=(0,c.relativePath)(a.default.dirname(i),r);return s.startsWith("..")?r:s}else return r}function we(e,t,r=1234){function i(s){let o=Number(s);if(Number.isInteger(o))return o}return e&&e.port!==r?e.port:typeof t<"u"?i(t)??r:r}(0,Y.registerCoreWithSerializer)();var ye=Symbol("internal_transform"),be=Symbol("internal_resolve"),T=class{#t;#f;#e;#l=!1;#o;#a;#s;#d=null;#c;#i;#r=new te.PromiseQueue({maxConcurrent:1});#n;#u;#h=0;#p=new Set;isProfiling;constructor(t){this.#a=t}async _init(){if(this.#l)return;await ee.init,await Z.init;let t=await j(this.#a);this.#d=t;let{config:r}=await(0,J.loadParcelConfig)(t);if(this.#f=new H.default(r,t),this.#a.workerFarm){if(this.#a.workerFarm.ending)throw new Error("Supplied WorkerFarm is ending");this.#e=this.#a.workerFarm}else this.#e=(0,G.createWorkerFarm)({shouldPatchConsole:t.shouldPatchConsole});await t.cache.ensure();let{dispose:i,ref:s}=await this.#e.createSharedReference(t,!1);this.#c=s,this.#o=new D.Disposable,this.#a.workerFarm?this.#o.add(i):this.#o.add(()=>this.#e.end()),this.#n=new D.ValueEmitter,this.#o.add(()=>this.#n.dispose()),this.#t=await m.default.init({farm:this.#e,options:t}),this.#s=new O.default({options:t,reporters:await this.#f.getReporters(),workerFarm:this.#e}),this.#o.add(this.#s),this.#l=!0}async run(){let t=Date.now();this.#l||await this._init();let r=await this._build({startTime:t});if(await this._end(),r.type==="buildFailure")throw new A(r.diagnostics);return r}async _end(){this.#l=!1,await Promise.all([this.#o.dispose(),await this.#t.writeToCache()])}async _startNextBuild(){this.#i=new re.AbortController,await this.#e.callAllWorkers("clearConfigCache",[]);try{let t=await this._build({signal:this.#i.signal});return this.#n.emit({buildEvent:t}),t}catch(t){if(!(t instanceof I.BuildAbortError))throw t}}async watch(t){this.#l||await this._init();let r;t&&(r=this.#n.addListener(({error:o,buildEvent:h})=>t(o,h))),this.#h===0&&(this.#u=await this._getWatcherSubscription(),await this.#s.report({type:"watchStart"}),this.#r.add(()=>this._startNextBuild()),this.#r.run()),this.#h++;let i,s=async()=>{r&&r.dispose(),this.#h--,this.#h===0&&(await(0,F.default)(this.#u).unsubscribe(),this.#u=null,await this.#s.report({type:"watchEnd"}),this.#i.abort(),await this.#r.run(),await this._end())};return{unsubscribe(){return i==null&&(i=s()),i}}}async _build({signal:t=null,startTime:r=Date.now()}={}){this.#t.setSignal(t);let i=(0,F.default)(this.#d);try{i.shouldProfile&&await this.startProfiling(),this.#n.emit({buildEvent:{type:"buildStart"}}),this.#s.report({type:"buildStart"}),this.#t.graph.invalidateOnBuildNodes();let s=(0,Q.default)({optionsRef:this.#c,requestedAssetIds:this.#p,signal:t}),{bundleGraph:o,bundleInfo:h,changedAssets:p,assetRequests:w}=await this.#t.runRequest(s,{force:!0});this.#p.clear(),await(0,z.default)(this.#t.graph,"RequestGraph",m.requestGraphEdgeTypes);let n={type:"buildSuccess",changedAssets:new Map(Array.from(p).map(([d,u])=>[d,(0,U.assetFromValue)(u,i)])),bundleGraph:new K.default(o,(d,u,y)=>$.PackagedBundle.getWithInfo(d,u,y,h.get(d.id)),i),buildTime:Date.now()-r,requestBundle:async d=>{let u=o._graph.getNodeByContentKey(d.id);if((0,k.default)(u?.type==="bundle","Bundle does not exist"),!u.value.isPlaceholder)return{type:"buildSuccess",changedAssets:new Map,bundleGraph:n.bundleGraph,buildTime:0,requestBundle:n.requestBundle,unstable_requestStats:{}};for(let b of u.value.entryAssetIds)this.#p.add(b);this.#r.getNumWaiting()===0&&(this.#i&&this.#i.abort(),this.#r.add(()=>this._startNextBuild()));let g=(await this.#r.run()).filter(Boolean).pop();if(g.type==="buildFailure")throw new A(g.diagnostics);return g},unstable_requestStats:this.#t.flushStats()};return await this.#s.report(n),await this.#t.runRequest((0,X.default)({optionsRef:this.#c,assetRequests:w}),{force:w.length>0}),n}catch(s){if(s instanceof I.BuildAbortError)throw s;let o=(0,C.anyToDiagnostic)(s),h={type:"buildFailure",diagnostics:Array.isArray(o)?o:[o],unstable_requestStats:this.#t.flushStats()};return await this.#s.report(h),h}finally{this.isProfiling&&await this.stopProfiling(),await this.#e.callAllWorkers("clearConfigCache",[])}}async _getWatcherSubscription(){(0,k.default)(this.#u==null);let t=(0,F.default)(this.#d),r=(0,m.getWatcherOptions)(t);r.ignore.push(process.env.PLASMO_BUILD_DIR);let i=await t.inputFS.watch(t.projectRoot,(s,o)=>{if(s){this.#n.emit({error:s});return}this.#t.respondToFSEvents(o.map(p=>({type:p.type,path:(0,V.toProjectPath)(t.projectRoot,p.path)})))&&this.#r.getNumWaiting()===0&&(this.#i&&this.#i.abort(),this.#r.add(()=>this._startNextBuild()),this.#r.run())},r);return{unsubscribe:()=>i.unsubscribe()}}async startProfiling(){if(this.isProfiling)throw new Error("Parcel is already profiling");B.default.info({origin:"@parcel/core",message:"Starting profiling..."}),this.isProfiling=!0,await this.#e.startProfile()}stopProfiling(){if(!this.isProfiling)throw new Error("Parcel is not profiling");return B.default.info({origin:"@parcel/core",message:"Stopping profiling..."}),this.isProfiling=!1,this.#e.endProfile()}takeHeapSnapshot(){return B.default.info({origin:"@parcel/core",message:"Taking heap snapshot..."}),this.#e.takeHeapSnapshot()}},A=class extends C.default{constructor(t){super({diagnostic:t}),this.name="BuildError"}};0&&(module.exports={INTERNAL_RESOLVE,INTERNAL_TRANSFORM,Parcel});
|