imdone-core 2.1.2 → 2.1.3
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/.claude/settings.local.json +12 -0
- package/CHANGELOG.md +6 -0
- package/lib/plugins/plugin-manager.js +18 -3
- package/package.json +2 -2
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
}
|
package/CHANGELOG.md
CHANGED
|
@@ -151,7 +151,7 @@ export class PluginManager extends Emitter {
|
|
|
151
151
|
|
|
152
152
|
async loadPlugin(path) {
|
|
153
153
|
logger.log('Loading plugin: ', path)
|
|
154
|
-
|
|
154
|
+
let fullPath = path.endsWith('.js')
|
|
155
155
|
? _path.resolve(path)
|
|
156
156
|
: _path.join(_path.resolve(path), 'bundle.js')
|
|
157
157
|
|
|
@@ -159,10 +159,25 @@ export class PluginManager extends Emitter {
|
|
|
159
159
|
// eslint-disable-next-line
|
|
160
160
|
delete require.cache[require.resolve(fullPath)]
|
|
161
161
|
// eslint-disable-next-line
|
|
162
|
-
const pluginClass = await import(
|
|
162
|
+
const pluginClass = await import(fullPath)
|
|
163
163
|
const pluginInstance = await this.createPlugin(pluginClass.default, path)
|
|
164
164
|
return pluginInstance
|
|
165
165
|
} catch (e) {
|
|
166
|
+
// If bundle.js failed and path is a directory, try to use package.json main field
|
|
167
|
+
if (!path.endsWith('.js') && e.code === 'ERR_UNSUPPORTED_DIR_IMPORT') {
|
|
168
|
+
try {
|
|
169
|
+
const packageInfo = await this.getPackageInfo(path)
|
|
170
|
+
if (packageInfo.default.main) {
|
|
171
|
+
fullPath = _path.join(_path.resolve(path), packageInfo.default.main)
|
|
172
|
+
logger.log(`Trying package.json main: ${fullPath}`)
|
|
173
|
+
const pluginClass = await import(fullPath)
|
|
174
|
+
const pluginInstance = await this.createPlugin(pluginClass.default, path)
|
|
175
|
+
return pluginInstance
|
|
176
|
+
}
|
|
177
|
+
} catch (packageError) {
|
|
178
|
+
logger.error(`Error loading package.json or main file for plugin at: ${path}`, packageError)
|
|
179
|
+
}
|
|
180
|
+
}
|
|
166
181
|
logger.error(`Error loading plugin at: ${path}`, e)
|
|
167
182
|
}
|
|
168
183
|
}
|
|
@@ -171,7 +186,7 @@ export class PluginManager extends Emitter {
|
|
|
171
186
|
if (!path) return {}
|
|
172
187
|
let info = { path }
|
|
173
188
|
const packagePath = _path.join(path, 'package.json')
|
|
174
|
-
const packageInfo = await import(packagePath)
|
|
189
|
+
const packageInfo = await import(packagePath, {with: { type: 'json' } })
|
|
175
190
|
try {
|
|
176
191
|
info = {...info, ...packageInfo }
|
|
177
192
|
delete info.dependencies
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "imdone-core",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.3",
|
|
4
4
|
"description": "imdone-core",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"find-up-simple": "^1.0.1",
|
|
59
59
|
"gray-matter": "^4.0.2",
|
|
60
60
|
"ignore": "^5.2.0",
|
|
61
|
-
"imdone-api": "^2.0.
|
|
61
|
+
"imdone-api": "^2.0.4",
|
|
62
62
|
"isbinaryfile": "^5.0.4",
|
|
63
63
|
"js-yaml": "^3.14.1",
|
|
64
64
|
"json-fns": "^1.0.0",
|