@octanejs/cli 0.0.12 → 0.1.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.
@@ -0,0 +1,42 @@
1
+ import { createRequire } from 'node:module';
2
+ import path from 'node:path';
3
+ import { pathToFileURL } from 'node:url';
4
+
5
+ /**
6
+ * Load the project's own config loader rather than shipping a second one.
7
+ *
8
+ * `@octanejs/app-core` is usually a transitive dependency of the bundler
9
+ * plugin, not a direct one, so a plain resolve from the project root misses it.
10
+ * Falling back to a resolve rooted at the plugin reproduces exactly the lookup
11
+ * the plugin itself performs.
12
+ *
13
+ * @param {string} root
14
+ * @returns {Promise<((root: string) => Promise<any>) | null>}
15
+ */
16
+ export async function resolveConfigLoader(root) {
17
+ const fromProject = createRequire(path.join(root, 'noop.js'));
18
+ const specifier = '@octanejs/app-core/config-loader';
19
+
20
+ /** @type {string | null} */
21
+ let entry = null;
22
+ try {
23
+ entry = fromProject.resolve(specifier);
24
+ } catch {
25
+ for (const plugin of [
26
+ '@octanejs/vite-plugin',
27
+ '@octanejs/rspack-plugin',
28
+ '@octanejs/rsbuild-plugin',
29
+ ]) {
30
+ try {
31
+ entry = createRequire(fromProject.resolve(plugin)).resolve(specifier);
32
+ break;
33
+ } catch {
34
+ // Try the next plugin.
35
+ }
36
+ }
37
+ }
38
+
39
+ if (!entry) return null;
40
+ const module = await import(pathToFileURL(entry).href);
41
+ return module.loadOctaneConfig ?? null;
42
+ }
@@ -12,7 +12,7 @@ const IGNORED_DIRS = new Set([
12
12
  '.vercel',
13
13
  ]);
14
14
  const SOURCE_EXTENSIONS = new Set(['.tsrx', '.tsx', '.ts', '.jsx', '.js', '.mts', '.mjs']);
15
- const SOURCE_FILE_LIMIT = 5000;
15
+ export const SOURCE_FILE_LIMIT = 5000;
16
16
  const EXTENDS_LIMIT = 10;
17
17
 
18
18
  const LOCKFILES = /** @type {const} */ ([
@@ -27,7 +27,7 @@ export const COMMANDS = [
27
27
  {
28
28
  name: 'analyze',
29
29
  summary: 'Compile the project and report the Octane compiler diagnostics.',
30
- load: () => import('../commands/analyze.js'),
30
+ load: () => import('../commands/analyze/index.js'),
31
31
  },
32
32
  {
33
33
  name: 'info',