@extenso/parcel-core 0.1.11

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.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/dist/index.js +1 -0
  3. package/package.json +49 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Plasmo Corp. <foss@plasmo.com> (https://www.plasmo.com) and contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ var ne=Object.create;var b=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var he=Object.getPrototypeOf,de=Object.prototype.hasOwnProperty;var ce=(e,t)=>{for(var r in t)b(e,r,{get:t[r],enumerable:!0})},N=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ue(t))!de.call(e,s)&&s!==r&&b(e,s,{get:()=>t[s],enumerable:!(i=le(t,s))||i.enumerable});return e};var l=(e,t,r)=>(r=e!=null?ne(he(e)):{},N(t||!e||!e.__esModule?b(r,"default",{value:e,enumerable:!0}):r,e)),pe=e=>N(b({},"__esModule",{value:!0}),e);var be={};ce(be,{INTERNAL_RESOLVE:()=>ye,INTERNAL_TRANSFORM:()=>we,Parcel:()=>I});module.exports=pe(be);var D=l(require("assert")),G=require("@parcel/core"),z=l(require("@parcel/core/lib/dumpGraphToGraphViz")),H=l(require("@parcel/core/lib/ParcelConfig")),O=require("@parcel/core/lib/projectPath"),V=require("@parcel/core/lib/public/Asset"),U=require("@parcel/core/lib/public/Bundle"),$=l(require("@parcel/core/lib/public/BundleGraph")),K=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")),g=l(require("@parcel/core/lib/RequestTracker")),Y=require("@parcel/core/lib/registerCoreWithSerializer"),T=require("@parcel/core/lib/utils"),B=l(require("@parcel/diagnostic")),C=require("@parcel/events"),Z=require("@parcel/hash"),R=l(require("@parcel/logger")),ee=require("@parcel/source-map"),te=require("@parcel/utils"),Se=require("@parcel/watcher"),re=require("abortcontroller-polyfill/dist/cjs-ponyfill"),F=l(require("nullthrows"));var a=l(require("path")),S=require("@parcel/cache"),v=require("@parcel/core/lib/projectPath"),x=require("@parcel/core/lib/requests/ParcelConfigRequest"),P=require("@parcel/fs"),M=require("@parcel/hash"),W=require("@parcel/package-manager"),c=require("@parcel/utils"),fe=["yarn.lock","package-lock.json","pnpm-lock.yaml"];function me(e){return(0,M.hashString)(`${e.join(",")}-${Date.now()}-${Math.round(Math.random()*100)}`)}async function j(e){let t=e.inputFS||new P.NodeFS,r=e.outputFS||new P.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"),[...fe],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.cache??(r instanceof P.NodeFS?new S.LMDBCache(u):new S.FSCache(r,u)),m=e.mode??"development",E=e?.defaultTargetOptions?.shouldOptimize??m==="production",se=e?.defaultTargetOptions?.publicUrl??"/",k=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 ie=e.env,oe=ge(e.serveOptions,process.env.PORT);return{config:L(t,n,e.config),defaultConfig:L(t,n,e.defaultConfig),shouldPatchConsole:e.shouldPatchConsole??!1,env:ie,mode:m,shouldAutoInstall:e.shouldAutoInstall??!1,hmrOptions:e.hmrOptions??null,shouldBuildLazily:_,shouldBundleIncrementally:e.shouldBundleIncrementally??!0,shouldContentHash:q,serveOptions:e.serveOptions?{...e.serveOptions,distDir:k??a.default.join(s,"dist"),port:oe}:!1,shouldDisableCache:e.shouldDisableCache??!1,shouldProfile:e.shouldProfile??!1,cacheDir:u,entries:o.map(f=>(0,v.toProjectPath)(n,f)),targets:e.targets,logLevel:e.logLevel??"info",projectRoot:n,inputFS:t,outputFS:r,cache:y,packageManager:d,additionalReporters:e.additionalReporters?.map(({packageName:f,resolveFrom:ae})=>({packageName:f,resolveFrom:(0,v.toProjectPath)(n,ae)}))??[],instanceId:me(o),detailedReport:e.detailedReport,defaultTargetOptions:{shouldOptimize:E,shouldScopeHoist:e?.defaultTargetOptions?.shouldScopeHoist,sourceMaps:e?.defaultTargetOptions?.sourceMaps??!0,publicUrl:se,...k!=null?{distDir:(0,v.toProjectPath)(n,k)}:{},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 ge(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 we=Symbol("internal_transform"),ye=Symbol("internal_resolve"),I=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 C.Disposable,this.#a.workerFarm?this.#o.add(i):this.#o.add(()=>this.#e.end()),this.#n=new C.ValueEmitter,this.#o.add(()=>this.#n.dispose()),this.#t=await g.default.init({farm:this.#e,options:t}),this.#s=new K.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 T.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",g.requestGraphEdgeTypes);let n={type:"buildSuccess",changedAssets:new Map(Array.from(p).map(([d,u])=>[d,(0,V.assetFromValue)(u,i)])),bundleGraph:new $.default(o,(d,u,y)=>U.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,D.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 E of u.value.entryAssetIds)this.#p.add(E);this.#r.getNumWaiting()===0&&(this.#i&&this.#i.abort(),this.#r.add(()=>this._startNextBuild()));let m=(await this.#r.run()).filter(Boolean).pop();if(m.type==="buildFailure")throw new A(m.diagnostics);return m},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 T.BuildAbortError)throw s;let o=(0,B.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,D.default)(this.#u==null);let t=(0,F.default)(this.#d),r=(0,g.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,O.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");R.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 R.default.info({origin:"@parcel/core",message:"Stopping profiling..."}),this.isProfiling=!1,this.#e.endProfile()}takeHeapSnapshot(){return R.default.info({origin:"@parcel/core",message:"Taking heap snapshot..."}),this.#e.takeHeapSnapshot()}},A=class extends B.default{constructor(t){super({diagnostic:t}),this.name="BuildError"}};0&&(module.exports={INTERNAL_RESOLVE,INTERNAL_TRANSFORM,Parcel});
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@extenso/parcel-core",
3
+ "version": "0.1.11",
4
+ "description": "Plasmo Parcel Core Fork",
5
+ "files": [
6
+ "dist"
7
+ ],
8
+ "main": "dist/index.js",
9
+ "types": "src/types.ts",
10
+ "author": "Plasmo Corp. <foss@plasmo.com>",
11
+ "homepage": "https://docs.plasmo.com/",
12
+ "engines": {
13
+ "parcel": ">= 2.7.0"
14
+ },
15
+ "license": "MIT",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/Extension-Master/extenso.git"
19
+ },
20
+ "devDependencies": {
21
+ "@parcel/types": "2.8.3",
22
+ "@extenso/config": "^0.2.5",
23
+ "@extenso/utils": "^0.2.3",
24
+ "tsup": "8.5.1"
25
+ },
26
+ "dependencies": {
27
+ "@parcel/cache": "2.16.4",
28
+ "@parcel/core": "2.16.4",
29
+ "@parcel/diagnostic": "2.16.4",
30
+ "@parcel/events": "2.16.4",
31
+ "@parcel/fs": "2.16.4",
32
+ "@parcel/graph": "3.6.4",
33
+ "@parcel/hash": "2.9.3",
34
+ "@parcel/logger": "2.16.4",
35
+ "@parcel/package-manager": "2.16.4",
36
+ "@parcel/plugin": "2.16.4",
37
+ "@parcel/source-map": "2.1.1",
38
+ "@parcel/types": "2.16.4",
39
+ "@parcel/utils": "2.16.4",
40
+ "@parcel/watcher": "2.6.0",
41
+ "@parcel/workers": "2.16.4",
42
+ "abortcontroller-polyfill": "1.7.8",
43
+ "nullthrows": "1.1.1"
44
+ },
45
+ "scripts": {
46
+ "build": "tsup --minify --clean",
47
+ "dev": "tsup --sourcemap --watch"
48
+ }
49
+ }