@modern-js/app-tools 2.57.1-beta.1 → 2.57.1-beta.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -38,10 +38,15 @@ var import_pkg_types = require("pkg-types");
38
38
  var import_mlly = require("mlly");
39
39
  var import_utils2 = require("./utils");
40
40
  var import_nft = require("@vercel/nft");
41
- const handleDependencies = async ({ appDir, serverRootDir, includeEntries, traceFiles = import_utils2.traceFiles, entryFilter, modifyPackageJson, copyWholePackage }) => {
41
+ const handleDependencies = async ({ appDir, serverRootDir, includeEntries, traceFiles = import_utils2.traceFiles, entryFilter, modifyPackageJson, copyWholePackage, traceOptions }) => {
42
42
  const base = "/";
43
43
  const entryFiles = await (0, import_utils2.findEntryFiles)(serverRootDir, entryFilter);
44
- const fileTrace = await traceFiles(entryFiles.concat(includeEntries), serverRootDir, base);
44
+ const fileTrace = await traceFiles({
45
+ entryFiles: entryFiles.concat(includeEntries),
46
+ serverRootDir,
47
+ base,
48
+ traceOptions
49
+ });
45
50
  const currentProjectModules = import_node_path.default.join(appDir, "node_modules");
46
51
  const dependencySearchRoot = import_node_path.default.resolve(appDir, "../../../../../../");
47
52
  const tracedFiles = Object.fromEntries(await Promise.all([
@@ -138,10 +138,11 @@ const findPackageParents = (pkg, version, tracedFiles) => {
138
138
  ];
139
139
  return parentPkgs.filter((parentPkg) => parentPkg);
140
140
  };
141
- const traceFiles = async (entryFiles, serverRootDir, base = "/") => {
141
+ const traceFiles = async ({ entryFiles, serverRootDir, base = "/", traceOptions }) => {
142
142
  return await (0, import_nft.nodeFileTrace)(entryFiles, {
143
143
  base,
144
- processCwd: serverRootDir
144
+ processCwd: serverRootDir,
145
+ ...traceOptions
145
146
  });
146
147
  };
147
148
  const resolveTracedPath = async (base, p) => import_utils.fs.realpath(import_path.default.resolve(base, p));
@@ -11,11 +11,11 @@ import { linkPackage, writePackage, isFile, findEntryFiles, traceFiles as defaul
11
11
  import { nodeFileTrace } from "@vercel/nft";
12
12
  var handleDependencies = function() {
13
13
  var _ref = _async_to_generator(function(param) {
14
- var appDir, serverRootDir, includeEntries, _param_traceFiles, traceFiles, entryFilter, modifyPackageJson, copyWholePackage, base, entryFiles, fileTrace, currentProjectModules, dependencySearchRoot, tracedFiles, _, tracedPackages, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, tracedFile, pkgName, tracedPackage, pkgJSON, tracedPackageVersion, shouldCopyWholePackage, _tracedPackageVersion_files, allFiles, err, multiVersionPkgs, singleVersionPackages, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, tracedPackage1, versions, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, version, projectPkgJson, _iteratorNormalCompletion3, _didIteratorError3, _iteratorError3, _loop, _iterator3, _step3, err, outputPkgPath, newPkgJson, finalPkgJson;
14
+ var appDir, serverRootDir, includeEntries, _param_traceFiles, traceFiles, entryFilter, modifyPackageJson, copyWholePackage, traceOptions, base, entryFiles, fileTrace, currentProjectModules, dependencySearchRoot, tracedFiles, _, tracedPackages, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, tracedFile, pkgName, tracedPackage, pkgJSON, tracedPackageVersion, shouldCopyWholePackage, _tracedPackageVersion_files, allFiles, err, multiVersionPkgs, singleVersionPackages, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, tracedPackage1, versions, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, version, projectPkgJson, _iteratorNormalCompletion3, _didIteratorError3, _iteratorError3, _loop, _iterator3, _step3, err, outputPkgPath, newPkgJson, finalPkgJson;
15
15
  return _ts_generator(this, function(_state) {
16
16
  switch (_state.label) {
17
17
  case 0:
18
- appDir = param.appDir, serverRootDir = param.serverRootDir, includeEntries = param.includeEntries, _param_traceFiles = param.traceFiles, traceFiles = _param_traceFiles === void 0 ? defaultTraceFiles : _param_traceFiles, entryFilter = param.entryFilter, modifyPackageJson = param.modifyPackageJson, copyWholePackage = param.copyWholePackage;
18
+ appDir = param.appDir, serverRootDir = param.serverRootDir, includeEntries = param.includeEntries, _param_traceFiles = param.traceFiles, traceFiles = _param_traceFiles === void 0 ? defaultTraceFiles : _param_traceFiles, entryFilter = param.entryFilter, modifyPackageJson = param.modifyPackageJson, copyWholePackage = param.copyWholePackage, traceOptions = param.traceOptions;
19
19
  base = "/";
20
20
  return [
21
21
  4,
@@ -25,7 +25,12 @@ var handleDependencies = function() {
25
25
  entryFiles = _state.sent();
26
26
  return [
27
27
  4,
28
- traceFiles(entryFiles.concat(includeEntries), serverRootDir, base)
28
+ traceFiles({
29
+ entryFiles: entryFiles.concat(includeEntries),
30
+ serverRootDir,
31
+ base,
32
+ traceOptions
33
+ })
29
34
  ];
30
35
  case 2:
31
36
  fileTrace = _state.sent();
@@ -1,4 +1,5 @@
1
1
  import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
+ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
2
3
  import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
3
4
  import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
4
5
  import path from "path";
@@ -335,19 +336,18 @@ var findPackageParents = function(pkg, version, tracedFiles) {
335
336
  });
336
337
  };
337
338
  var traceFiles = function() {
338
- var _ref = _async_to_generator(function(entryFiles, serverRootDir) {
339
- var base;
340
- var _arguments = arguments;
339
+ var _ref = _async_to_generator(function(param) {
340
+ var entryFiles, serverRootDir, _param_base, base, traceOptions;
341
341
  return _ts_generator(this, function(_state) {
342
342
  switch (_state.label) {
343
343
  case 0:
344
- base = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : "/";
344
+ entryFiles = param.entryFiles, serverRootDir = param.serverRootDir, _param_base = param.base, base = _param_base === void 0 ? "/" : _param_base, traceOptions = param.traceOptions;
345
345
  return [
346
346
  4,
347
- nodeFileTrace(entryFiles, {
347
+ nodeFileTrace(entryFiles, _object_spread({
348
348
  base,
349
349
  processCwd: serverRootDir
350
- })
350
+ }, traceOptions))
351
351
  ];
352
352
  case 1:
353
353
  return [
@@ -357,7 +357,7 @@ var traceFiles = function() {
357
357
  }
358
358
  });
359
359
  });
360
- return function traceFiles2(entryFiles, serverRootDir) {
360
+ return function traceFiles2(_) {
361
361
  return _ref.apply(this, arguments);
362
362
  };
363
363
  }();
@@ -4,10 +4,15 @@ import { readPackageJSON } from "pkg-types";
4
4
  import { parseNodeModulePath } from "mlly";
5
5
  import { linkPackage, writePackage, isFile, findEntryFiles, traceFiles as defaultTraceFiles, findPackageParents, resolveTracedPath, readDirRecursive } from "./utils";
6
6
  import { nodeFileTrace } from "@vercel/nft";
7
- const handleDependencies = async ({ appDir, serverRootDir, includeEntries, traceFiles = defaultTraceFiles, entryFilter, modifyPackageJson, copyWholePackage }) => {
7
+ const handleDependencies = async ({ appDir, serverRootDir, includeEntries, traceFiles = defaultTraceFiles, entryFilter, modifyPackageJson, copyWholePackage, traceOptions }) => {
8
8
  const base = "/";
9
9
  const entryFiles = await findEntryFiles(serverRootDir, entryFilter);
10
- const fileTrace = await traceFiles(entryFiles.concat(includeEntries), serverRootDir, base);
10
+ const fileTrace = await traceFiles({
11
+ entryFiles: entryFiles.concat(includeEntries),
12
+ serverRootDir,
13
+ base,
14
+ traceOptions
15
+ });
11
16
  const currentProjectModules = path.join(appDir, "node_modules");
12
17
  const dependencySearchRoot = path.resolve(appDir, "../../../../../../");
13
18
  const tracedFiles = Object.fromEntries(await Promise.all([
@@ -98,10 +98,11 @@ const findPackageParents = (pkg, version, tracedFiles) => {
98
98
  ];
99
99
  return parentPkgs.filter((parentPkg) => parentPkg);
100
100
  };
101
- const traceFiles = async (entryFiles, serverRootDir, base = "/") => {
101
+ const traceFiles = async ({ entryFiles, serverRootDir, base = "/", traceOptions }) => {
102
102
  return await nodeFileTrace(entryFiles, {
103
103
  base,
104
- processCwd: serverRootDir
104
+ processCwd: serverRootDir,
105
+ ...traceOptions
105
106
  });
106
107
  };
107
108
  const resolveTracedPath = async (base, p) => fse.realpath(path.resolve(base, p));
@@ -1,12 +1,20 @@
1
1
  import type { PackageJson } from 'pkg-types';
2
+ import type { NodeFileTraceOptions } from '@vercel/nft';
2
3
  import { traceFiles as defaultTraceFiles } from './utils';
4
+ export type { NodeFileTraceOptions } from '@vercel/nft';
3
5
  export { nodeFileTrace } from '@vercel/nft';
4
- export declare const handleDependencies: ({ appDir, serverRootDir, includeEntries, traceFiles, entryFilter, modifyPackageJson, copyWholePackage, }: {
6
+ export declare const handleDependencies: ({ appDir, serverRootDir, includeEntries, traceFiles, entryFilter, modifyPackageJson, copyWholePackage, traceOptions, }: {
5
7
  appDir: string;
6
8
  serverRootDir: string;
7
9
  includeEntries: string[];
8
- traceFiles?: ((entryFiles: string[], serverRootDir: string, base?: string) => Promise<import("@vercel/nft").NodeFileTraceResult>) | undefined;
10
+ traceFiles?: (({ entryFiles, serverRootDir, base, traceOptions, }: {
11
+ entryFiles: string[];
12
+ serverRootDir: string;
13
+ base?: string | undefined;
14
+ traceOptions?: NodeFileTraceOptions | undefined;
15
+ }) => Promise<import("@vercel/nft").NodeFileTraceResult>) | undefined;
9
16
  entryFilter?: ((filePath: string) => boolean) | undefined;
10
17
  modifyPackageJson?: ((pkgJson: PackageJson) => PackageJson) | undefined;
11
18
  copyWholePackage?: ((pkgName: string) => boolean) | undefined;
19
+ traceOptions?: NodeFileTraceOptions | undefined;
12
20
  }) => Promise<void>;
@@ -1,4 +1,5 @@
1
1
  import type { PackageJson } from 'pkg-types';
2
+ import { NodeFileTraceOptions } from '@vercel/nft';
2
3
  export type TracedPackage = {
3
4
  name: string;
4
5
  versions: Record<string, {
@@ -32,6 +33,11 @@ export declare const readDirRecursive: (dir: string, options?: ReadDirOptions) =
32
33
  export declare const isFile: (file: string) => Promise<boolean>;
33
34
  export declare const findEntryFiles: (rootDir: string, entryFilter?: ((filePath: string) => boolean) | undefined) => Promise<string[]>;
34
35
  export declare const findPackageParents: (pkg: TracedPackage, version: string, tracedFiles: Record<string, TracedFile>) => string[];
35
- export declare const traceFiles: (entryFiles: string[], serverRootDir: string, base?: string) => Promise<import("@vercel/nft").NodeFileTraceResult>;
36
+ export declare const traceFiles: ({ entryFiles, serverRootDir, base, traceOptions, }: {
37
+ entryFiles: string[];
38
+ serverRootDir: string;
39
+ base?: string | undefined;
40
+ traceOptions?: NodeFileTraceOptions | undefined;
41
+ }) => Promise<import("@vercel/nft").NodeFileTraceResult>;
36
42
  export declare const resolveTracedPath: (base: string, p: string) => Promise<string>;
37
43
  export {};
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.57.1-beta.1",
18
+ "version": "2.57.1-beta.2",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -87,20 +87,20 @@
87
87
  "mlly": "^1.6.1",
88
88
  "pkg-types": "^1.1.0",
89
89
  "std-env": "^3.7.0",
90
- "@modern-js/plugin": "2.57.0",
91
90
  "@modern-js/core": "2.57.0",
92
- "@modern-js/plugin-i18n": "2.57.0",
91
+ "@modern-js/plugin": "2.57.0",
92
+ "@modern-js/node-bundle-require": "2.57.0",
93
93
  "@modern-js/prod-server": "2.57.0",
94
- "@modern-js/server-core": "2.57.0",
95
94
  "@modern-js/plugin-data-loader": "2.57.0",
95
+ "@modern-js/plugin-i18n": "2.57.0",
96
+ "@modern-js/server-core": "2.57.0",
96
97
  "@modern-js/plugin-lint": "2.57.0",
97
- "@modern-js/utils": "2.57.0",
98
- "@modern-js/node-bundle-require": "2.57.0",
99
98
  "@modern-js/types": "2.57.0",
100
99
  "@modern-js/server": "2.57.0",
100
+ "@modern-js/utils": "2.57.0",
101
+ "@modern-js/rsbuild-plugin-esbuild": "2.57.0",
101
102
  "@modern-js/server-utils": "2.57.0",
102
- "@modern-js/uni-builder": "2.57.0",
103
- "@modern-js/rsbuild-plugin-esbuild": "2.57.0"
103
+ "@modern-js/uni-builder": "2.57.0"
104
104
  },
105
105
  "devDependencies": {
106
106
  "@rsbuild/plugin-swc": "1.0.1-beta.3",