@modern-js/plugin 2.14.0 → 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
 - package/dist/cjs/farrow-pipeline/context.js +9 -27
 - package/dist/cjs/farrow-pipeline/counter.js +7 -25
 - package/dist/cjs/farrow-pipeline/index.js +25 -38
 - package/dist/cjs/index.js +21 -20
 - package/dist/cjs/manager/async.js +25 -41
 - package/dist/cjs/manager/index.js +20 -19
 - package/dist/cjs/manager/shared.js +16 -34
 - package/dist/cjs/manager/sync.js +48 -60
 - package/dist/cjs/manager/types.js +4 -15
 - package/dist/cjs/waterfall/async.js +25 -34
 - package/dist/cjs/waterfall/index.js +19 -18
 - package/dist/cjs/waterfall/sync.js +24 -31
 - package/dist/cjs/workflow/async.js +25 -33
 - package/dist/cjs/workflow/index.js +20 -19
 - package/dist/cjs/workflow/parallel.js +25 -33
 - package/dist/cjs/workflow/sync.js +23 -29
 - package/dist/esm/index.js +1123 -637
 - package/dist/esm-node/farrow-pipeline/context.js +3 -6
 - package/dist/esm-node/farrow-pipeline/counter.js +1 -4
 - package/dist/esm-node/farrow-pipeline/index.js +11 -14
 - package/dist/esm-node/manager/async.js +11 -18
 - package/dist/esm-node/manager/shared.js +8 -17
 - package/dist/esm-node/manager/sync.js +21 -42
 - package/dist/esm-node/manager/types.js +1 -0
 - package/dist/esm-node/waterfall/async.js +14 -16
 - package/dist/esm-node/waterfall/sync.js +12 -10
 - package/dist/esm-node/workflow/async.js +12 -13
 - package/dist/esm-node/workflow/parallel.js +11 -10
 - package/dist/esm-node/workflow/sync.js +10 -7
 - package/package.json +10 -5
 - package/dist/cjs/utils/pluginDagSort.js +0 -79
 - package/dist/esm-node/utils/pluginDagSort.js +0 -56
 - package/dist/types/utils/pluginDagSort.d.ts +0 -1
 
| 
         @@ -1,56 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            const dagSort = (plugins, key = "name", preKey = "pre", postKey = "post") => {
         
     | 
| 
       2 
     | 
    
         
            -
              let allLines = [];
         
     | 
| 
       3 
     | 
    
         
            -
              function getPluginByAny(q) {
         
     | 
| 
       4 
     | 
    
         
            -
                const target = plugins.find(
         
     | 
| 
       5 
     | 
    
         
            -
                  (item) => typeof q === "string" ? item[key] === q : item[key] === q[key]
         
     | 
| 
       6 
     | 
    
         
            -
                );
         
     | 
| 
       7 
     | 
    
         
            -
                if (!target) {
         
     | 
| 
       8 
     | 
    
         
            -
                  throw new Error(`plugin ${q} not existed`);
         
     | 
| 
       9 
     | 
    
         
            -
                }
         
     | 
| 
       10 
     | 
    
         
            -
                return target;
         
     | 
| 
       11 
     | 
    
         
            -
              }
         
     | 
| 
       12 
     | 
    
         
            -
              plugins.forEach((item) => {
         
     | 
| 
       13 
     | 
    
         
            -
                item[preKey].forEach((p) => {
         
     | 
| 
       14 
     | 
    
         
            -
                  if (plugins.find((ap) => ap.name === p)) {
         
     | 
| 
       15 
     | 
    
         
            -
                    allLines.push([getPluginByAny(p)[key], getPluginByAny(item)[key]]);
         
     | 
| 
       16 
     | 
    
         
            -
                  }
         
     | 
| 
       17 
     | 
    
         
            -
                });
         
     | 
| 
       18 
     | 
    
         
            -
                item[postKey].forEach((pt) => {
         
     | 
| 
       19 
     | 
    
         
            -
                  if (plugins.find((ap) => ap.name === pt)) {
         
     | 
| 
       20 
     | 
    
         
            -
                    allLines.push([getPluginByAny(item)[key], getPluginByAny(pt)[key]]);
         
     | 
| 
       21 
     | 
    
         
            -
                  }
         
     | 
| 
       22 
     | 
    
         
            -
                });
         
     | 
| 
       23 
     | 
    
         
            -
              });
         
     | 
| 
       24 
     | 
    
         
            -
              let zeroEndPoints = plugins.filter(
         
     | 
| 
       25 
     | 
    
         
            -
                (item) => !allLines.find((l) => l[1] === item[key])
         
     | 
| 
       26 
     | 
    
         
            -
              );
         
     | 
| 
       27 
     | 
    
         
            -
              const sortedPoint = [];
         
     | 
| 
       28 
     | 
    
         
            -
              while (zeroEndPoints.length) {
         
     | 
| 
       29 
     | 
    
         
            -
                const zep = zeroEndPoints.shift();
         
     | 
| 
       30 
     | 
    
         
            -
                sortedPoint.push(getPluginByAny(zep));
         
     | 
| 
       31 
     | 
    
         
            -
                allLines = allLines.filter((l) => l[0] !== getPluginByAny(zep)[key]);
         
     | 
| 
       32 
     | 
    
         
            -
                const restPoints = plugins.filter(
         
     | 
| 
       33 
     | 
    
         
            -
                  (item) => !sortedPoint.find((sp) => sp[key] === item[key])
         
     | 
| 
       34 
     | 
    
         
            -
                );
         
     | 
| 
       35 
     | 
    
         
            -
                zeroEndPoints = restPoints.filter(
         
     | 
| 
       36 
     | 
    
         
            -
                  // eslint-disable-next-line @typescript-eslint/no-loop-func
         
     | 
| 
       37 
     | 
    
         
            -
                  (item) => !allLines.find((l) => l[1] === item[key])
         
     | 
| 
       38 
     | 
    
         
            -
                );
         
     | 
| 
       39 
     | 
    
         
            -
              }
         
     | 
| 
       40 
     | 
    
         
            -
              if (allLines.length) {
         
     | 
| 
       41 
     | 
    
         
            -
                const restInRingPoints = {};
         
     | 
| 
       42 
     | 
    
         
            -
                allLines.forEach((l) => {
         
     | 
| 
       43 
     | 
    
         
            -
                  restInRingPoints[l[0]] = true;
         
     | 
| 
       44 
     | 
    
         
            -
                  restInRingPoints[l[1]] = true;
         
     | 
| 
       45 
     | 
    
         
            -
                });
         
     | 
| 
       46 
     | 
    
         
            -
                throw new Error(
         
     | 
| 
       47 
     | 
    
         
            -
                  `plugins dependences has loop: ${Object.keys(restInRingPoints).join(
         
     | 
| 
       48 
     | 
    
         
            -
                    ","
         
     | 
| 
       49 
     | 
    
         
            -
                  )}`
         
     | 
| 
       50 
     | 
    
         
            -
                );
         
     | 
| 
       51 
     | 
    
         
            -
              }
         
     | 
| 
       52 
     | 
    
         
            -
              return sortedPoint;
         
     | 
| 
       53 
     | 
    
         
            -
            };
         
     | 
| 
       54 
     | 
    
         
            -
            export {
         
     | 
| 
       55 
     | 
    
         
            -
              dagSort
         
     | 
| 
       56 
     | 
    
         
            -
            };
         
     | 
| 
         @@ -1 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            export declare const dagSort: <P extends Record<string, any>>(plugins: P[], key?: string, preKey?: string, postKey?: string) => P[];
         
     |