@directus/extensions-sdk 12.0.2 → 12.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.
package/dist/cli/commands/add.js
CHANGED
|
@@ -49,7 +49,7 @@ export default async function add(options) {
|
|
|
49
49
|
type: 'list',
|
|
50
50
|
name: 'type',
|
|
51
51
|
message: 'Choose the extension type',
|
|
52
|
-
choices: EXTENSION_TYPES,
|
|
52
|
+
choices: () => EXTENSION_TYPES.filter((e) => e !== 'bundle'),
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
type: 'input',
|
|
@@ -134,7 +134,7 @@ export default async function add(options) {
|
|
|
134
134
|
type: 'list',
|
|
135
135
|
name: 'type',
|
|
136
136
|
message: 'Choose the extension type',
|
|
137
|
-
choices: EXTENSION_TYPES,
|
|
137
|
+
choices: () => EXTENSION_TYPES.filter((e) => e !== 'bundle'),
|
|
138
138
|
},
|
|
139
139
|
{
|
|
140
140
|
type: 'input',
|
|
@@ -180,9 +180,8 @@ async function buildAppOrApiExtension({ type, input, output, format, watch, sour
|
|
|
180
180
|
process.exit(1);
|
|
181
181
|
}
|
|
182
182
|
const config = await loadConfig();
|
|
183
|
-
const plugins = config.plugins ?? [];
|
|
184
183
|
const mode = isIn(type, APP_EXTENSION_TYPES) ? 'browser' : 'node';
|
|
185
|
-
const rollupOptions = getRollupOptions({ mode, input, sourcemap, minify,
|
|
184
|
+
const rollupOptions = getRollupOptions({ mode, input, sourcemap, minify, config });
|
|
186
185
|
const rollupOutputOptions = getRollupOutputOptions({ mode, output, format, sourcemap });
|
|
187
186
|
if (watch) {
|
|
188
187
|
await watchExtension({ rollupOptions, rollupOutputOptions });
|
|
@@ -209,20 +208,19 @@ async function buildHybridExtension({ inputApp, inputApi, outputApp, outputApi,
|
|
|
209
208
|
process.exit(1);
|
|
210
209
|
}
|
|
211
210
|
const config = await loadConfig();
|
|
212
|
-
const plugins = config.plugins ?? [];
|
|
213
211
|
const rollupOptionsApp = getRollupOptions({
|
|
214
212
|
mode: 'browser',
|
|
215
213
|
input: inputApp,
|
|
216
214
|
sourcemap,
|
|
217
215
|
minify,
|
|
218
|
-
|
|
216
|
+
config,
|
|
219
217
|
});
|
|
220
218
|
const rollupOptionsApi = getRollupOptions({
|
|
221
219
|
mode: 'node',
|
|
222
220
|
input: inputApi,
|
|
223
221
|
sourcemap,
|
|
224
222
|
minify,
|
|
225
|
-
|
|
223
|
+
config,
|
|
226
224
|
});
|
|
227
225
|
const rollupOutputOptionsApp = getRollupOutputOptions({ mode: 'browser', output: outputApp, format, sourcemap });
|
|
228
226
|
const rollupOutputOptionsApi = getRollupOutputOptions({ mode: 'node', output: outputApi, format, sourcemap });
|
|
@@ -255,7 +253,6 @@ async function buildBundleExtension({ entries, outputApp, outputApi, format, wat
|
|
|
255
253
|
bundleEntryNames.add(name);
|
|
256
254
|
}
|
|
257
255
|
const config = await loadConfig();
|
|
258
|
-
const plugins = config.plugins ?? [];
|
|
259
256
|
const entrypointApp = generateBundleEntrypoint('app', entries);
|
|
260
257
|
const entrypointApi = generateBundleEntrypoint('api', entries);
|
|
261
258
|
const rollupOptionsApp = getRollupOptions({
|
|
@@ -263,14 +260,14 @@ async function buildBundleExtension({ entries, outputApp, outputApi, format, wat
|
|
|
263
260
|
input: { entry: entrypointApp },
|
|
264
261
|
sourcemap,
|
|
265
262
|
minify,
|
|
266
|
-
|
|
263
|
+
config,
|
|
267
264
|
});
|
|
268
265
|
const rollupOptionsApi = getRollupOptions({
|
|
269
266
|
mode: 'node',
|
|
270
267
|
input: { entry: entrypointApi },
|
|
271
268
|
sourcemap,
|
|
272
269
|
minify,
|
|
273
|
-
|
|
270
|
+
config,
|
|
274
271
|
});
|
|
275
272
|
const rollupOutputOptionsApp = getRollupOutputOptions({ mode: 'browser', output: outputApp, format, sourcemap });
|
|
276
273
|
const rollupOutputOptionsApi = getRollupOutputOptions({ mode: 'node', output: outputApi, format, sourcemap });
|
|
@@ -311,6 +308,7 @@ async function buildExtension(config) {
|
|
|
311
308
|
}
|
|
312
309
|
async function watchExtension(config) {
|
|
313
310
|
const configs = Array.isArray(config) ? config : [config];
|
|
311
|
+
const userConfig = await loadConfig();
|
|
314
312
|
const spinner = ora(chalk.bold('Building Directus extension...'));
|
|
315
313
|
let buildCount = 0;
|
|
316
314
|
for (const c of configs) {
|
|
@@ -322,7 +320,9 @@ async function watchExtension(config) {
|
|
|
322
320
|
switch (event.code) {
|
|
323
321
|
case 'BUNDLE_START':
|
|
324
322
|
if (buildCount === 0) {
|
|
325
|
-
|
|
323
|
+
if (userConfig?.watch?.clearScreen !== false) {
|
|
324
|
+
clear();
|
|
325
|
+
}
|
|
326
326
|
spinner.start();
|
|
327
327
|
}
|
|
328
328
|
buildCount++;
|
|
@@ -348,7 +348,8 @@ async function watchExtension(config) {
|
|
|
348
348
|
});
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
|
-
function getRollupOptions({ mode, input, sourcemap, minify,
|
|
351
|
+
function getRollupOptions({ mode, input, sourcemap, minify, config, }) {
|
|
352
|
+
const plugins = config.plugins ?? [];
|
|
352
353
|
return {
|
|
353
354
|
input: typeof input !== 'string' ? 'entry' : input,
|
|
354
355
|
external: mode === 'browser' ? APP_SHARED_DEPS : API_SHARED_DEPS,
|
package/dist/cli/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@directus/extensions-sdk",
|
|
3
|
-
"version": "12.0
|
|
3
|
+
"version": "12.1.0",
|
|
4
4
|
"description": "A toolkit to develop extensions to extend Directus",
|
|
5
5
|
"homepage": "https://directus.io",
|
|
6
6
|
"repository": {
|
|
@@ -45,19 +45,19 @@
|
|
|
45
45
|
"rollup-plugin-styles": "4.0.0",
|
|
46
46
|
"vite": "4.5.2",
|
|
47
47
|
"vue": "3.4.27",
|
|
48
|
-
"@directus/composables": "11.1.
|
|
49
|
-
"@directus/extensions": "2.0.1",
|
|
48
|
+
"@directus/composables": "11.1.1",
|
|
50
49
|
"@directus/constants": "12.0.0",
|
|
51
|
-
"@directus/themes": "1.0.
|
|
52
|
-
"@directus/
|
|
53
|
-
"@directus/
|
|
50
|
+
"@directus/themes": "1.0.1",
|
|
51
|
+
"@directus/extensions": "2.0.2",
|
|
52
|
+
"@directus/types": "12.1.0",
|
|
53
|
+
"@directus/utils": "12.0.1"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/fs-extra": "11.0.4",
|
|
57
57
|
"@types/inquirer": "9.0.7",
|
|
58
|
-
"@vitest/coverage-v8": "1.
|
|
59
|
-
"typescript": "5.
|
|
60
|
-
"vitest": "1.
|
|
58
|
+
"@vitest/coverage-v8": "2.1.2",
|
|
59
|
+
"typescript": "5.6.2",
|
|
60
|
+
"vitest": "2.1.2",
|
|
61
61
|
"@directus/tsconfig": "2.0.0"
|
|
62
62
|
},
|
|
63
63
|
"engines": {
|