@modern-js/plugin-devtools 0.0.0-next-20240522073546 → 0.0.0-next-20240522095407

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/cli.js CHANGED
@@ -82,12 +82,13 @@ const devtoolsPlugin = (inlineOptions = {}) => {
82
82
  const appCtx = api.useAppContext();
83
83
  const { devtools: options = {} } = appConfig;
84
84
  (0, import_options.updateContext)(ctx, options);
85
- const watcher2 = import_utils.chokidar.watch((0, import_config.getConfigFilenames)(), {
85
+ const basename = `${ctx.def.name.shortName}.runtime.json`;
86
+ const watcher2 = import_utils.chokidar.watch((0, import_config.getConfigFilenames)(basename), {
86
87
  cwd: appCtx.appDirectory,
87
88
  ignorePermissionErrors: true
88
89
  });
89
90
  const refreshStoragePreset = async () => {
90
- const configs = await (0, import_config.loadConfigFiles)(appCtx.appDirectory);
91
+ const configs = await (0, import_config.loadConfigFiles)(basename, appCtx.appDirectory);
91
92
  if (!configs)
92
93
  return;
93
94
  ctx.storagePresets = [];
@@ -1,8 +1,8 @@
1
1
  import { DevtoolsContext, StoragePresetContext } from '@modern-js/devtools-kit';
2
- export declare function getConfigFilenames(dir?: string): string[];
2
+ export declare function getConfigFilenames(base: string, dir?: string): string[];
3
3
  /** Resolve all config files from target directory upward to the root path. */
4
- export declare function resolveConfigFiles(dir?: string): Promise<string[]>;
4
+ export declare function resolveConfigFiles(base: string, dir?: string): Promise<string[]>;
5
5
  export declare function loadConfigFile(filename: string): Promise<{
6
6
  storagePresets: StoragePresetContext[];
7
7
  } | null>;
8
- export declare function loadConfigFiles(dir?: string): Promise<Partial<DevtoolsContext>[] | null>;
8
+ export declare function loadConfigFiles(base: string, dir?: string): Promise<Partial<DevtoolsContext>[] | null>;
@@ -37,18 +37,17 @@ module.exports = __toCommonJS(config_exports);
37
37
  var import_path = __toESM(require("path"));
38
38
  var import_fs_extra = __toESM(require("@modern-js/utils/fs-extra"));
39
39
  var import_utils = require("@modern-js/utils");
40
- const CONFIG_FILENAME = "modern.runtime.json";
41
- function getConfigFilenames(dir = process.cwd()) {
40
+ function getConfigFilenames(base, dir = process.cwd()) {
42
41
  const files = [];
43
42
  let curr = dir;
44
43
  while (import_path.default.dirname(curr) !== curr) {
45
- files.push(import_path.default.join(curr, CONFIG_FILENAME));
44
+ files.push(import_path.default.join(curr, base));
46
45
  curr = import_path.default.dirname(curr);
47
46
  }
48
47
  return files;
49
48
  }
50
- async function resolveConfigFiles(dir = process.cwd()) {
51
- const files = getConfigFilenames(dir);
49
+ async function resolveConfigFiles(base, dir = process.cwd()) {
50
+ const files = getConfigFilenames(base, dir);
52
51
  const ret = [];
53
52
  await Promise.all(files.map(async (file) => await import_fs_extra.default.pathExists(file) && ret.push(file)));
54
53
  return ret;
@@ -90,8 +89,8 @@ async function loadConfigFile(filename) {
90
89
  storagePresets: ret
91
90
  };
92
91
  }
93
- async function loadConfigFiles(dir = process.cwd()) {
94
- const filenames = await resolveConfigFiles(dir);
92
+ async function loadConfigFiles(base, dir = process.cwd()) {
93
+ const filenames = await resolveConfigFiles(base, dir);
95
94
  const resolved = await Promise.all(filenames.map(loadConfigFile));
96
95
  const ret = [];
97
96
  for (const config of resolved) {
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "0.0.0-next-20240522073546",
18
+ "version": "0.0.0-next-20240522095407",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/index.d.ts",
21
21
  "main": "./dist/index.js",
@@ -54,9 +54,9 @@
54
54
  "ufo": "^1.3.0",
55
55
  "valtio": "^1.11.1",
56
56
  "ws": "^8.13.0",
57
- "@modern-js/devtools-client": "0.0.0-next-20240522073546",
58
- "@modern-js/devtools-kit": "0.0.0-next-20240522073546",
59
- "@modern-js/utils": "0.0.0-next-20240522073546"
57
+ "@modern-js/devtools-client": "0.0.0-next-20240522095407",
58
+ "@modern-js/devtools-kit": "0.0.0-next-20240522095407",
59
+ "@modern-js/utils": "0.0.0-next-20240522095407"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@swc/helpers": "0.5.3",
@@ -64,17 +64,17 @@
64
64
  "@types/ws": "^8.5.5",
65
65
  "type-fest": "^4.1.0",
66
66
  "typescript": "^5",
67
- "@modern-js/app-tools": "0.0.0-next-20240522073546",
68
- "@modern-js/core": "0.0.0-next-20240522073546",
69
- "@modern-js/module-tools": "0.0.0-next-20240522073546",
70
- "@modern-js/runtime": "0.0.0-next-20240522073546",
71
- "@modern-js/server-core": "0.0.0-next-20240522073546",
72
- "@modern-js/types": "0.0.0-next-20240522073546",
73
- "@modern-js/uni-builder": "0.0.0-next-20240522073546",
74
- "@scripts/build": "0.0.0-next-20240522073546"
67
+ "@modern-js/app-tools": "0.0.0-next-20240522095407",
68
+ "@modern-js/core": "0.0.0-next-20240522095407",
69
+ "@modern-js/module-tools": "0.0.0-next-20240522095407",
70
+ "@modern-js/runtime": "0.0.0-next-20240522095407",
71
+ "@modern-js/server-core": "0.0.0-next-20240522095407",
72
+ "@modern-js/types": "0.0.0-next-20240522095407",
73
+ "@modern-js/uni-builder": "0.0.0-next-20240522095407",
74
+ "@scripts/build": "0.0.0-next-20240522095407"
75
75
  },
76
76
  "peerDependencies": {
77
- "@modern-js/runtime": "0.0.0-next-20240522073546"
77
+ "@modern-js/runtime": "0.0.0-next-20240522095407"
78
78
  },
79
79
  "peerDependenciesMeta": {
80
80
  "@modern-js/runtime": {