@moneko/core 3.33.1 → 3.33.2

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.
@@ -1,5 +1,5 @@
1
1
  import { resolve } from 'node:path';
2
- import { loadFile, scanFolderSync } from '@moneko/utils';
2
+ import { loadFileRaw, scanFolderSync } from '@moneko/utils';
3
3
  import webpack, { type Compiler } from 'webpack';
4
4
  export interface CopyPluginOption {
5
5
  files?: string[];
@@ -1 +1 @@
1
- import{resolve as e}from"node:path";import{loadFile as s,scanFolderSync as t}from"@moneko/utils";import i from"webpack";let o="CopyPlugin",l=i.sources.RawSource;export class CopyPlugin{constructor(s){this.cacheFiles=[],this.baseFiles=new Set(s.files?.map(s=>e(s))||[]),this.dirs=new Set(s.dirs||[])}getFiles(){let e=new Set(this.baseFiles);for(let s of this.dirs)t(s).forEach(s=>e.add(s));let s={deleted:[],files:[...e]};for(let t of new Set(this.cacheFiles))e.has(t)||s.deleted.push(t);return this.cacheFiles=s.files,s}apply(e){e.hooks.thisCompilation.tap({name:o,stage:e.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},e=>{e.hooks.processAssets.tapPromise(o,async()=>{let t=this.getFiles(),i=t.files.map(e=>s(e));(await Promise.all(i)).forEach((s,i)=>{null!==s&&e.emitAsset(t.files[i],new l(s))}),t.deleted.forEach(s=>{e.deleteAsset(s)})})})}}
1
+ import{resolve as e}from"node:path";import{loadFileRaw as s,scanFolderSync as t}from"@moneko/utils";import i from"webpack";let o="CopyPlugin",l=i.sources.RawSource;export class CopyPlugin{constructor(s){this.cacheFiles=[],this.baseFiles=new Set(s.files?.map(s=>e(s))||[]),this.dirs=new Set(s.dirs||[])}getFiles(){let e=new Set(this.baseFiles);for(let s of this.dirs)t(s,["\\.*"]).forEach(s=>e.add(s));let s={deleted:[],files:[...e]};for(let t of new Set(this.cacheFiles))e.has(t)||s.deleted.push(t);return this.cacheFiles=s.files,s}apply(e){e.hooks.thisCompilation.tap({name:o,stage:e.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS},e=>{e.hooks.processAssets.tapPromise(o,async()=>{let t=this.getFiles(),i=t.files.map(e=>s(e));(await Promise.all(i)).forEach((s,i)=>{null!==s&&e.emitAsset(t.files[i],new l(Buffer.from(s)))}),t.deleted.forEach(s=>{e.deleteAsset(s)})})})}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moneko/core",
3
- "version": "3.33.1",
3
+ "version": "3.33.2",
4
4
  "description": "core",
5
5
  "main": "lib/index.mjs",
6
6
  "type": "module",