imdone-core 2.1.11 → 2.2.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 +5 -0
- package/lib/index.js +1 -0
- package/lib/plugins/extension-plugin.js +2 -1
- package/lib/plugins/plugin-manager.js +4 -3
- package/lib/utils/index.js +1 -0
- package/lib/utils/module-import.js +5 -0
- package/package.json +1 -1
- package/scripts/generate-index.js +11 -1
- package/types/index.d.ts +1 -0
- package/types/utils/index.d.ts +1 -0
- package/types/utils/module-import.d.ts +1 -0
- package/.claude/settings.local.json +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
## 2.1.11
|
|
2
|
+
|
|
3
|
+
- Load extension and installed plugin modules through file URL import specifiers, so Windows users no longer see `ERR_UNSUPPORTED_ESM_URL_SCHEME` when project paths start with drive letters like `C:\`
|
|
4
|
+
- Keep generated library indexes from exporting tests, fixtures, hidden folders, or invalid namespace names, so build and type generation stay green when test fixtures include realistic `.imdone` directories
|
|
5
|
+
|
|
1
6
|
## 2.1.5
|
|
2
7
|
|
|
3
8
|
- Create GitHub releases automatically from the npm package version when changes merge to `master`.
|
package/lib/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import Plugin from 'imdone-api'
|
|
|
2
2
|
import _path from 'path'
|
|
3
3
|
import { exists } from '../adapters/file-gateway.js'
|
|
4
4
|
import { logger } from '../adapters/logger.js';
|
|
5
|
+
import { toFileImportSpecifier } from '../utils/module-import.js'
|
|
5
6
|
|
|
6
7
|
export default class ExtensionPlugin extends Plugin {
|
|
7
8
|
constructor(project) {
|
|
@@ -71,7 +72,7 @@ export default class ExtensionPlugin extends Plugin {
|
|
|
71
72
|
const extensionPath = this.getExtensionPath(path)
|
|
72
73
|
try {
|
|
73
74
|
await exists(extensionPath)
|
|
74
|
-
const importedModule = await import(extensionPath)
|
|
75
|
+
const importedModule = await import(toFileImportSpecifier(extensionPath))
|
|
75
76
|
|
|
76
77
|
// Check if it's a module object with a default export
|
|
77
78
|
if (importedModule && typeof importedModule === 'object' && 'default' in importedModule) {
|
|
@@ -15,6 +15,7 @@ import ArchivePlugin from './archive-plugin.js'
|
|
|
15
15
|
import EpicPlugin from './epic-plugin.js'
|
|
16
16
|
import ExtensionPlugin from './extension-plugin.js'
|
|
17
17
|
import { logger } from '../adapters/logger.js'
|
|
18
|
+
import { toFileImportSpecifier } from '../utils/module-import.js'
|
|
18
19
|
// import { URL } from 'node:url'
|
|
19
20
|
|
|
20
21
|
// const require = createRequire(new URL(import.meta.url));
|
|
@@ -159,7 +160,7 @@ export class PluginManager extends Emitter {
|
|
|
159
160
|
// eslint-disable-next-line
|
|
160
161
|
delete require.cache[require.resolve(fullPath)]
|
|
161
162
|
// eslint-disable-next-line
|
|
162
|
-
const pluginClass = await import(fullPath)
|
|
163
|
+
const pluginClass = await import(toFileImportSpecifier(fullPath))
|
|
163
164
|
const pluginInstance = await this.createPlugin(pluginClass.default, path)
|
|
164
165
|
return pluginInstance
|
|
165
166
|
} catch (e) {
|
|
@@ -170,7 +171,7 @@ export class PluginManager extends Emitter {
|
|
|
170
171
|
if (packageInfo.default.main) {
|
|
171
172
|
fullPath = _path.join(_path.resolve(path), packageInfo.default.main)
|
|
172
173
|
logger.log(`Trying package.json main: ${fullPath}`)
|
|
173
|
-
const pluginClass = await import(fullPath)
|
|
174
|
+
const pluginClass = await import(toFileImportSpecifier(fullPath))
|
|
174
175
|
const pluginInstance = await this.createPlugin(pluginClass.default, path)
|
|
175
176
|
return pluginInstance
|
|
176
177
|
}
|
|
@@ -186,7 +187,7 @@ export class PluginManager extends Emitter {
|
|
|
186
187
|
if (!path) return {}
|
|
187
188
|
let info = { path }
|
|
188
189
|
const packagePath = _path.join(path, 'package.json')
|
|
189
|
-
const packageInfo = await import(packagePath, {with: { type: 'json' } })
|
|
190
|
+
const packageInfo = await import(toFileImportSpecifier(packagePath), {with: { type: 'json' } })
|
|
190
191
|
try {
|
|
191
192
|
info = {...info, ...packageInfo }
|
|
192
193
|
delete info.dependencies
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './module-import.js';
|
package/package.json
CHANGED
|
@@ -2,6 +2,16 @@ import fs from 'fs';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
|
|
4
4
|
const LIB_DIR = './lib';
|
|
5
|
+
const VALID_NAMESPACE_EXPORT = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
6
|
+
|
|
7
|
+
function isIndexableDirectory(entry) {
|
|
8
|
+
return (
|
|
9
|
+
entry.isDirectory() &&
|
|
10
|
+
!['__tests__', '__fixtures__'].includes(entry.name) &&
|
|
11
|
+
!entry.name.startsWith('.') &&
|
|
12
|
+
VALID_NAMESPACE_EXPORT.test(entry.name)
|
|
13
|
+
);
|
|
14
|
+
}
|
|
5
15
|
|
|
6
16
|
// Recursively generates index.js files
|
|
7
17
|
function generateIndexes(dir) {
|
|
@@ -12,7 +22,7 @@ function generateIndexes(dir) {
|
|
|
12
22
|
.map(entry => `export * from './${entry.name}';`);
|
|
13
23
|
|
|
14
24
|
const subdirs = entries
|
|
15
|
-
.filter(
|
|
25
|
+
.filter(isIndexableDirectory)
|
|
16
26
|
.map(entry => entry.name);
|
|
17
27
|
|
|
18
28
|
// Generate index.js in each subdirectory
|
package/types/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./module-import.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function toFileImportSpecifier(filePath: any): string;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"permissions": {
|
|
3
|
-
"allow": [
|
|
4
|
-
"Bash(npm test:*)",
|
|
5
|
-
"Bash(node test-debug.js:*)",
|
|
6
|
-
"Bash(cat:*)",
|
|
7
|
-
"Bash(node test-ignore-patterns.js:*)",
|
|
8
|
-
"Bash(node test-ignore-patterns-detailed.js:*)",
|
|
9
|
-
"Bash(node test-ignore-patterns-fixed.js:*)"
|
|
10
|
-
]
|
|
11
|
-
}
|
|
12
|
-
}
|