@powerlines/plugin-tsdown 0.1.67 → 0.1.69
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/powerlines/src/internal/babel/module-resolver-plugin.cjs +1 -1
- package/dist/powerlines/src/internal/babel/module-resolver-plugin.mjs +1 -1
- package/dist/powerlines/src/lib/build/tsdown.cjs +1 -1
- package/dist/powerlines/src/lib/build/tsdown.mjs +1 -1
- package/dist/powerlines/src/lib/fs/vfs.cjs +1 -1
- package/dist/powerlines/src/lib/fs/vfs.mjs +1 -1
- package/dist/powerlines/src/types/fs.d.cts +14 -0
- package/dist/powerlines/src/types/fs.d.mts +14 -0
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../../../_virtual/rolldown_runtime.cjs`);let t=require(`@babel/helper-plugin-utils`),n=require(`@babel/types`);n=e.__toESM(n);function r(e,t){if(!n.isStringLiteral(e.node))return;let r=
|
|
1
|
+
const e=require(`../../../../_virtual/rolldown_runtime.cjs`);let t=require(`@babel/helper-plugin-utils`),n=require(`@babel/types`);n=e.__toESM(n);function r(e,t){if(!n.isStringLiteral(e.node))return;let r=t.context?.fs.resolveSync(e.node.value);r&&e.replaceWith(n.stringLiteral(r.replace(/\.(?:ts|mts|cts)x?$/,``)))}const i=[`require`,`require.resolve`,`System.import`,`jest.genMockFromModule`,`jest.mock`,`jest.unmock`,`jest.doMock`,`jest.dontMock`,`jest.setMock`,`jest.requireActual`,`jest.requireMock`,`require.requireActual`,`require.requireMock`];function a(e,t,r){let{node:i}=t;if(n.isMemberExpression(i))return t.matchesPattern(r);if(!n.isIdentifier(i)||r.includes(`.`))return!1;let a=r.split(`.`)[0];return i.name===a}const o={CallExpression:(e,t)=>{if(t.moduleResolverVisited.has(e))return;let o=e.get(`callee`);(o&&i.some(e=>a(t,o,e))||n.isImport(e.node.callee))&&(t.moduleResolverVisited.add(e),r(e.get(`arguments.0`),t))},"ImportDeclaration|ExportDeclaration|ExportAllDeclaration":(e,t)=>{!e||!e.get(`source`)||t.moduleResolverVisited.has(e)||(t.moduleResolverVisited.add(e),r(e.get(`source`),t))}},s=e=>(0,t.declare)(function(t){let n=new Set;return{name:`powerlines:module-resolver`,manipulateOptions(e){e.filename??=`unknown`},pre(){n=new Set},visitor:{Program:{enter(r,i){r.traverse(o,{...i,context:e,moduleResolverVisited:n,api:t})},exit(r,i){r.traverse(o,{...i,context:e,moduleResolverVisited:n,api:t})}}},post(){n.clear()}}});exports.moduleResolverBabelPlugin=s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{declare as e}from"@babel/helper-plugin-utils";import*as t from"@babel/types";function n(e,n){if(!t.isStringLiteral(e.node))return;let r=
|
|
1
|
+
import{declare as e}from"@babel/helper-plugin-utils";import*as t from"@babel/types";function n(e,n){if(!t.isStringLiteral(e.node))return;let r=n.context?.fs.resolveSync(e.node.value);r&&e.replaceWith(t.stringLiteral(r.replace(/\.(?:ts|mts|cts)x?$/,``)))}const r=[`require`,`require.resolve`,`System.import`,`jest.genMockFromModule`,`jest.mock`,`jest.unmock`,`jest.doMock`,`jest.dontMock`,`jest.setMock`,`jest.requireActual`,`jest.requireMock`,`require.requireActual`,`require.requireMock`];function i(e,n,r){let{node:i}=n;if(t.isMemberExpression(i))return n.matchesPattern(r);if(!t.isIdentifier(i)||r.includes(`.`))return!1;let a=r.split(`.`)[0];return i.name===a}const a={CallExpression:(e,a)=>{if(a.moduleResolverVisited.has(e))return;let o=e.get(`callee`);(o&&r.some(e=>i(a,o,e))||t.isImport(e.node.callee))&&(a.moduleResolverVisited.add(e),n(e.get(`arguments.0`),a))},"ImportDeclaration|ExportDeclaration|ExportAllDeclaration":(e,t)=>{!e||!e.get(`source`)||t.moduleResolverVisited.has(e)||(t.moduleResolverVisited.add(e),n(e.get(`source`),t))}},o=t=>e(function(e){let n=new Set;return{name:`powerlines:module-resolver`,manipulateOptions(e){e.filename??=`unknown`},pre(){n=new Set},visitor:{Program:{enter(r,i){r.traverse(a,{...i,context:t,moduleResolverVisited:n,api:e})},exit(r,i){r.traverse(a,{...i,context:t,moduleResolverVisited:n,api:e})}}},post(){n.clear()}}});export{o as moduleResolverBabelPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../../../_virtual/rolldown_runtime.cjs`);let t=require(`defu`);t=e.__toESM(t);let n=require(`@stryke/convert/to-array`),r=require(`@stryke/helpers/omit`),i=require(`@stryke/path/append`),a=require(`@stryke/path/join-paths`),o=require(`@stryke/type-checks/is-set-string`);const s={platform:`neutral`,target:`esnext`,cjsDefault:!0,unbundle:!0,shims:!0,fixedExtension:!0,nodeProtocol:!0,clean:!1};function c(e){return(0,n.toArray)(e).map(e=>{switch(e){case`cjs`:return`cjs`;case`iife`:return`iife`;case`esm`:default:return`esm`}})}const l=(e,...t)=>t.filter(Boolean).join(` `).replace(RegExp(`\\[${e.config.name}\\]`,`g`),``).trim();function u(e){return(0,t.default)({entry:e.entry.length>0?e.entry.filter(Boolean).map(t=>(0,i.appendPath)((0,i.appendPath)(t.file,e.config.projectRoot),e.workspaceConfig.workspaceRoot)):[(0,a.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.sourceRoot,`**/*.ts`),(0,a.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.sourceRoot,`**/*.tsx`)],alias:e.builtins.reduce((t,n)=>{let r=e.fs.ids[n];return r&&(t[n]=r),t},{}),noExternal:e.builtins},e.config.build.variant===`tsdown`?e.config.build.override:{},e.config.build.variant===`tsdown`?(0,r.omit)(e.config.build,[`override`,`variant`]):{},{name:e.config.name,cwd:(0,i.appendPath)(e.config.projectRoot,e.workspaceConfig.workspaceRoot),dts:{parallel:!0,newContext:!0,cwd:(0,i.appendPath)(e.config.projectRoot,e.workspaceConfig.workspaceRoot),tsconfig:(0,i.appendPath)(e.tsconfig.tsconfigFilePath,e.workspaceConfig.workspaceRoot),sourcemap:e.config.mode===`development`},outDir:(0,i.appendPath)(e.config.output.buildPath,e.workspaceConfig.workspaceRoot),tsconfig:(0,i.appendPath)(e.tsconfig.tsconfigFilePath,e.workspaceConfig.workspaceRoot),format:c(e.config.output.format).filter(Boolean),mode:e.config.mode,treeshake:e.config.build.variant===`tsdown`||e.config.build.variant===`tsup`?e.config.build?.treeshake:e.config.build.variant===`esbuild`?e.config.build?.treeShaking:void 0,minify:e.config.mode===`production`,metafile:e.config.mode===`development`,sourcemap:e.config.mode===`development`,debug:e.config.mode===`development`,silent:e.config.logLevel===null||e.config.mode===`production`,logLevel:e.config.logLevel===`trace`?`debug`:e.config.logLevel,customLogger:{level:e.config.logLevel===`trace`?`debug`:e.config.logLevel,info:(...t)=>(0,o.isSetString)(l(e,...t).replace(/\s+/g,``))&&e.info(l(e,...t)),warn:(...t)=>(0,o.isSetString)(l(e,...t).replace(/\s+/g,``))&&e.warn(l(e,...t)),warnOnce:(...t)=>(0,o.isSetString)(l(e,...t).replace(/\s+/g,``))&&e.warn(l(e,...t)),error:(...t)=>(0,o.isSetString)(l(e,...t).replace(/\s+/g,``))&&e.error(l(e,...t)),success:(...t)=>(0,o.isSetString)(l(e,...t).replace(/\s+/g,``))&&e.info(l(e,...t))}},s)}exports.extractTsdownConfig=u;
|
|
1
|
+
const e=require(`../../../../_virtual/rolldown_runtime.cjs`);let t=require(`defu`);t=e.__toESM(t);let n=require(`@stryke/convert/to-array`),r=require(`@stryke/helpers/omit`),i=require(`@stryke/path/append`),a=require(`@stryke/path/join-paths`),o=require(`@stryke/type-checks/is-set-string`);const s={platform:`neutral`,target:`esnext`,cjsDefault:!0,unbundle:!0,shims:!0,fixedExtension:!0,nodeProtocol:!0,clean:!1};function c(e){return(0,n.toArray)(e).map(e=>{switch(e){case`cjs`:return`cjs`;case`iife`:return`iife`;case`esm`:default:return`esm`}})}const l=(e,...t)=>t.filter(Boolean).join(` `).replace(RegExp(`\\[${e.config.name}\\]`,`g`),``).trim();function u(e){return(0,t.default)({entry:e.entry.length>0?e.entry.filter(Boolean).map(t=>(0,i.appendPath)((0,i.appendPath)(t.file,e.config.projectRoot),e.workspaceConfig.workspaceRoot)):[(0,a.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.sourceRoot,`**/*.ts`),(0,a.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.sourceRoot,`**/*.tsx`)],alias:e.builtins.reduce((t,n)=>{let r=e.fs.ids[n];return r&&(t[n]=r),t},e.config.build.alias??{}),noExternal:e.builtins},e.config.build.variant===`tsdown`?e.config.build.override:{},e.config.build.variant===`tsdown`?(0,r.omit)(e.config.build,[`override`,`variant`]):{},{name:e.config.name,cwd:(0,i.appendPath)(e.config.projectRoot,e.workspaceConfig.workspaceRoot),dts:{parallel:!0,newContext:!0,cwd:(0,i.appendPath)(e.config.projectRoot,e.workspaceConfig.workspaceRoot),tsconfig:(0,i.appendPath)(e.tsconfig.tsconfigFilePath,e.workspaceConfig.workspaceRoot),sourcemap:e.config.mode===`development`},resolve:{alias:e.builtins.reduce((t,n)=>{let r=e.fs.ids[n];return r&&(t[n]=r),t},e.config.build.alias??{})},outDir:(0,i.appendPath)(e.config.output.buildPath,e.workspaceConfig.workspaceRoot),tsconfig:(0,i.appendPath)(e.tsconfig.tsconfigFilePath,e.workspaceConfig.workspaceRoot),format:c(e.config.output.format).filter(Boolean),mode:e.config.mode,treeshake:e.config.build.variant===`tsdown`||e.config.build.variant===`tsup`?e.config.build?.treeshake:e.config.build.variant===`esbuild`?e.config.build?.treeShaking:void 0,minify:e.config.mode===`production`,metafile:e.config.mode===`development`,sourcemap:e.config.mode===`development`,debug:e.config.mode===`development`,silent:e.config.logLevel===null||e.config.mode===`production`,logLevel:e.config.logLevel===`trace`?`debug`:e.config.logLevel,customLogger:{level:e.config.logLevel===`trace`?`debug`:e.config.logLevel,info:(...t)=>(0,o.isSetString)(l(e,...t).replace(/\s+/g,``))&&e.info(l(e,...t)),warn:(...t)=>(0,o.isSetString)(l(e,...t).replace(/\s+/g,``))&&e.warn(l(e,...t)),warnOnce:(...t)=>(0,o.isSetString)(l(e,...t).replace(/\s+/g,``))&&e.warn(l(e,...t)),error:(...t)=>(0,o.isSetString)(l(e,...t).replace(/\s+/g,``))&&e.error(l(e,...t)),success:(...t)=>(0,o.isSetString)(l(e,...t).replace(/\s+/g,``))&&e.info(l(e,...t))}},s)}exports.extractTsdownConfig=u;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"defu";import{toArray as t}from"@stryke/convert/to-array";import{omit as n}from"@stryke/helpers/omit";import{appendPath as r}from"@stryke/path/append";import{joinPaths as i}from"@stryke/path/join-paths";import{isSetString as a}from"@stryke/type-checks/is-set-string";const o={platform:`neutral`,target:`esnext`,cjsDefault:!0,unbundle:!0,shims:!0,fixedExtension:!0,nodeProtocol:!0,clean:!1};function s(e){return t(e).map(e=>{switch(e){case`cjs`:return`cjs`;case`iife`:return`iife`;case`esm`:default:return`esm`}})}const c=(e,...t)=>t.filter(Boolean).join(` `).replace(RegExp(`\\[${e.config.name}\\]`,`g`),``).trim();function l(t){return e({entry:t.entry.length>0?t.entry.filter(Boolean).map(e=>r(r(e.file,t.config.projectRoot),t.workspaceConfig.workspaceRoot)):[i(t.workspaceConfig.workspaceRoot,t.config.sourceRoot,`**/*.ts`),i(t.workspaceConfig.workspaceRoot,t.config.sourceRoot,`**/*.tsx`)],alias:t.builtins.reduce((e,n)=>{let r=t.fs.ids[n];return r&&(e[n]=r),e},{}),noExternal:t.builtins},t.config.build.variant===`tsdown`?t.config.build.override:{},t.config.build.variant===`tsdown`?n(t.config.build,[`override`,`variant`]):{},{name:t.config.name,cwd:r(t.config.projectRoot,t.workspaceConfig.workspaceRoot),dts:{parallel:!0,newContext:!0,cwd:r(t.config.projectRoot,t.workspaceConfig.workspaceRoot),tsconfig:r(t.tsconfig.tsconfigFilePath,t.workspaceConfig.workspaceRoot),sourcemap:t.config.mode===`development`},outDir:r(t.config.output.buildPath,t.workspaceConfig.workspaceRoot),tsconfig:r(t.tsconfig.tsconfigFilePath,t.workspaceConfig.workspaceRoot),format:s(t.config.output.format).filter(Boolean),mode:t.config.mode,treeshake:t.config.build.variant===`tsdown`||t.config.build.variant===`tsup`?t.config.build?.treeshake:t.config.build.variant===`esbuild`?t.config.build?.treeShaking:void 0,minify:t.config.mode===`production`,metafile:t.config.mode===`development`,sourcemap:t.config.mode===`development`,debug:t.config.mode===`development`,silent:t.config.logLevel===null||t.config.mode===`production`,logLevel:t.config.logLevel===`trace`?`debug`:t.config.logLevel,customLogger:{level:t.config.logLevel===`trace`?`debug`:t.config.logLevel,info:(...e)=>a(c(t,...e).replace(/\s+/g,``))&&t.info(c(t,...e)),warn:(...e)=>a(c(t,...e).replace(/\s+/g,``))&&t.warn(c(t,...e)),warnOnce:(...e)=>a(c(t,...e).replace(/\s+/g,``))&&t.warn(c(t,...e)),error:(...e)=>a(c(t,...e).replace(/\s+/g,``))&&t.error(c(t,...e)),success:(...e)=>a(c(t,...e).replace(/\s+/g,``))&&t.info(c(t,...e))}},o)}export{l as extractTsdownConfig};
|
|
1
|
+
import e from"defu";import{toArray as t}from"@stryke/convert/to-array";import{omit as n}from"@stryke/helpers/omit";import{appendPath as r}from"@stryke/path/append";import{joinPaths as i}from"@stryke/path/join-paths";import{isSetString as a}from"@stryke/type-checks/is-set-string";const o={platform:`neutral`,target:`esnext`,cjsDefault:!0,unbundle:!0,shims:!0,fixedExtension:!0,nodeProtocol:!0,clean:!1};function s(e){return t(e).map(e=>{switch(e){case`cjs`:return`cjs`;case`iife`:return`iife`;case`esm`:default:return`esm`}})}const c=(e,...t)=>t.filter(Boolean).join(` `).replace(RegExp(`\\[${e.config.name}\\]`,`g`),``).trim();function l(t){return e({entry:t.entry.length>0?t.entry.filter(Boolean).map(e=>r(r(e.file,t.config.projectRoot),t.workspaceConfig.workspaceRoot)):[i(t.workspaceConfig.workspaceRoot,t.config.sourceRoot,`**/*.ts`),i(t.workspaceConfig.workspaceRoot,t.config.sourceRoot,`**/*.tsx`)],alias:t.builtins.reduce((e,n)=>{let r=t.fs.ids[n];return r&&(e[n]=r),e},t.config.build.alias??{}),noExternal:t.builtins},t.config.build.variant===`tsdown`?t.config.build.override:{},t.config.build.variant===`tsdown`?n(t.config.build,[`override`,`variant`]):{},{name:t.config.name,cwd:r(t.config.projectRoot,t.workspaceConfig.workspaceRoot),dts:{parallel:!0,newContext:!0,cwd:r(t.config.projectRoot,t.workspaceConfig.workspaceRoot),tsconfig:r(t.tsconfig.tsconfigFilePath,t.workspaceConfig.workspaceRoot),sourcemap:t.config.mode===`development`},resolve:{alias:t.builtins.reduce((e,n)=>{let r=t.fs.ids[n];return r&&(e[n]=r),e},t.config.build.alias??{})},outDir:r(t.config.output.buildPath,t.workspaceConfig.workspaceRoot),tsconfig:r(t.tsconfig.tsconfigFilePath,t.workspaceConfig.workspaceRoot),format:s(t.config.output.format).filter(Boolean),mode:t.config.mode,treeshake:t.config.build.variant===`tsdown`||t.config.build.variant===`tsup`?t.config.build?.treeshake:t.config.build.variant===`esbuild`?t.config.build?.treeShaking:void 0,minify:t.config.mode===`production`,metafile:t.config.mode===`development`,sourcemap:t.config.mode===`development`,debug:t.config.mode===`development`,silent:t.config.logLevel===null||t.config.mode===`production`,logLevel:t.config.logLevel===`trace`?`debug`:t.config.logLevel,customLogger:{level:t.config.logLevel===`trace`?`debug`:t.config.logLevel,info:(...e)=>a(c(t,...e).replace(/\s+/g,``))&&t.info(c(t,...e)),warn:(...e)=>a(c(t,...e).replace(/\s+/g,``))&&t.warn(c(t,...e)),warnOnce:(...e)=>a(c(t,...e).replace(/\s+/g,``))&&t.warn(c(t,...e)),error:(...e)=>a(c(t,...e).replace(/\s+/g,``))&&t.error(c(t,...e)),success:(...e)=>a(c(t,...e).replace(/\s+/g,``))&&t.info(c(t,...e))}},o)}export{l as extractTsdownConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../../../_virtual/rolldown_runtime.cjs`),t=require(`../../plugin-utils/paths.cjs`),n=require(`../../../schemas/fs.cjs`),r=require(`../logger.cjs`),i=require(`./helpers.cjs`),a=require(`./storage/file-system.cjs`),o=require(`./storage/virtual.cjs`);let s=require(`@storm-software/config-tools/types`),c=require(`@stryke/convert/to-array`),l=require(`@stryke/path/append`),u=require(`@stryke/path/join-paths`),d=require(`@stryke/type-checks/is-set-string`),f=require(`@stryke/fs/resolve`),p=require(`@stryke/path/replace`),m=require(`@stryke/type-checks/is-set-object`),h=require(`@stryke/type-checks/is-string`),g=require(`@stryke/path/file-path-fns`),_=require(`@stryke/fs/exists`),v=require(`@stryke/hash/murmurhash`),y=require(`@stryke/helpers/get-unique`),b=require(`@stryke/path/is-parent-path`),x=require(`@stryke/path/is-type`),S=require(`flat-cache`),C=require(`@stryke/capnp`);C=e.__toESM(C);let w=require(`@stryke/fs/buffer`),T=require(`@stryke/string-format/pretty-bytes`),E=require(`node:buffer`),D=require(`node:url`),O=require(`prettier`);var k=class e{#e;#t;#n;#r={"":new a.FileSystemStorageAdapter};#i;#a=!1;#o;#s;#c(e){let t=e;return(0,b.isParentPath)(t,this.#o.builtinsPath)&&(t=(0,p.replacePath)(t,this.#o.builtinsPath)),i.normalizeId(t,this.#o.config.output.builtinPrefix)}#l(e){return i.normalizePath(e.includes(`{`)||e.includes(`}`)?t.replacePathTokens(this.#o,e):e,this.#o.builtinsPath,this.#o.config.output.builtinPrefix)}#u(e){let t=`::GLOBSTAR::`;return RegExp(`^${this.#l(e).replace(/\*\*/g,t).replace(/[.+^${}()|[\]\\]/g,`\\$&`).replace(/\*/g,`[^/]*`).replace(/\?/g,`[^/]`).replace(new RegExp(t,`g`),`.*`)}$`)}#d(e){let t=this.resolveSync(this.#l(e))||e;for(let e of Object.keys(this.#r).filter(Boolean).sort().reverse())if((0,b.isParentPath)(t,e))return{base:e,relativeKey:(0,p.replacePath)(t,e),adapter:this.#r[e]};return{base:``,relativeKey:t,adapter:this.#r[``]}}#f(e=``,t=!1){return Object.keys(this.#r).sort().reverse().filter(n=>(0,b.isParentPath)(n,e)||t&&(0,b.isParentPath)(e,n)).map(t=>({relativeBase:e.length>t.length?e.slice(t.length):void 0,base:t,adapter:this.#r[t]}))}static async create(t){if(!t.config.skipCache&&(0,_.existsSync)((0,u.joinPaths)(t.dataPath,`fs.bin`))){let r=await(0,w.readFileBuffer)((0,u.joinPaths)(t.dataPath,`fs.bin`)),i=new C.Message(r,!1).getRoot(n.FileSystem),a=new e(t,i);i._hasStorage()&&i.storage.length>0&&await Promise.all(i.storage.values().map(async e=>{await a.write(e.path,e.code)}))}return new e(t,new C.Message().initRoot(n.FileSystem))}static createSync(t){if(!t.config.skipCache&&(0,_.existsSync)((0,u.joinPaths)(t.dataPath,`fs.bin`))){let r=(0,w.readFileBufferSync)((0,u.joinPaths)(t.dataPath,`fs.bin`)),i=new C.Message(r,!1).getRoot(n.FileSystem),a=new e(t,i);i._hasStorage()&&i.storage.length>0&&i.storage.values().map(e=>{a.writeSync(e.path,e.code)})}return new e(t,new C.Message().initRoot(n.FileSystem))}get metadata(){return new Proxy(this.#e,{get:(e,t)=>e[this.#c(t)]})}get ids(){return new Proxy(this.#n,{get:(e,t)=>e[this.#l(t)]})}get paths(){return new Proxy(this.#n,{get:(e,t)=>e[this.#c(t)]})}get resolverCache(){return this.#i||=(0,S.create)({cacheId:`module-resolution`,cacheDir:this.#o.cachePath,ttl:3600*1e3,lruSize:5e3,persistInterval:100}),this.#i}constructor(e,t){this.#o=e,(0,m.isSetObject)(this.#o.config.output.storage)&&(this.#r={...this.#r,...this.#o.config.output.storage}),this.#r.virtual??=new o.VirtualStorageAdapter({base:`/_virtual`}),this.#o.config.output.storage!==`fs`&&(this.#r[this.#o.artifactsPath]??=new o.VirtualStorageAdapter({base:this.#o.artifactsPath}),this.#r[this.#o.builtinsPath]??=new o.VirtualStorageAdapter({base:this.#o.builtinsPath}),this.#r[this.#o.entryPath]??=new o.VirtualStorageAdapter({base:this.#o.entryPath})),this.#e={},t._hasMetadata()&&(this.#e=t.metadata.values().reduce((e,t)=>(e[t.id]={id:t.id,type:t.type,timestamp:t.timestamp||Date.now(),properties:t._hasProperties()?t.properties.values().reduce((e,t)=>(e[t.key]=t.value,e),{}):{}},e),{}),e.config.skipCache!==!0&&Object.entries(this.#e).filter(([,e])=>e.type===`entry`).forEach(([e,t])=>{this.#o.entry??=[],this.#o.entry.push({file:e,name:t.properties.name,output:t.properties.output,input:t.properties[`input.file`]?{file:t.properties[`input.file`],name:t.properties[`input.name`]}:void 0})})),this.#t={},this.#n={},t._hasIds()&&(this.#t=t.ids.values().reduce((e,t)=>(e[t.path]??=t.id,e),{}),this.#n=t.ids.values().reduce((e,t)=>(e[t.id]??=t.path,e),{})),this.#s=r.extendLog(this.#o.log,`file-system`)}async exists(e){let{relativeKey:t,adapter:n}=this.#d(e);return n.exists(t)}existsSync(e){let{relativeKey:t,adapter:n}=this.#d(e);return n.existsSync(t)}isVirtual(e){let t=this.resolveSync(e);return t?this.#d(t)?.adapter?.name===`virtual`:!1}isDirectorySync(e){let t=this.resolveSync(e);return t?!!(this.existsSync(t)&&this.#d(t)?.adapter?.isDirectorySync(t)):!1}async isDirectory(e){let t=await this.resolve(e);return t?!!(await this.exists(t)&&await this.#d(t)?.adapter?.isDirectory(t)):!1}isFileSync(e){let t=this.resolveSync(e);return t?this.#d(t)?.adapter?.isFileSync(t)??!1:!1}async isFile(e){let t=await this.resolve(e);return t?await this.#d(t)?.adapter?.isFile(t)??!1:!1}listSync(e){return(0,y.getUnique)(this.#f(e,!0).map(e=>e.adapter.listSync(e.relativeBase?e.base?(0,l.appendPath)(e.relativeBase,e.base):e.relativeBase:e.base)).flat())}async list(e){return(0,y.getUnique)((await Promise.all(this.#f(e,!0).map(async e=>e.adapter.list(e.relativeBase?e.base?(0,l.appendPath)(e.relativeBase,e.base):e.relativeBase:e.base)))).flat())}async remove(e){let t=this.#l(e);this.#s(s.LogLevelLabel.TRACE,`Removing file: ${t}`);let{relativeKey:n,adapter:r}=this.#d(t);(0,g.hasFileExtension)(t)?await r.remove(n):await r.clear(n);let i=this.#t[t];i&&this.#e[i]&&(delete this.#e[i],delete this.#t[t],delete this.#n[i])}removeSync(e){let t=this.#l(e);this.#s(s.LogLevelLabel.TRACE,`Removing file: ${t}`);let{relativeKey:n,adapter:r}=this.#d(t);(0,g.hasFileExtension)(t)?r.removeSync(n):r.clearSync(n);let i=this.#t[t];i&&this.#e[i]&&(delete this.#e[i],delete this.#t[t],delete this.#n[i])}async glob(e){let t=[];for(let n of i.normalizeGlobPatterns(this.#o.workspaceConfig.workspaceRoot,e)){let e=this.#l(n);if(!/[*?[\]{}]/.test(e)&&!e.includes(`**`)){if(this.isDirectorySync(e))t.push(...await this.list(e));else{let n=await this.resolve(e);n&&!t.includes(n)&&t.push(n)}continue}let r=(0,x.isAbsolutePath)(e)?e:this.#l((0,u.joinPaths)(this.#o.workspaceConfig.workspaceRoot,e)),i=r.search(/[*?[\]{}]/),a=i===-1?(0,g.findFilePath)(r):r.slice(0,Math.max(0,r.lastIndexOf(`/`,i)));await Promise.all((await this.list(a&&(0,x.isAbsolutePath)(a)?a:this.#o.workspaceConfig.workspaceRoot)).map(async e=>{if(this.#u(r).test(e)){let n=this.resolveSync(e);n&&!t.includes(n)&&t.push(n)}}))}return t}globSync(e){let t=[];for(let n of i.normalizeGlobPatterns(this.#o.workspaceConfig.workspaceRoot,e)){let e=this.#l(n);if(!/[*?[\]{}]/.test(e)&&!e.includes(`**`)){if(this.isDirectorySync(e))t.push(...this.listSync(e));else{let n=this.resolveSync(e);n&&!t.includes(n)&&t.push(n)}continue}let r=(0,x.isAbsolutePath)(e)?e:this.#l((0,u.joinPaths)(this.#o.workspaceConfig.workspaceRoot,e)),i=r.search(/[*?[\]{}]/),a=i===-1?(0,g.findFilePath)(r):r.slice(0,Math.max(0,r.lastIndexOf(`/`,i))),o=this.listSync(a&&(0,x.isAbsolutePath)(a)?a:this.#o.workspaceConfig.workspaceRoot);for(let e of o)if(this.#u(r).test(e)){let n=this.resolveSync(e);n&&!t.includes(n)&&t.push(n)}}return t}async copy(e,t){let n=e instanceof URL?(0,D.fileURLToPath)(e):e,r=t instanceof URL?(0,D.fileURLToPath)(t):t;if(!(0,d.isSetString)(n)&&(!(0,m.isSetObject)(n)||!(0,d.isSetString)(n.input))||!(0,d.isSetString)(r))return;let i=(0,h.isString)(n)?n:n.input?n.input:this.#o.workspaceConfig.workspaceRoot,a=await this.resolve(i);if(a)if(this.isDirectorySync(a)||(0,d.isSetString)(n)&&n.includes(`*`)||(0,m.isSetObject)(n)&&(0,d.isSetString)(n.glob))await Promise.all((await this.glob(n)).map(async e=>this.copy(e,(0,l.appendPath)((0,p.replacePath)(e,i),r))));else{let e=await this.read(a);e!==void 0&&await this.write(this.#l(r),e,{skipFormat:!0})}}copySync(e,t){let n=e instanceof URL?(0,D.fileURLToPath)(e):e,r=t instanceof URL?(0,D.fileURLToPath)(t):t;if(!(0,d.isSetString)(n)&&(!(0,m.isSetObject)(n)||!(0,d.isSetString)(n.input))||!(0,d.isSetString)(r))return;let i=(0,h.isString)(n)?n:n.input?n.input:this.#o.workspaceConfig.workspaceRoot,a=this.resolveSync(i);if(a)if(this.isDirectorySync(a)||(0,d.isSetString)(n)&&n.includes(`*`)||(0,m.isSetObject)(n)&&(0,d.isSetString)(n.glob))this.globSync(n).map(e=>this.copySync(e,(0,l.appendPath)((0,g.findFilePath)((0,p.replacePath)(e,i)),r)));else{let e=this.readSync(a);e!==void 0&&this.writeSync(this.#l((0,g.hasFileExtension)(r)?r:(0,l.appendPath)((0,g.findFileName)(a),r)),e,{skipFormat:!0})}}async move(e,t){(0,g.hasFileExtension)(e)?(await this.copy(e,t),await this.remove(e)):await Promise.all((await this.list(e)).map(async e=>{await this.copy(e,t),await this.remove(e)}))}moveSync(e,t){(0,g.hasFileExtension)(e)?(this.copySync(e,t),this.removeSync(e)):this.listSync(e).forEach(e=>{this.copySync(e,t),this.removeSync(e)})}async read(e){let t=await this.resolve(e);if(!t)return;let{relativeKey:n,adapter:r}=this.#d(t);return this.#s(s.LogLevelLabel.TRACE,`Reading ${r.name} file: ${t}`),await r.get(n)??void 0}readSync(e){let t=this.resolveSync(e);if(!t)return;let{relativeKey:n,adapter:r}=this.#d(t);return this.#s(s.LogLevelLabel.TRACE,`Reading ${r.name} file: ${t}`),r.getSync(n)??void 0}async write(e,t=``,n={}){let r=t;if(!n.skipFormat){let n=await(0,O.resolveConfig)(this.#l(e));n&&(r=await(0,O.format)(t,{absolutePath:this.#l(e),...n}))}let{relativeKey:i,adapter:a}=this.#d(e);this.#s(s.LogLevelLabel.TRACE,`Writing ${this.#l(i)} to ${a.name===`virtual`?`the virtual file system`:a.name===`file-system`?`the local file system`:a.name} (size: ${(0,T.prettyBytes)(new E.Blob((0,c.toArray)(r)).size)})`);let o=n?.meta?.id||this.#c(i);return this.#e[o]={variant:`normal`,timestamp:Date.now(),...n.meta??{}},this.#n[o]=this.#l(i),this.#t[this.#l(i)]=o,a.set(i,r)}writeSync(e,t=``,n={}){let{relativeKey:r,adapter:i}=this.#d(e);this.#s(s.LogLevelLabel.TRACE,`Writing ${this.#l(r)} file to ${i.name===`virtual`?`the virtual file system`:i.name===`file-system`?`the local file system`:i.name} (size: ${(0,T.prettyBytes)(new E.Blob((0,c.toArray)(t)).size)})`);let a=n?.meta?.id||this.#c(r);return this.#e[a]={variant:`normal`,timestamp:Date.now(),...n.meta??{}},this.#n[a]=this.#l(r),this.#t[this.#l(r)]=a,i.setSync(r,t)}mkdirSync(e){return this.#d(e)?.adapter?.mkdirSync(e)}async mkdir(e){return this.#d(e)?.adapter?.mkdir(e)}getMetadata(e){let t=this.resolveSync(e);if(t&&this.metadata[t])return this.metadata[t]}async resolve(e,n,r={}){let i=e;if((i.includes(`{`)||i.includes(`}`))&&(i=t.replacePathTokens(this.#o,i)),(0,x.isAbsolutePath)(i))return i;let a=(0,v.murmurhash)({path:this.#c(i),importer:n,options:r}),o;if(!this.#o.config.skipCache&&(o=this.resolverCache.get(a),o))return o;if(o=this.paths[this.#c(i)],!o){let e=r.paths??[];n&&!e.includes(n)&&e.push(n),e.push(this.#o.workspaceConfig.workspaceRoot),e.push((0,l.appendPath)(this.#o.config.projectRoot,this.#o.workspaceConfig.workspaceRoot)),e.push((0,l.appendPath)(this.#o.config.sourceRoot,this.#o.workspaceConfig.workspaceRoot)),e.push(...Object.keys(this.#o.tsconfig?.options?.paths??{}).filter(e=>i.startsWith(e.replace(/\*$/,``))).map(e=>this.#o.tsconfig?.options?.paths?.[e]).flat().filter(Boolean).map(e=>(0,l.appendPath)(e,this.#o.workspaceConfig.workspaceRoot)));for(let t of(0,f.getResolutionCombinations)(i,{paths:e})){let{relativeKey:e,adapter:n}=this.#d(t);if(await n.exists(e)){o=t;break}}if(!o)try{o=await(0,f.resolve)(i,{...r,paths:e})}catch{}}return o&&!this.#o.config.skipCache&&this.resolverCache.set(a,o),o}resolveSync(e,n,r={}){let i=e;if((i.includes(`{`)||i.includes(`}`))&&(i=t.replacePathTokens(this.#o,i)),(0,x.isAbsolutePath)(i))return i;let a;if(!this.#o.config.skipCache&&(a=this.resolverCache.get(this.#c(i)),a))return a;if(a=this.paths[this.#c(i)],!a){let e=r.paths??[];n&&!e.includes(n)&&e.push(n),e.push(this.#o.workspaceConfig.workspaceRoot),e.push((0,l.appendPath)(this.#o.config.projectRoot,this.#o.workspaceConfig.workspaceRoot)),e.push((0,l.appendPath)(this.#o.config.sourceRoot,this.#o.workspaceConfig.workspaceRoot)),e.push(...Object.keys(this.#o.tsconfig?.options?.paths??{}).filter(e=>i.startsWith(e.replace(/\*$/,``))).map(e=>this.#o.tsconfig?.options?.paths?.[e]).flat().filter(Boolean).map(e=>(0,l.appendPath)(e,this.#o.workspaceConfig.workspaceRoot)));for(let t of(0,f.getResolutionCombinations)(i,{paths:e})){let{relativeKey:e,adapter:n}=this.#d(t);if(n.existsSync(e)){a=t;break}}if(!a)try{a=(0,f.resolveSync)(i,{...r,paths:e})}catch{}}return a&&!this.#o.config.skipCache&&this.resolverCache.set(this.#c(i),a),a}async dispose(){if(!this.#a){this.#a=!0,this.#s(s.LogLevelLabel.DEBUG,`Disposing virtual file system...`),await this.remove((0,u.joinPaths)(this.#o.dataPath,`fs.bin`));let e=new C.Message,t=e.initRoot(n.FileSystem),r=await this.list(),i=t._initStorage(r.length);await Promise.all(r.map(async(e,t)=>{let n=await this.read(e),r=i.get(t);r.path=e,r.code=n||``}));let a=t._initIds(Object.keys(this.ids).length);Object.entries(this.ids).filter(([,e])=>e).forEach(([e,t],n)=>{let r=a.get(n);r.id=e,r.path=t});let o=t._initMetadata(Object.keys(this.metadata).length);Object.entries(this.metadata).filter(([,e])=>e).forEach(([e,t],n)=>{let r=o.get(n);if(r.id=e,r.type=t.type,r.timestamp=t.timestamp??BigInt(Date.now()),t.properties){let e=r._initProperties(Object.keys(t.properties).length);Object.entries(t.properties).filter(([,e])=>(0,d.isSetString)(e)).forEach(([t,n],r)=>{let i=e.get(r);i.key=t,i.value=n})}}),await(0,w.writeFileBuffer)((0,u.joinPaths)(this.#o.dataPath,`fs.bin`),e.toArrayBuffer()),this.#o.config.skipCache||this.#i.save(!0),await Promise.all(this.#f().map(async e=>e.adapter.dispose())),this.#s(s.LogLevelLabel.TRACE,`Virtual file system has been disposed.`)}}async[Symbol.asyncDispose](){return this.dispose()}};exports.VirtualFileSystem=k;
|
|
1
|
+
const e=require(`../../../../_virtual/rolldown_runtime.cjs`),t=require(`../../plugin-utils/paths.cjs`),n=require(`../../../schemas/fs.cjs`),r=require(`../logger.cjs`),i=require(`./helpers.cjs`),a=require(`./storage/file-system.cjs`),o=require(`./storage/virtual.cjs`);let s=require(`@storm-software/config-tools/types`),c=require(`@stryke/convert/to-array`),l=require(`@stryke/path/append`),u=require(`@stryke/path/join-paths`),d=require(`@stryke/type-checks/is-set-string`),f=require(`@stryke/fs/resolve`),p=require(`@stryke/path/replace`),m=require(`@stryke/type-checks/is-set-object`),h=require(`@stryke/type-checks/is-string`),g=require(`@stryke/path/file-path-fns`),_=require(`@stryke/fs/exists`),v=require(`@stryke/hash/murmurhash`),y=require(`@stryke/helpers/get-unique`),b=require(`@stryke/path/is-parent-path`),x=require(`@stryke/path/is-type`),S=require(`flat-cache`),C=require(`@stryke/capnp`);C=e.__toESM(C);let w=require(`@stryke/fs/buffer`),T=require(`@stryke/string-format/pretty-bytes`),E=require(`@stryke/type-checks/is-regexp`),D=require(`node:buffer`),O=require(`node:url`),k=require(`prettier`);var A=class e{#e;#t;#n;#r={"":new a.FileSystemStorageAdapter};#i;#a=!1;#o;#s;#c(e){let t=e;return(0,b.isParentPath)(t,this.#o.builtinsPath)&&(t=(0,p.replacePath)(t,this.#o.builtinsPath)),i.normalizeId(t,this.#o.config.output.builtinPrefix)}#l(e){return i.normalizePath(e.includes(`{`)||e.includes(`}`)?t.replacePathTokens(this.#o,e):e,this.#o.builtinsPath,this.#o.config.output.builtinPrefix)}#u(e){let t=`::GLOBSTAR::`;return RegExp(`^${this.#l(e).replace(/\*\*/g,t).replace(/[.+^${}()|[\]\\]/g,`\\$&`).replace(/\*/g,`[^/]*`).replace(/\?/g,`[^/]`).replace(new RegExp(t,`g`),`.*`)}$`)}#d(e){let t=this.resolveSync(this.#l(e))||e;for(let e of Object.keys(this.#r).filter(Boolean).sort().reverse())if((0,b.isParentPath)(t,e))return{base:e,relativeKey:(0,p.replacePath)(t,e),adapter:this.#r[e]};return{base:``,relativeKey:t,adapter:this.#r[``]}}#f(e=``,t=!1){return Object.keys(this.#r).sort().reverse().filter(n=>(0,b.isParentPath)(n,e)||t&&(0,b.isParentPath)(e,n)).map(t=>({relativeBase:e.length>t.length?e.slice(t.length):void 0,base:t,adapter:this.#r[t]}))}static async create(t){if(!t.config.skipCache&&(0,_.existsSync)((0,u.joinPaths)(t.dataPath,`fs.bin`))){let r=await(0,w.readFileBuffer)((0,u.joinPaths)(t.dataPath,`fs.bin`)),i=new C.Message(r,!1).getRoot(n.FileSystem),a=new e(t,i);i._hasStorage()&&i.storage.length>0&&await Promise.all(i.storage.values().map(async e=>{await a.write(e.path,e.code)}))}return new e(t,new C.Message().initRoot(n.FileSystem))}static createSync(t){if(!t.config.skipCache&&(0,_.existsSync)((0,u.joinPaths)(t.dataPath,`fs.bin`))){let r=(0,w.readFileBufferSync)((0,u.joinPaths)(t.dataPath,`fs.bin`)),i=new C.Message(r,!1).getRoot(n.FileSystem),a=new e(t,i);i._hasStorage()&&i.storage.length>0&&i.storage.values().map(e=>{a.writeSync(e.path,e.code)})}return new e(t,new C.Message().initRoot(n.FileSystem))}get metadata(){return new Proxy(this.#e,{get:(e,t)=>e[this.#c(t)]})}get ids(){return new Proxy(this.#n,{get:(e,t)=>e[this.#l(t)]})}get paths(){return new Proxy(this.#n,{get:(e,t)=>e[this.#c(t)]})}get resolverCache(){return this.#i||=(0,S.create)({cacheId:`module-resolution`,cacheDir:this.#o.cachePath,ttl:3600*1e3,lruSize:5e3,persistInterval:100}),this.#i}constructor(e,t){this.#o=e,(0,m.isSetObject)(this.#o.config.output.storage)&&(this.#r={...this.#r,...this.#o.config.output.storage}),this.#r.virtual??=new o.VirtualStorageAdapter({base:`/_virtual`}),this.#o.config.output.storage!==`fs`&&(this.#r[this.#o.artifactsPath]??=new o.VirtualStorageAdapter({base:this.#o.artifactsPath}),this.#r[this.#o.builtinsPath]??=new o.VirtualStorageAdapter({base:this.#o.builtinsPath}),this.#r[this.#o.entryPath]??=new o.VirtualStorageAdapter({base:this.#o.entryPath})),this.#e={},t._hasMetadata()&&(this.#e=t.metadata.values().reduce((e,t)=>(e[t.id]={id:t.id,type:t.type,timestamp:t.timestamp||Date.now(),properties:t._hasProperties()?t.properties.values().reduce((e,t)=>(e[t.key]=t.value,e),{}):{}},e),{}),e.config.skipCache!==!0&&Object.entries(this.#e).filter(([,e])=>e.type===`entry`).forEach(([e,t])=>{this.#o.entry??=[],this.#o.entry.push({file:e,name:t.properties.name,output:t.properties.output,input:t.properties[`input.file`]?{file:t.properties[`input.file`],name:t.properties[`input.name`]}:void 0})})),this.#t={},this.#n={},t._hasIds()&&(this.#t=t.ids.values().reduce((e,t)=>(e[t.path]??=t.id,e),{}),this.#n=t.ids.values().reduce((e,t)=>(e[t.id]??=t.path,e),{})),this.#s=r.extendLog(this.#o.log,`file-system`)}async exists(e){let{relativeKey:t,adapter:n}=this.#d(e);return n.exists(t)}existsSync(e){let{relativeKey:t,adapter:n}=this.#d(e);return n.existsSync(t)}isVirtual(e){let t=this.resolveSync(e);return t?this.#d(t)?.adapter?.name===`virtual`:!1}isDirectorySync(e){let t=this.resolveSync(e);return t?!!(this.existsSync(t)&&this.#d(t)?.adapter?.isDirectorySync(t)):!1}async isDirectory(e){let t=await this.resolve(e);return t?!!(await this.exists(t)&&await this.#d(t)?.adapter?.isDirectory(t)):!1}isFileSync(e){let t=this.resolveSync(e);return t?this.#d(t)?.adapter?.isFileSync(t)??!1:!1}async isFile(e){let t=await this.resolve(e);return t?await this.#d(t)?.adapter?.isFile(t)??!1:!1}listSync(e){return(0,y.getUnique)(this.#f(e,!0).map(e=>e.adapter.listSync(e.relativeBase?e.base?(0,l.appendPath)(e.relativeBase,e.base):e.relativeBase:e.base)).flat())}async list(e){return(0,y.getUnique)((await Promise.all(this.#f(e,!0).map(async e=>e.adapter.list(e.relativeBase?e.base?(0,l.appendPath)(e.relativeBase,e.base):e.relativeBase:e.base)))).flat())}async remove(e){let t=this.#l(e);this.#s(s.LogLevelLabel.TRACE,`Removing file: ${t}`);let{relativeKey:n,adapter:r}=this.#d(t);(0,g.hasFileExtension)(t)?await r.remove(n):await r.clear(n);let i=this.#t[t];i&&this.#e[i]&&(delete this.#e[i],delete this.#t[t],delete this.#n[i])}removeSync(e){let t=this.#l(e);this.#s(s.LogLevelLabel.TRACE,`Removing file: ${t}`);let{relativeKey:n,adapter:r}=this.#d(t);(0,g.hasFileExtension)(t)?r.removeSync(n):r.clearSync(n);let i=this.#t[t];i&&this.#e[i]&&(delete this.#e[i],delete this.#t[t],delete this.#n[i])}async glob(e){let t=[];for(let n of i.normalizeGlobPatterns(this.#o.workspaceConfig.workspaceRoot,e)){let e=this.#l(n);if(!/[*?[\]{}]/.test(e)&&!e.includes(`**`)){if(this.isDirectorySync(e))t.push(...await this.list(e));else{let n=await this.resolve(e);n&&!t.includes(n)&&t.push(n)}continue}let r=(0,x.isAbsolutePath)(e)?e:this.#l((0,u.joinPaths)(this.#o.workspaceConfig.workspaceRoot,e)),i=r.search(/[*?[\]{}]/),a=i===-1?(0,g.findFilePath)(r):r.slice(0,Math.max(0,r.lastIndexOf(`/`,i)));await Promise.all((await this.list(a&&(0,x.isAbsolutePath)(a)?a:this.#o.workspaceConfig.workspaceRoot)).map(async e=>{if(this.#u(r).test(e)){let n=this.resolveSync(e);n&&!t.includes(n)&&t.push(n)}}))}return t}globSync(e){let t=[];for(let n of i.normalizeGlobPatterns(this.#o.workspaceConfig.workspaceRoot,e)){let e=this.#l(n);if(!/[*?[\]{}]/.test(e)&&!e.includes(`**`)){if(this.isDirectorySync(e))t.push(...this.listSync(e));else{let n=this.resolveSync(e);n&&!t.includes(n)&&t.push(n)}continue}let r=(0,x.isAbsolutePath)(e)?e:this.#l((0,u.joinPaths)(this.#o.workspaceConfig.workspaceRoot,e)),i=r.search(/[*?[\]{}]/),a=i===-1?(0,g.findFilePath)(r):r.slice(0,Math.max(0,r.lastIndexOf(`/`,i))),o=this.listSync(a&&(0,x.isAbsolutePath)(a)?a:this.#o.workspaceConfig.workspaceRoot);for(let e of o)if(this.#u(r).test(e)){let n=this.resolveSync(e);n&&!t.includes(n)&&t.push(n)}}return t}async copy(e,t){let n=e instanceof URL?(0,O.fileURLToPath)(e):e,r=t instanceof URL?(0,O.fileURLToPath)(t):t;if(!(0,d.isSetString)(n)&&(!(0,m.isSetObject)(n)||!(0,d.isSetString)(n.input))||!(0,d.isSetString)(r))return;let i=(0,h.isString)(n)?n:n.input?n.input:this.#o.workspaceConfig.workspaceRoot,a=await this.resolve(i);if(a)if(this.isDirectorySync(a)||(0,d.isSetString)(n)&&n.includes(`*`)||(0,m.isSetObject)(n)&&(0,d.isSetString)(n.glob))await Promise.all((await this.glob(n)).map(async e=>this.copy(e,(0,l.appendPath)((0,p.replacePath)(e,i),r))));else{let e=await this.read(a);e!==void 0&&await this.write(this.#l(r),e,{skipFormat:!0})}}copySync(e,t){let n=e instanceof URL?(0,O.fileURLToPath)(e):e,r=t instanceof URL?(0,O.fileURLToPath)(t):t;if(!(0,d.isSetString)(n)&&(!(0,m.isSetObject)(n)||!(0,d.isSetString)(n.input))||!(0,d.isSetString)(r))return;let i=(0,h.isString)(n)?n:n.input?n.input:this.#o.workspaceConfig.workspaceRoot,a=this.resolveSync(i);if(a)if(this.isDirectorySync(a)||(0,d.isSetString)(n)&&n.includes(`*`)||(0,m.isSetObject)(n)&&(0,d.isSetString)(n.glob))this.globSync(n).map(e=>this.copySync(e,(0,l.appendPath)((0,g.findFilePath)((0,p.replacePath)(e,i)),r)));else{let e=this.readSync(a);e!==void 0&&this.writeSync(this.#l((0,g.hasFileExtension)(r)?r:(0,l.appendPath)((0,g.findFileName)(a),r)),e,{skipFormat:!0})}}async move(e,t){(0,g.hasFileExtension)(e)?(await this.copy(e,t),await this.remove(e)):await Promise.all((await this.list(e)).map(async e=>{await this.copy(e,t),await this.remove(e)}))}moveSync(e,t){(0,g.hasFileExtension)(e)?(this.copySync(e,t),this.removeSync(e)):this.listSync(e).forEach(e=>{this.copySync(e,t),this.removeSync(e)})}async read(e){let t=await this.resolve(e);if(!t)return;let{relativeKey:n,adapter:r}=this.#d(t);return this.#s(s.LogLevelLabel.TRACE,`Reading ${r.name} file: ${t}`),await r.get(n)??void 0}readSync(e){let t=this.resolveSync(e);if(!t)return;let{relativeKey:n,adapter:r}=this.#d(t);return this.#s(s.LogLevelLabel.TRACE,`Reading ${r.name} file: ${t}`),r.getSync(n)??void 0}async write(e,t=``,n={}){let r=t;if(!n.skipFormat){let n=await(0,k.resolveConfig)(this.#l(e));n&&(r=await(0,k.format)(t,{absolutePath:this.#l(e),...n}))}let{relativeKey:i,adapter:a}=this.#d(e);this.#s(s.LogLevelLabel.TRACE,`Writing ${this.#l(i)} to ${a.name===`virtual`?`the virtual file system`:a.name===`file-system`?`the local file system`:a.name} (size: ${(0,T.prettyBytes)(new D.Blob((0,c.toArray)(r)).size)})`);let o=n?.meta?.id||this.#c(i);return this.#e[o]={variant:`normal`,timestamp:Date.now(),...n.meta??{}},this.#n[o]=this.#l(i),this.#t[this.#l(i)]=o,a.set(i,r)}writeSync(e,t=``,n={}){let{relativeKey:r,adapter:i}=this.#d(e);this.#s(s.LogLevelLabel.TRACE,`Writing ${this.#l(r)} file to ${i.name===`virtual`?`the virtual file system`:i.name===`file-system`?`the local file system`:i.name} (size: ${(0,T.prettyBytes)(new D.Blob((0,c.toArray)(t)).size)})`);let a=n?.meta?.id||this.#c(r);return this.#e[a]={variant:`normal`,timestamp:Date.now(),...n.meta??{}},this.#n[a]=this.#l(r),this.#t[this.#l(r)]=a,i.setSync(r,t)}mkdirSync(e){return this.#d(e)?.adapter?.mkdirSync(e)}async mkdir(e){return this.#d(e)?.adapter?.mkdir(e)}getMetadata(e){let t=this.resolveSync(e);if(t&&this.metadata[t])return this.metadata[t]}resolveAlias(e){let t=e;if(this.#o.config.build.alias){if(Array.isArray(this.#o.config.build.alias)&&this.#o.config.build.alias.length>0){let e=this.#o.config.build.alias.filter(e=>(0,d.isSetString)(e.find)&&(e.find===t||t.startsWith(`${e.find}/`))||(0,E.isRegExp)(e.find)&&e.find.test(t));if(e.length>0){let n=e.reduce((e,t)=>((0,d.isSetString)(e.find)?e.find.length:(0,E.isRegExp)(e.find)?e.find.source.length:0)>((0,d.isSetString)(t.find)?t.find.length:(0,E.isRegExp)(t.find)?t.find.source.length:0)?e:t);(0,d.isSetString)(n.find)?t=t.replace(RegExp(`^${n.find}`),n.replacement):(0,E.isRegExp)(n.find)&&(t=t.replace(n.find,n.replacement))}}else if((0,m.isSetObject)(this.#o.config.build.alias)){let e=Object.keys(this.#o.config.build.alias).filter(e=>e===t||t.startsWith(`${e}/`));if(e.length>0){let n=e.reduce((e,t)=>e.length>t.length?e:t);t=t.replace(RegExp(`^${n}`),this.#o.config.build.alias[n])}}}return t}async resolve(e,n,r={}){let i=e;if((i.includes(`{`)||i.includes(`}`))&&(i=t.replacePathTokens(this.#o,i)),r.skipAlias!==!0&&(i=this.resolveAlias(i)),(0,x.isAbsolutePath)(i))return i;let a=(0,v.murmurhash)({path:this.#c(i),importer:n,options:r}),o;if(!this.#o.config.skipCache&&(o=this.resolverCache.get(a),o))return o;if(o=this.paths[this.#c(i)],!o){let e=r.paths??[];n&&!e.includes(n)&&e.push(n),e.push(this.#o.workspaceConfig.workspaceRoot),e.push((0,l.appendPath)(this.#o.config.projectRoot,this.#o.workspaceConfig.workspaceRoot)),e.push((0,l.appendPath)(this.#o.config.sourceRoot,this.#o.workspaceConfig.workspaceRoot)),e.push(...Object.keys(this.#o.tsconfig?.options?.paths??{}).filter(e=>i.startsWith(e.replace(/\*$/,``))).map(e=>this.#o.tsconfig?.options?.paths?.[e]).flat().filter(Boolean).map(e=>(0,l.appendPath)(e,this.#o.workspaceConfig.workspaceRoot)));for(let t of(0,f.getResolutionCombinations)(i,{paths:e})){let{relativeKey:e,adapter:n}=this.#d(t);if(await n.exists(e)){o=t;break}}if(!o)try{o=await(0,f.resolve)(i,{...r,paths:e})}catch{}}return o&&!this.#o.config.skipCache&&this.resolverCache.set(a,o),o}resolveSync(e,n,r={}){let i=e;if((i.includes(`{`)||i.includes(`}`))&&(i=t.replacePathTokens(this.#o,i)),r.skipAlias!==!0&&(i=this.resolveAlias(i)),(0,x.isAbsolutePath)(i))return i;let a;if(!this.#o.config.skipCache&&(a=this.resolverCache.get(this.#c(i)),a))return a;if(a=this.paths[this.#c(i)],!a){let e=r.paths??[];n&&!e.includes(n)&&e.push(n),e.push(this.#o.workspaceConfig.workspaceRoot),e.push((0,l.appendPath)(this.#o.config.projectRoot,this.#o.workspaceConfig.workspaceRoot)),e.push((0,l.appendPath)(this.#o.config.sourceRoot,this.#o.workspaceConfig.workspaceRoot)),e.push(...Object.keys(this.#o.tsconfig?.options?.paths??{}).filter(e=>i.startsWith(e.replace(/\*$/,``))).map(e=>this.#o.tsconfig?.options?.paths?.[e]).flat().filter(Boolean).map(e=>(0,l.appendPath)(e,this.#o.workspaceConfig.workspaceRoot)));for(let t of(0,f.getResolutionCombinations)(i,{paths:e})){let{relativeKey:e,adapter:n}=this.#d(t);if(n.existsSync(e)){a=t;break}}if(!a)try{a=(0,f.resolveSync)(i,{...r,paths:e})}catch{}}return a&&!this.#o.config.skipCache&&this.resolverCache.set(this.#c(i),a),a}async dispose(){if(!this.#a){this.#a=!0,this.#s(s.LogLevelLabel.DEBUG,`Disposing virtual file system...`),await this.remove((0,u.joinPaths)(this.#o.dataPath,`fs.bin`));let e=new C.Message,t=e.initRoot(n.FileSystem),r=await this.list(),i=t._initStorage(r.length);await Promise.all(r.map(async(e,t)=>{let n=await this.read(e),r=i.get(t);r.path=e,r.code=n||``}));let a=t._initIds(Object.keys(this.ids).length);Object.entries(this.ids).filter(([,e])=>e).forEach(([e,t],n)=>{let r=a.get(n);r.id=e,r.path=t});let o=t._initMetadata(Object.keys(this.metadata).length);Object.entries(this.metadata).filter(([,e])=>e).forEach(([e,t],n)=>{let r=o.get(n);if(r.id=e,r.type=t.type,r.timestamp=t.timestamp??BigInt(Date.now()),t.properties){let e=r._initProperties(Object.keys(t.properties).length);Object.entries(t.properties).filter(([,e])=>(0,d.isSetString)(e)).forEach(([t,n],r)=>{let i=e.get(r);i.key=t,i.value=n})}}),await(0,w.writeFileBuffer)((0,u.joinPaths)(this.#o.dataPath,`fs.bin`),e.toArrayBuffer()),this.#o.config.skipCache||this.#i.save(!0),await Promise.all(this.#f().map(async e=>e.adapter.dispose())),this.#s(s.LogLevelLabel.TRACE,`Virtual file system has been disposed.`)}}async[Symbol.asyncDispose](){return this.dispose()}};exports.VirtualFileSystem=A;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{replacePathTokens as e}from"../../plugin-utils/paths.mjs";import{FileSystem as t}from"../../../schemas/fs.mjs";import{extendLog as n}from"../logger.mjs";import{normalizeGlobPatterns as r,normalizeId as i,normalizePath as a}from"./helpers.mjs";import{FileSystemStorageAdapter as o}from"./storage/file-system.mjs";import{VirtualStorageAdapter as s}from"./storage/virtual.mjs";import{LogLevelLabel as c}from"@storm-software/config-tools/types";import{toArray as l}from"@stryke/convert/to-array";import{appendPath as u}from"@stryke/path/append";import{joinPaths as d}from"@stryke/path/join-paths";import{isSetString as f}from"@stryke/type-checks/is-set-string";import{getResolutionCombinations as p,resolve as m,resolveSync as h}from"@stryke/fs/resolve";import{replacePath as g}from"@stryke/path/replace";import{isSetObject as _}from"@stryke/type-checks/is-set-object";import{isString as v}from"@stryke/type-checks/is-string";import{findFileName as y,findFilePath as b,hasFileExtension as x}from"@stryke/path/file-path-fns";import{existsSync as S}from"@stryke/fs/exists";import{murmurhash as C}from"@stryke/hash/murmurhash";import{getUnique as w}from"@stryke/helpers/get-unique";import{isParentPath as T}from"@stryke/path/is-parent-path";import{isAbsolutePath as E}from"@stryke/path/is-type";import{create as D}from"flat-cache";import*as O from"@stryke/capnp";import{readFileBuffer as k,readFileBufferSync as A,writeFileBuffer as j}from"@stryke/fs/buffer";import{prettyBytes as M}from"@stryke/string-format/pretty-bytes";import{Blob as N}from"node:buffer";import{fileURLToPath as P}from"node:url";import{format as F,resolveConfig as I}from"prettier";var L=class L{#e;#t;#n;#r={"":new o};#i;#a=!1;#o;#s;#c(e){let t=e;return T(t,this.#o.builtinsPath)&&(t=g(t,this.#o.builtinsPath)),i(t,this.#o.config.output.builtinPrefix)}#l(t){return a(t.includes(`{`)||t.includes(`}`)?e(this.#o,t):t,this.#o.builtinsPath,this.#o.config.output.builtinPrefix)}#u(e){let t=`::GLOBSTAR::`;return RegExp(`^${this.#l(e).replace(/\*\*/g,t).replace(/[.+^${}()|[\]\\]/g,`\\$&`).replace(/\*/g,`[^/]*`).replace(/\?/g,`[^/]`).replace(new RegExp(t,`g`),`.*`)}$`)}#d(e){let t=this.resolveSync(this.#l(e))||e;for(let e of Object.keys(this.#r).filter(Boolean).sort().reverse())if(T(t,e))return{base:e,relativeKey:g(t,e),adapter:this.#r[e]};return{base:``,relativeKey:t,adapter:this.#r[``]}}#f(e=``,t=!1){return Object.keys(this.#r).sort().reverse().filter(n=>T(n,e)||t&&T(e,n)).map(t=>({relativeBase:e.length>t.length?e.slice(t.length):void 0,base:t,adapter:this.#r[t]}))}static async create(e){if(!e.config.skipCache&&S(d(e.dataPath,`fs.bin`))){let n=await k(d(e.dataPath,`fs.bin`)),r=new O.Message(n,!1).getRoot(t),i=new L(e,r);r._hasStorage()&&r.storage.length>0&&await Promise.all(r.storage.values().map(async e=>{await i.write(e.path,e.code)}))}return new L(e,new O.Message().initRoot(t))}static createSync(e){if(!e.config.skipCache&&S(d(e.dataPath,`fs.bin`))){let n=A(d(e.dataPath,`fs.bin`)),r=new O.Message(n,!1).getRoot(t),i=new L(e,r);r._hasStorage()&&r.storage.length>0&&r.storage.values().map(e=>{i.writeSync(e.path,e.code)})}return new L(e,new O.Message().initRoot(t))}get metadata(){return new Proxy(this.#e,{get:(e,t)=>e[this.#c(t)]})}get ids(){return new Proxy(this.#n,{get:(e,t)=>e[this.#l(t)]})}get paths(){return new Proxy(this.#n,{get:(e,t)=>e[this.#c(t)]})}get resolverCache(){return this.#i||=D({cacheId:`module-resolution`,cacheDir:this.#o.cachePath,ttl:3600*1e3,lruSize:5e3,persistInterval:100}),this.#i}constructor(e,t){this.#o=e,_(this.#o.config.output.storage)&&(this.#r={...this.#r,...this.#o.config.output.storage}),this.#r.virtual??=new s({base:`/_virtual`}),this.#o.config.output.storage!==`fs`&&(this.#r[this.#o.artifactsPath]??=new s({base:this.#o.artifactsPath}),this.#r[this.#o.builtinsPath]??=new s({base:this.#o.builtinsPath}),this.#r[this.#o.entryPath]??=new s({base:this.#o.entryPath})),this.#e={},t._hasMetadata()&&(this.#e=t.metadata.values().reduce((e,t)=>(e[t.id]={id:t.id,type:t.type,timestamp:t.timestamp||Date.now(),properties:t._hasProperties()?t.properties.values().reduce((e,t)=>(e[t.key]=t.value,e),{}):{}},e),{}),e.config.skipCache!==!0&&Object.entries(this.#e).filter(([,e])=>e.type===`entry`).forEach(([e,t])=>{this.#o.entry??=[],this.#o.entry.push({file:e,name:t.properties.name,output:t.properties.output,input:t.properties[`input.file`]?{file:t.properties[`input.file`],name:t.properties[`input.name`]}:void 0})})),this.#t={},this.#n={},t._hasIds()&&(this.#t=t.ids.values().reduce((e,t)=>(e[t.path]??=t.id,e),{}),this.#n=t.ids.values().reduce((e,t)=>(e[t.id]??=t.path,e),{})),this.#s=n(this.#o.log,`file-system`)}async exists(e){let{relativeKey:t,adapter:n}=this.#d(e);return n.exists(t)}existsSync(e){let{relativeKey:t,adapter:n}=this.#d(e);return n.existsSync(t)}isVirtual(e){let t=this.resolveSync(e);return t?this.#d(t)?.adapter?.name===`virtual`:!1}isDirectorySync(e){let t=this.resolveSync(e);return t?!!(this.existsSync(t)&&this.#d(t)?.adapter?.isDirectorySync(t)):!1}async isDirectory(e){let t=await this.resolve(e);return t?!!(await this.exists(t)&&await this.#d(t)?.adapter?.isDirectory(t)):!1}isFileSync(e){let t=this.resolveSync(e);return t?this.#d(t)?.adapter?.isFileSync(t)??!1:!1}async isFile(e){let t=await this.resolve(e);return t?await this.#d(t)?.adapter?.isFile(t)??!1:!1}listSync(e){return w(this.#f(e,!0).map(e=>e.adapter.listSync(e.relativeBase?e.base?u(e.relativeBase,e.base):e.relativeBase:e.base)).flat())}async list(e){return w((await Promise.all(this.#f(e,!0).map(async e=>e.adapter.list(e.relativeBase?e.base?u(e.relativeBase,e.base):e.relativeBase:e.base)))).flat())}async remove(e){let t=this.#l(e);this.#s(c.TRACE,`Removing file: ${t}`);let{relativeKey:n,adapter:r}=this.#d(t);x(t)?await r.remove(n):await r.clear(n);let i=this.#t[t];i&&this.#e[i]&&(delete this.#e[i],delete this.#t[t],delete this.#n[i])}removeSync(e){let t=this.#l(e);this.#s(c.TRACE,`Removing file: ${t}`);let{relativeKey:n,adapter:r}=this.#d(t);x(t)?r.removeSync(n):r.clearSync(n);let i=this.#t[t];i&&this.#e[i]&&(delete this.#e[i],delete this.#t[t],delete this.#n[i])}async glob(e){let t=[];for(let n of r(this.#o.workspaceConfig.workspaceRoot,e)){let e=this.#l(n);if(!/[*?[\]{}]/.test(e)&&!e.includes(`**`)){if(this.isDirectorySync(e))t.push(...await this.list(e));else{let n=await this.resolve(e);n&&!t.includes(n)&&t.push(n)}continue}let r=E(e)?e:this.#l(d(this.#o.workspaceConfig.workspaceRoot,e)),i=r.search(/[*?[\]{}]/),a=i===-1?b(r):r.slice(0,Math.max(0,r.lastIndexOf(`/`,i)));await Promise.all((await this.list(a&&E(a)?a:this.#o.workspaceConfig.workspaceRoot)).map(async e=>{if(this.#u(r).test(e)){let n=this.resolveSync(e);n&&!t.includes(n)&&t.push(n)}}))}return t}globSync(e){let t=[];for(let n of r(this.#o.workspaceConfig.workspaceRoot,e)){let e=this.#l(n);if(!/[*?[\]{}]/.test(e)&&!e.includes(`**`)){if(this.isDirectorySync(e))t.push(...this.listSync(e));else{let n=this.resolveSync(e);n&&!t.includes(n)&&t.push(n)}continue}let r=E(e)?e:this.#l(d(this.#o.workspaceConfig.workspaceRoot,e)),i=r.search(/[*?[\]{}]/),a=i===-1?b(r):r.slice(0,Math.max(0,r.lastIndexOf(`/`,i))),o=this.listSync(a&&E(a)?a:this.#o.workspaceConfig.workspaceRoot);for(let e of o)if(this.#u(r).test(e)){let n=this.resolveSync(e);n&&!t.includes(n)&&t.push(n)}}return t}async copy(e,t){let n=e instanceof URL?P(e):e,r=t instanceof URL?P(t):t;if(!f(n)&&(!_(n)||!f(n.input))||!f(r))return;let i=v(n)?n:n.input?n.input:this.#o.workspaceConfig.workspaceRoot,a=await this.resolve(i);if(a)if(this.isDirectorySync(a)||f(n)&&n.includes(`*`)||_(n)&&f(n.glob))await Promise.all((await this.glob(n)).map(async e=>this.copy(e,u(g(e,i),r))));else{let e=await this.read(a);e!==void 0&&await this.write(this.#l(r),e,{skipFormat:!0})}}copySync(e,t){let n=e instanceof URL?P(e):e,r=t instanceof URL?P(t):t;if(!f(n)&&(!_(n)||!f(n.input))||!f(r))return;let i=v(n)?n:n.input?n.input:this.#o.workspaceConfig.workspaceRoot,a=this.resolveSync(i);if(a)if(this.isDirectorySync(a)||f(n)&&n.includes(`*`)||_(n)&&f(n.glob))this.globSync(n).map(e=>this.copySync(e,u(b(g(e,i)),r)));else{let e=this.readSync(a);e!==void 0&&this.writeSync(this.#l(x(r)?r:u(y(a),r)),e,{skipFormat:!0})}}async move(e,t){x(e)?(await this.copy(e,t),await this.remove(e)):await Promise.all((await this.list(e)).map(async e=>{await this.copy(e,t),await this.remove(e)}))}moveSync(e,t){x(e)?(this.copySync(e,t),this.removeSync(e)):this.listSync(e).forEach(e=>{this.copySync(e,t),this.removeSync(e)})}async read(e){let t=await this.resolve(e);if(!t)return;let{relativeKey:n,adapter:r}=this.#d(t);return this.#s(c.TRACE,`Reading ${r.name} file: ${t}`),await r.get(n)??void 0}readSync(e){let t=this.resolveSync(e);if(!t)return;let{relativeKey:n,adapter:r}=this.#d(t);return this.#s(c.TRACE,`Reading ${r.name} file: ${t}`),r.getSync(n)??void 0}async write(e,t=``,n={}){let r=t;if(!n.skipFormat){let n=await I(this.#l(e));n&&(r=await F(t,{absolutePath:this.#l(e),...n}))}let{relativeKey:i,adapter:a}=this.#d(e);this.#s(c.TRACE,`Writing ${this.#l(i)} to ${a.name===`virtual`?`the virtual file system`:a.name===`file-system`?`the local file system`:a.name} (size: ${M(new N(l(r)).size)})`);let o=n?.meta?.id||this.#c(i);return this.#e[o]={variant:`normal`,timestamp:Date.now(),...n.meta??{}},this.#n[o]=this.#l(i),this.#t[this.#l(i)]=o,a.set(i,r)}writeSync(e,t=``,n={}){let{relativeKey:r,adapter:i}=this.#d(e);this.#s(c.TRACE,`Writing ${this.#l(r)} file to ${i.name===`virtual`?`the virtual file system`:i.name===`file-system`?`the local file system`:i.name} (size: ${M(new N(l(t)).size)})`);let a=n?.meta?.id||this.#c(r);return this.#e[a]={variant:`normal`,timestamp:Date.now(),...n.meta??{}},this.#n[a]=this.#l(r),this.#t[this.#l(r)]=a,i.setSync(r,t)}mkdirSync(e){return this.#d(e)?.adapter?.mkdirSync(e)}async mkdir(e){return this.#d(e)?.adapter?.mkdir(e)}getMetadata(e){let t=this.resolveSync(e);if(t&&this.metadata[t])return this.metadata[t]}async resolve(t,n,r={}){let i=t;if((i.includes(`{`)||i.includes(`}`))&&(i=e(this.#o,i)),E(i))return i;let a=C({path:this.#c(i),importer:n,options:r}),o;if(!this.#o.config.skipCache&&(o=this.resolverCache.get(a),o))return o;if(o=this.paths[this.#c(i)],!o){let e=r.paths??[];n&&!e.includes(n)&&e.push(n),e.push(this.#o.workspaceConfig.workspaceRoot),e.push(u(this.#o.config.projectRoot,this.#o.workspaceConfig.workspaceRoot)),e.push(u(this.#o.config.sourceRoot,this.#o.workspaceConfig.workspaceRoot)),e.push(...Object.keys(this.#o.tsconfig?.options?.paths??{}).filter(e=>i.startsWith(e.replace(/\*$/,``))).map(e=>this.#o.tsconfig?.options?.paths?.[e]).flat().filter(Boolean).map(e=>u(e,this.#o.workspaceConfig.workspaceRoot)));for(let t of p(i,{paths:e})){let{relativeKey:e,adapter:n}=this.#d(t);if(await n.exists(e)){o=t;break}}if(!o)try{o=await m(i,{...r,paths:e})}catch{}}return o&&!this.#o.config.skipCache&&this.resolverCache.set(a,o),o}resolveSync(t,n,r={}){let i=t;if((i.includes(`{`)||i.includes(`}`))&&(i=e(this.#o,i)),E(i))return i;let a;if(!this.#o.config.skipCache&&(a=this.resolverCache.get(this.#c(i)),a))return a;if(a=this.paths[this.#c(i)],!a){let e=r.paths??[];n&&!e.includes(n)&&e.push(n),e.push(this.#o.workspaceConfig.workspaceRoot),e.push(u(this.#o.config.projectRoot,this.#o.workspaceConfig.workspaceRoot)),e.push(u(this.#o.config.sourceRoot,this.#o.workspaceConfig.workspaceRoot)),e.push(...Object.keys(this.#o.tsconfig?.options?.paths??{}).filter(e=>i.startsWith(e.replace(/\*$/,``))).map(e=>this.#o.tsconfig?.options?.paths?.[e]).flat().filter(Boolean).map(e=>u(e,this.#o.workspaceConfig.workspaceRoot)));for(let t of p(i,{paths:e})){let{relativeKey:e,adapter:n}=this.#d(t);if(n.existsSync(e)){a=t;break}}if(!a)try{a=h(i,{...r,paths:e})}catch{}}return a&&!this.#o.config.skipCache&&this.resolverCache.set(this.#c(i),a),a}async dispose(){if(!this.#a){this.#a=!0,this.#s(c.DEBUG,`Disposing virtual file system...`),await this.remove(d(this.#o.dataPath,`fs.bin`));let e=new O.Message,n=e.initRoot(t),r=await this.list(),i=n._initStorage(r.length);await Promise.all(r.map(async(e,t)=>{let n=await this.read(e),r=i.get(t);r.path=e,r.code=n||``}));let a=n._initIds(Object.keys(this.ids).length);Object.entries(this.ids).filter(([,e])=>e).forEach(([e,t],n)=>{let r=a.get(n);r.id=e,r.path=t});let o=n._initMetadata(Object.keys(this.metadata).length);Object.entries(this.metadata).filter(([,e])=>e).forEach(([e,t],n)=>{let r=o.get(n);if(r.id=e,r.type=t.type,r.timestamp=t.timestamp??BigInt(Date.now()),t.properties){let e=r._initProperties(Object.keys(t.properties).length);Object.entries(t.properties).filter(([,e])=>f(e)).forEach(([t,n],r)=>{let i=e.get(r);i.key=t,i.value=n})}}),await j(d(this.#o.dataPath,`fs.bin`),e.toArrayBuffer()),this.#o.config.skipCache||this.#i.save(!0),await Promise.all(this.#f().map(async e=>e.adapter.dispose())),this.#s(c.TRACE,`Virtual file system has been disposed.`)}}async[Symbol.asyncDispose](){return this.dispose()}};export{L as VirtualFileSystem};
|
|
1
|
+
import{replacePathTokens as e}from"../../plugin-utils/paths.mjs";import{FileSystem as t}from"../../../schemas/fs.mjs";import{extendLog as n}from"../logger.mjs";import{normalizeGlobPatterns as r,normalizeId as i,normalizePath as a}from"./helpers.mjs";import{FileSystemStorageAdapter as o}from"./storage/file-system.mjs";import{VirtualStorageAdapter as s}from"./storage/virtual.mjs";import{LogLevelLabel as c}from"@storm-software/config-tools/types";import{toArray as l}from"@stryke/convert/to-array";import{appendPath as u}from"@stryke/path/append";import{joinPaths as d}from"@stryke/path/join-paths";import{isSetString as f}from"@stryke/type-checks/is-set-string";import{getResolutionCombinations as p,resolve as m,resolveSync as h}from"@stryke/fs/resolve";import{replacePath as g}from"@stryke/path/replace";import{isSetObject as _}from"@stryke/type-checks/is-set-object";import{isString as v}from"@stryke/type-checks/is-string";import{findFileName as y,findFilePath as b,hasFileExtension as x}from"@stryke/path/file-path-fns";import{existsSync as S}from"@stryke/fs/exists";import{murmurhash as C}from"@stryke/hash/murmurhash";import{getUnique as w}from"@stryke/helpers/get-unique";import{isParentPath as T}from"@stryke/path/is-parent-path";import{isAbsolutePath as E}from"@stryke/path/is-type";import{create as D}from"flat-cache";import*as O from"@stryke/capnp";import{readFileBuffer as k,readFileBufferSync as A,writeFileBuffer as j}from"@stryke/fs/buffer";import{prettyBytes as M}from"@stryke/string-format/pretty-bytes";import{isRegExp as N}from"@stryke/type-checks/is-regexp";import{Blob as P}from"node:buffer";import{fileURLToPath as F}from"node:url";import{format as I,resolveConfig as L}from"prettier";var R=class R{#e;#t;#n;#r={"":new o};#i;#a=!1;#o;#s;#c(e){let t=e;return T(t,this.#o.builtinsPath)&&(t=g(t,this.#o.builtinsPath)),i(t,this.#o.config.output.builtinPrefix)}#l(t){return a(t.includes(`{`)||t.includes(`}`)?e(this.#o,t):t,this.#o.builtinsPath,this.#o.config.output.builtinPrefix)}#u(e){let t=`::GLOBSTAR::`;return RegExp(`^${this.#l(e).replace(/\*\*/g,t).replace(/[.+^${}()|[\]\\]/g,`\\$&`).replace(/\*/g,`[^/]*`).replace(/\?/g,`[^/]`).replace(new RegExp(t,`g`),`.*`)}$`)}#d(e){let t=this.resolveSync(this.#l(e))||e;for(let e of Object.keys(this.#r).filter(Boolean).sort().reverse())if(T(t,e))return{base:e,relativeKey:g(t,e),adapter:this.#r[e]};return{base:``,relativeKey:t,adapter:this.#r[``]}}#f(e=``,t=!1){return Object.keys(this.#r).sort().reverse().filter(n=>T(n,e)||t&&T(e,n)).map(t=>({relativeBase:e.length>t.length?e.slice(t.length):void 0,base:t,adapter:this.#r[t]}))}static async create(e){if(!e.config.skipCache&&S(d(e.dataPath,`fs.bin`))){let n=await k(d(e.dataPath,`fs.bin`)),r=new O.Message(n,!1).getRoot(t),i=new R(e,r);r._hasStorage()&&r.storage.length>0&&await Promise.all(r.storage.values().map(async e=>{await i.write(e.path,e.code)}))}return new R(e,new O.Message().initRoot(t))}static createSync(e){if(!e.config.skipCache&&S(d(e.dataPath,`fs.bin`))){let n=A(d(e.dataPath,`fs.bin`)),r=new O.Message(n,!1).getRoot(t),i=new R(e,r);r._hasStorage()&&r.storage.length>0&&r.storage.values().map(e=>{i.writeSync(e.path,e.code)})}return new R(e,new O.Message().initRoot(t))}get metadata(){return new Proxy(this.#e,{get:(e,t)=>e[this.#c(t)]})}get ids(){return new Proxy(this.#n,{get:(e,t)=>e[this.#l(t)]})}get paths(){return new Proxy(this.#n,{get:(e,t)=>e[this.#c(t)]})}get resolverCache(){return this.#i||=D({cacheId:`module-resolution`,cacheDir:this.#o.cachePath,ttl:3600*1e3,lruSize:5e3,persistInterval:100}),this.#i}constructor(e,t){this.#o=e,_(this.#o.config.output.storage)&&(this.#r={...this.#r,...this.#o.config.output.storage}),this.#r.virtual??=new s({base:`/_virtual`}),this.#o.config.output.storage!==`fs`&&(this.#r[this.#o.artifactsPath]??=new s({base:this.#o.artifactsPath}),this.#r[this.#o.builtinsPath]??=new s({base:this.#o.builtinsPath}),this.#r[this.#o.entryPath]??=new s({base:this.#o.entryPath})),this.#e={},t._hasMetadata()&&(this.#e=t.metadata.values().reduce((e,t)=>(e[t.id]={id:t.id,type:t.type,timestamp:t.timestamp||Date.now(),properties:t._hasProperties()?t.properties.values().reduce((e,t)=>(e[t.key]=t.value,e),{}):{}},e),{}),e.config.skipCache!==!0&&Object.entries(this.#e).filter(([,e])=>e.type===`entry`).forEach(([e,t])=>{this.#o.entry??=[],this.#o.entry.push({file:e,name:t.properties.name,output:t.properties.output,input:t.properties[`input.file`]?{file:t.properties[`input.file`],name:t.properties[`input.name`]}:void 0})})),this.#t={},this.#n={},t._hasIds()&&(this.#t=t.ids.values().reduce((e,t)=>(e[t.path]??=t.id,e),{}),this.#n=t.ids.values().reduce((e,t)=>(e[t.id]??=t.path,e),{})),this.#s=n(this.#o.log,`file-system`)}async exists(e){let{relativeKey:t,adapter:n}=this.#d(e);return n.exists(t)}existsSync(e){let{relativeKey:t,adapter:n}=this.#d(e);return n.existsSync(t)}isVirtual(e){let t=this.resolveSync(e);return t?this.#d(t)?.adapter?.name===`virtual`:!1}isDirectorySync(e){let t=this.resolveSync(e);return t?!!(this.existsSync(t)&&this.#d(t)?.adapter?.isDirectorySync(t)):!1}async isDirectory(e){let t=await this.resolve(e);return t?!!(await this.exists(t)&&await this.#d(t)?.adapter?.isDirectory(t)):!1}isFileSync(e){let t=this.resolveSync(e);return t?this.#d(t)?.adapter?.isFileSync(t)??!1:!1}async isFile(e){let t=await this.resolve(e);return t?await this.#d(t)?.adapter?.isFile(t)??!1:!1}listSync(e){return w(this.#f(e,!0).map(e=>e.adapter.listSync(e.relativeBase?e.base?u(e.relativeBase,e.base):e.relativeBase:e.base)).flat())}async list(e){return w((await Promise.all(this.#f(e,!0).map(async e=>e.adapter.list(e.relativeBase?e.base?u(e.relativeBase,e.base):e.relativeBase:e.base)))).flat())}async remove(e){let t=this.#l(e);this.#s(c.TRACE,`Removing file: ${t}`);let{relativeKey:n,adapter:r}=this.#d(t);x(t)?await r.remove(n):await r.clear(n);let i=this.#t[t];i&&this.#e[i]&&(delete this.#e[i],delete this.#t[t],delete this.#n[i])}removeSync(e){let t=this.#l(e);this.#s(c.TRACE,`Removing file: ${t}`);let{relativeKey:n,adapter:r}=this.#d(t);x(t)?r.removeSync(n):r.clearSync(n);let i=this.#t[t];i&&this.#e[i]&&(delete this.#e[i],delete this.#t[t],delete this.#n[i])}async glob(e){let t=[];for(let n of r(this.#o.workspaceConfig.workspaceRoot,e)){let e=this.#l(n);if(!/[*?[\]{}]/.test(e)&&!e.includes(`**`)){if(this.isDirectorySync(e))t.push(...await this.list(e));else{let n=await this.resolve(e);n&&!t.includes(n)&&t.push(n)}continue}let r=E(e)?e:this.#l(d(this.#o.workspaceConfig.workspaceRoot,e)),i=r.search(/[*?[\]{}]/),a=i===-1?b(r):r.slice(0,Math.max(0,r.lastIndexOf(`/`,i)));await Promise.all((await this.list(a&&E(a)?a:this.#o.workspaceConfig.workspaceRoot)).map(async e=>{if(this.#u(r).test(e)){let n=this.resolveSync(e);n&&!t.includes(n)&&t.push(n)}}))}return t}globSync(e){let t=[];for(let n of r(this.#o.workspaceConfig.workspaceRoot,e)){let e=this.#l(n);if(!/[*?[\]{}]/.test(e)&&!e.includes(`**`)){if(this.isDirectorySync(e))t.push(...this.listSync(e));else{let n=this.resolveSync(e);n&&!t.includes(n)&&t.push(n)}continue}let r=E(e)?e:this.#l(d(this.#o.workspaceConfig.workspaceRoot,e)),i=r.search(/[*?[\]{}]/),a=i===-1?b(r):r.slice(0,Math.max(0,r.lastIndexOf(`/`,i))),o=this.listSync(a&&E(a)?a:this.#o.workspaceConfig.workspaceRoot);for(let e of o)if(this.#u(r).test(e)){let n=this.resolveSync(e);n&&!t.includes(n)&&t.push(n)}}return t}async copy(e,t){let n=e instanceof URL?F(e):e,r=t instanceof URL?F(t):t;if(!f(n)&&(!_(n)||!f(n.input))||!f(r))return;let i=v(n)?n:n.input?n.input:this.#o.workspaceConfig.workspaceRoot,a=await this.resolve(i);if(a)if(this.isDirectorySync(a)||f(n)&&n.includes(`*`)||_(n)&&f(n.glob))await Promise.all((await this.glob(n)).map(async e=>this.copy(e,u(g(e,i),r))));else{let e=await this.read(a);e!==void 0&&await this.write(this.#l(r),e,{skipFormat:!0})}}copySync(e,t){let n=e instanceof URL?F(e):e,r=t instanceof URL?F(t):t;if(!f(n)&&(!_(n)||!f(n.input))||!f(r))return;let i=v(n)?n:n.input?n.input:this.#o.workspaceConfig.workspaceRoot,a=this.resolveSync(i);if(a)if(this.isDirectorySync(a)||f(n)&&n.includes(`*`)||_(n)&&f(n.glob))this.globSync(n).map(e=>this.copySync(e,u(b(g(e,i)),r)));else{let e=this.readSync(a);e!==void 0&&this.writeSync(this.#l(x(r)?r:u(y(a),r)),e,{skipFormat:!0})}}async move(e,t){x(e)?(await this.copy(e,t),await this.remove(e)):await Promise.all((await this.list(e)).map(async e=>{await this.copy(e,t),await this.remove(e)}))}moveSync(e,t){x(e)?(this.copySync(e,t),this.removeSync(e)):this.listSync(e).forEach(e=>{this.copySync(e,t),this.removeSync(e)})}async read(e){let t=await this.resolve(e);if(!t)return;let{relativeKey:n,adapter:r}=this.#d(t);return this.#s(c.TRACE,`Reading ${r.name} file: ${t}`),await r.get(n)??void 0}readSync(e){let t=this.resolveSync(e);if(!t)return;let{relativeKey:n,adapter:r}=this.#d(t);return this.#s(c.TRACE,`Reading ${r.name} file: ${t}`),r.getSync(n)??void 0}async write(e,t=``,n={}){let r=t;if(!n.skipFormat){let n=await L(this.#l(e));n&&(r=await I(t,{absolutePath:this.#l(e),...n}))}let{relativeKey:i,adapter:a}=this.#d(e);this.#s(c.TRACE,`Writing ${this.#l(i)} to ${a.name===`virtual`?`the virtual file system`:a.name===`file-system`?`the local file system`:a.name} (size: ${M(new P(l(r)).size)})`);let o=n?.meta?.id||this.#c(i);return this.#e[o]={variant:`normal`,timestamp:Date.now(),...n.meta??{}},this.#n[o]=this.#l(i),this.#t[this.#l(i)]=o,a.set(i,r)}writeSync(e,t=``,n={}){let{relativeKey:r,adapter:i}=this.#d(e);this.#s(c.TRACE,`Writing ${this.#l(r)} file to ${i.name===`virtual`?`the virtual file system`:i.name===`file-system`?`the local file system`:i.name} (size: ${M(new P(l(t)).size)})`);let a=n?.meta?.id||this.#c(r);return this.#e[a]={variant:`normal`,timestamp:Date.now(),...n.meta??{}},this.#n[a]=this.#l(r),this.#t[this.#l(r)]=a,i.setSync(r,t)}mkdirSync(e){return this.#d(e)?.adapter?.mkdirSync(e)}async mkdir(e){return this.#d(e)?.adapter?.mkdir(e)}getMetadata(e){let t=this.resolveSync(e);if(t&&this.metadata[t])return this.metadata[t]}resolveAlias(e){let t=e;if(this.#o.config.build.alias){if(Array.isArray(this.#o.config.build.alias)&&this.#o.config.build.alias.length>0){let e=this.#o.config.build.alias.filter(e=>f(e.find)&&(e.find===t||t.startsWith(`${e.find}/`))||N(e.find)&&e.find.test(t));if(e.length>0){let n=e.reduce((e,t)=>(f(e.find)?e.find.length:N(e.find)?e.find.source.length:0)>(f(t.find)?t.find.length:N(t.find)?t.find.source.length:0)?e:t);f(n.find)?t=t.replace(RegExp(`^${n.find}`),n.replacement):N(n.find)&&(t=t.replace(n.find,n.replacement))}}else if(_(this.#o.config.build.alias)){let e=Object.keys(this.#o.config.build.alias).filter(e=>e===t||t.startsWith(`${e}/`));if(e.length>0){let n=e.reduce((e,t)=>e.length>t.length?e:t);t=t.replace(RegExp(`^${n}`),this.#o.config.build.alias[n])}}}return t}async resolve(t,n,r={}){let i=t;if((i.includes(`{`)||i.includes(`}`))&&(i=e(this.#o,i)),r.skipAlias!==!0&&(i=this.resolveAlias(i)),E(i))return i;let a=C({path:this.#c(i),importer:n,options:r}),o;if(!this.#o.config.skipCache&&(o=this.resolverCache.get(a),o))return o;if(o=this.paths[this.#c(i)],!o){let e=r.paths??[];n&&!e.includes(n)&&e.push(n),e.push(this.#o.workspaceConfig.workspaceRoot),e.push(u(this.#o.config.projectRoot,this.#o.workspaceConfig.workspaceRoot)),e.push(u(this.#o.config.sourceRoot,this.#o.workspaceConfig.workspaceRoot)),e.push(...Object.keys(this.#o.tsconfig?.options?.paths??{}).filter(e=>i.startsWith(e.replace(/\*$/,``))).map(e=>this.#o.tsconfig?.options?.paths?.[e]).flat().filter(Boolean).map(e=>u(e,this.#o.workspaceConfig.workspaceRoot)));for(let t of p(i,{paths:e})){let{relativeKey:e,adapter:n}=this.#d(t);if(await n.exists(e)){o=t;break}}if(!o)try{o=await m(i,{...r,paths:e})}catch{}}return o&&!this.#o.config.skipCache&&this.resolverCache.set(a,o),o}resolveSync(t,n,r={}){let i=t;if((i.includes(`{`)||i.includes(`}`))&&(i=e(this.#o,i)),r.skipAlias!==!0&&(i=this.resolveAlias(i)),E(i))return i;let a;if(!this.#o.config.skipCache&&(a=this.resolverCache.get(this.#c(i)),a))return a;if(a=this.paths[this.#c(i)],!a){let e=r.paths??[];n&&!e.includes(n)&&e.push(n),e.push(this.#o.workspaceConfig.workspaceRoot),e.push(u(this.#o.config.projectRoot,this.#o.workspaceConfig.workspaceRoot)),e.push(u(this.#o.config.sourceRoot,this.#o.workspaceConfig.workspaceRoot)),e.push(...Object.keys(this.#o.tsconfig?.options?.paths??{}).filter(e=>i.startsWith(e.replace(/\*$/,``))).map(e=>this.#o.tsconfig?.options?.paths?.[e]).flat().filter(Boolean).map(e=>u(e,this.#o.workspaceConfig.workspaceRoot)));for(let t of p(i,{paths:e})){let{relativeKey:e,adapter:n}=this.#d(t);if(n.existsSync(e)){a=t;break}}if(!a)try{a=h(i,{...r,paths:e})}catch{}}return a&&!this.#o.config.skipCache&&this.resolverCache.set(this.#c(i),a),a}async dispose(){if(!this.#a){this.#a=!0,this.#s(c.DEBUG,`Disposing virtual file system...`),await this.remove(d(this.#o.dataPath,`fs.bin`));let e=new O.Message,n=e.initRoot(t),r=await this.list(),i=n._initStorage(r.length);await Promise.all(r.map(async(e,t)=>{let n=await this.read(e),r=i.get(t);r.path=e,r.code=n||``}));let a=n._initIds(Object.keys(this.ids).length);Object.entries(this.ids).filter(([,e])=>e).forEach(([e,t],n)=>{let r=a.get(n);r.id=e,r.path=t});let o=n._initMetadata(Object.keys(this.metadata).length);Object.entries(this.metadata).filter(([,e])=>e).forEach(([e,t],n)=>{let r=o.get(n);if(r.id=e,r.type=t.type,r.timestamp=t.timestamp??BigInt(Date.now()),t.properties){let e=r._initProperties(Object.keys(t.properties).length);Object.entries(t.properties).filter(([,e])=>f(e)).forEach(([t,n],r)=>{let i=e.get(r);i.key=t,i.value=n})}}),await j(d(this.#o.dataPath,`fs.bin`),e.toArrayBuffer()),this.#o.config.skipCache||this.#i.save(!0),await Promise.all(this.#f().map(async e=>e.adapter.dispose())),this.#s(c.TRACE,`Virtual file system has been disposed.`)}}async[Symbol.asyncDispose](){return this.dispose()}};export{R as VirtualFileSystem};
|
|
@@ -217,6 +217,10 @@ interface ResolveOptions$1 extends ResolveOptions {
|
|
|
217
217
|
* If true, the module is being resolved as an entry point.
|
|
218
218
|
*/
|
|
219
219
|
isEntry?: boolean;
|
|
220
|
+
/**
|
|
221
|
+
* If true, the resolver will skip alias resolution when resolving modules.
|
|
222
|
+
*/
|
|
223
|
+
skipAlias?: boolean;
|
|
220
224
|
/**
|
|
221
225
|
* If true, the resolver will skip using the cache when resolving modules.
|
|
222
226
|
*/
|
|
@@ -449,6 +453,16 @@ interface VirtualFileSystemInterface {
|
|
|
449
453
|
* @returns The resolved module path.
|
|
450
454
|
*/
|
|
451
455
|
resolveSync: (id: string, importer?: string, options?: ResolveOptions$1) => string | undefined;
|
|
456
|
+
/**
|
|
457
|
+
* Resolves a given module ID using the configured aliases.
|
|
458
|
+
*
|
|
459
|
+
* @remarks
|
|
460
|
+
* This function can be used to map module IDs to different paths based on the alias configuration.
|
|
461
|
+
*
|
|
462
|
+
* @param id - The module ID to resolve.
|
|
463
|
+
* @returns The resolved module ID - after applying any configured aliases (this will be the same as the input ID if no aliases match).
|
|
464
|
+
*/
|
|
465
|
+
resolveAlias: (id: string) => string;
|
|
452
466
|
/**
|
|
453
467
|
* Disposes of the virtual file system (VFS), writes any virtual file changes to disk, and releases any associated resources.
|
|
454
468
|
*/
|
|
@@ -217,6 +217,10 @@ interface ResolveOptions$1 extends ResolveOptions {
|
|
|
217
217
|
* If true, the module is being resolved as an entry point.
|
|
218
218
|
*/
|
|
219
219
|
isEntry?: boolean;
|
|
220
|
+
/**
|
|
221
|
+
* If true, the resolver will skip alias resolution when resolving modules.
|
|
222
|
+
*/
|
|
223
|
+
skipAlias?: boolean;
|
|
220
224
|
/**
|
|
221
225
|
* If true, the resolver will skip using the cache when resolving modules.
|
|
222
226
|
*/
|
|
@@ -449,6 +453,16 @@ interface VirtualFileSystemInterface {
|
|
|
449
453
|
* @returns The resolved module path.
|
|
450
454
|
*/
|
|
451
455
|
resolveSync: (id: string, importer?: string, options?: ResolveOptions$1) => string | undefined;
|
|
456
|
+
/**
|
|
457
|
+
* Resolves a given module ID using the configured aliases.
|
|
458
|
+
*
|
|
459
|
+
* @remarks
|
|
460
|
+
* This function can be used to map module IDs to different paths based on the alias configuration.
|
|
461
|
+
*
|
|
462
|
+
* @param id - The module ID to resolve.
|
|
463
|
+
* @returns The resolved module ID - after applying any configured aliases (this will be the same as the input ID if no aliases match).
|
|
464
|
+
*/
|
|
465
|
+
resolveAlias: (id: string) => string;
|
|
452
466
|
/**
|
|
453
467
|
* Disposes of the virtual file system (VFS), writes any virtual file changes to disk, and releases any associated resources.
|
|
454
468
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-tsdown",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.69",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing a Powerlines plugin to assist in developing other Powerlines plugins.",
|
|
6
6
|
"repository": {
|
|
@@ -150,13 +150,13 @@
|
|
|
150
150
|
"@stryke/type-checks": "^0.5.14",
|
|
151
151
|
"@stryke/types": "^0.10.28",
|
|
152
152
|
"defu": "^6.1.4",
|
|
153
|
-
"powerlines": "^0.36.
|
|
153
|
+
"powerlines": "^0.36.21"
|
|
154
154
|
},
|
|
155
155
|
"devDependencies": {
|
|
156
|
-
"@powerlines/nx": "^0.11.
|
|
157
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
156
|
+
"@powerlines/nx": "^0.11.47",
|
|
157
|
+
"@powerlines/plugin-plugin": "^0.12.68",
|
|
158
158
|
"@types/node": "^24.10.4"
|
|
159
159
|
},
|
|
160
160
|
"publishConfig": { "access": "public" },
|
|
161
|
-
"gitHead": "
|
|
161
|
+
"gitHead": "b16324cf857ea5743fd7ad06e18607b1ba32abe0"
|
|
162
162
|
}
|