@directus/extensions-sdk 9.21.0 → 9.21.2

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.
@@ -16,8 +16,8 @@ const fs_extra_1 = __importDefault(require("fs-extra"));
16
16
  const ora_1 = __importDefault(require("ora"));
17
17
  const path_1 = __importDefault(require("path"));
18
18
  const rollup_1 = require("rollup");
19
+ const rollup_plugin_esbuild_1 = __importDefault(require("rollup-plugin-esbuild"));
19
20
  const rollup_plugin_styles_1 = __importDefault(require("rollup-plugin-styles"));
20
- const rollup_plugin_typescript2_1 = __importDefault(require("rollup-plugin-typescript2"));
21
21
  const rollup_plugin_vue_1 = __importDefault(require("rollup-plugin-vue"));
22
22
  const languages_1 = require("../utils/languages");
23
23
  const logger_1 = require("../utils/logger");
@@ -396,69 +396,36 @@ async function watchExtension(config) {
396
396
  }
397
397
  function getRollupOptions({ mode, input, language, sourcemap, minify, plugins, }) {
398
398
  const languages = Array.isArray(language) ? language : [language];
399
- if (mode === 'browser') {
400
- return {
401
- input: typeof input !== 'string' ? 'entry' : input,
402
- external: constants_1.APP_SHARED_DEPS,
403
- plugins: [
404
- typeof input !== 'string' ? (0, plugin_virtual_1.default)(input) : null,
405
- (0, rollup_plugin_vue_1.default)({ preprocessStyles: true }),
406
- languages.includes('typescript') ? (0, rollup_plugin_typescript2_1.default)({ check: false }) : null,
407
- (0, rollup_plugin_styles_1.default)(),
408
- ...plugins,
409
- (0, plugin_node_resolve_1.nodeResolve)({ browser: true }),
410
- (0, plugin_commonjs_1.default)({ esmExternals: true, sourceMap: sourcemap }),
411
- (0, plugin_json_1.default)(),
412
- (0, plugin_replace_1.default)({
413
- values: {
414
- 'process.env.NODE_ENV': JSON.stringify('production'),
415
- },
416
- preventAssignment: true,
417
- }),
418
- minify ? (0, plugin_terser_1.default)() : null,
419
- ],
420
- };
421
- }
422
- else {
423
- return {
424
- input: typeof input !== 'string' ? 'entry' : input,
425
- external: constants_1.API_SHARED_DEPS,
426
- plugins: [
427
- typeof input !== 'string' ? (0, plugin_virtual_1.default)(input) : null,
428
- languages.includes('typescript') ? (0, rollup_plugin_typescript2_1.default)({ check: false }) : null,
429
- ...plugins,
430
- (0, plugin_node_resolve_1.nodeResolve)(),
431
- (0, plugin_commonjs_1.default)({ sourceMap: sourcemap }),
432
- (0, plugin_json_1.default)(),
433
- (0, plugin_replace_1.default)({
434
- values: {
435
- 'process.env.NODE_ENV': JSON.stringify('production'),
436
- },
437
- preventAssignment: true,
438
- }),
439
- minify ? (0, plugin_terser_1.default)() : null,
440
- ],
441
- };
442
- }
399
+ return {
400
+ input: typeof input !== 'string' ? 'entry' : input,
401
+ external: mode === 'browser' ? constants_1.APP_SHARED_DEPS : constants_1.API_SHARED_DEPS,
402
+ plugins: [
403
+ typeof input !== 'string' ? (0, plugin_virtual_1.default)(input) : null,
404
+ mode === 'browser' ? (0, rollup_plugin_vue_1.default)({ preprocessStyles: true }) : null,
405
+ languages.includes('typescript') ? (0, rollup_plugin_esbuild_1.default)({ include: /\.tsx?$/, sourceMap: sourcemap }) : null,
406
+ mode === 'browser' ? (0, rollup_plugin_styles_1.default)() : null,
407
+ ...plugins,
408
+ (0, plugin_node_resolve_1.nodeResolve)({ browser: mode === 'browser' }),
409
+ (0, plugin_commonjs_1.default)({ esmExternals: mode === 'browser', sourceMap: sourcemap }),
410
+ (0, plugin_json_1.default)(),
411
+ (0, plugin_replace_1.default)({
412
+ values: {
413
+ 'process.env.NODE_ENV': JSON.stringify('production'),
414
+ },
415
+ preventAssignment: true,
416
+ }),
417
+ minify ? (0, plugin_terser_1.default)() : null,
418
+ ],
419
+ };
443
420
  }
444
421
  function getRollupOutputOptions({ mode, output, sourcemap, }) {
445
- if (mode === 'browser') {
446
- return {
447
- file: output,
448
- format: 'es',
449
- inlineDynamicImports: true,
450
- sourcemap,
451
- };
452
- }
453
- else {
454
- return {
455
- file: output,
456
- format: 'cjs',
457
- exports: 'auto',
458
- inlineDynamicImports: true,
459
- sourcemap,
460
- };
461
- }
422
+ return {
423
+ file: output,
424
+ format: mode === 'browser' ? 'es' : 'cjs',
425
+ exports: 'auto',
426
+ inlineDynamicImports: true,
427
+ sourcemap,
428
+ };
462
429
  }
463
430
  function formatRollupError(error) {
464
431
  var _a;
@@ -11,8 +11,8 @@ import fse from 'fs-extra';
11
11
  import ora from 'ora';
12
12
  import path from 'path';
13
13
  import { rollup, watch as rollupWatch, } from 'rollup';
14
+ import esbuild from 'rollup-plugin-esbuild';
14
15
  import styles from 'rollup-plugin-styles';
15
- import typescript from 'rollup-plugin-typescript2';
16
16
  import vue from 'rollup-plugin-vue';
17
17
  import { getLanguageFromPath, isLanguage } from '../utils/languages';
18
18
  import { clear, log } from '../utils/logger';
@@ -390,69 +390,36 @@ async function watchExtension(config) {
390
390
  }
391
391
  function getRollupOptions({ mode, input, language, sourcemap, minify, plugins, }) {
392
392
  const languages = Array.isArray(language) ? language : [language];
393
- if (mode === 'browser') {
394
- return {
395
- input: typeof input !== 'string' ? 'entry' : input,
396
- external: APP_SHARED_DEPS,
397
- plugins: [
398
- typeof input !== 'string' ? virtual(input) : null,
399
- vue({ preprocessStyles: true }),
400
- languages.includes('typescript') ? typescript({ check: false }) : null,
401
- styles(),
402
- ...plugins,
403
- nodeResolve({ browser: true }),
404
- commonjs({ esmExternals: true, sourceMap: sourcemap }),
405
- json(),
406
- replace({
407
- values: {
408
- 'process.env.NODE_ENV': JSON.stringify('production'),
409
- },
410
- preventAssignment: true,
411
- }),
412
- minify ? terser() : null,
413
- ],
414
- };
415
- }
416
- else {
417
- return {
418
- input: typeof input !== 'string' ? 'entry' : input,
419
- external: API_SHARED_DEPS,
420
- plugins: [
421
- typeof input !== 'string' ? virtual(input) : null,
422
- languages.includes('typescript') ? typescript({ check: false }) : null,
423
- ...plugins,
424
- nodeResolve(),
425
- commonjs({ sourceMap: sourcemap }),
426
- json(),
427
- replace({
428
- values: {
429
- 'process.env.NODE_ENV': JSON.stringify('production'),
430
- },
431
- preventAssignment: true,
432
- }),
433
- minify ? terser() : null,
434
- ],
435
- };
436
- }
393
+ return {
394
+ input: typeof input !== 'string' ? 'entry' : input,
395
+ external: mode === 'browser' ? APP_SHARED_DEPS : API_SHARED_DEPS,
396
+ plugins: [
397
+ typeof input !== 'string' ? virtual(input) : null,
398
+ mode === 'browser' ? vue({ preprocessStyles: true }) : null,
399
+ languages.includes('typescript') ? esbuild({ include: /\.tsx?$/, sourceMap: sourcemap }) : null,
400
+ mode === 'browser' ? styles() : null,
401
+ ...plugins,
402
+ nodeResolve({ browser: mode === 'browser' }),
403
+ commonjs({ esmExternals: mode === 'browser', sourceMap: sourcemap }),
404
+ json(),
405
+ replace({
406
+ values: {
407
+ 'process.env.NODE_ENV': JSON.stringify('production'),
408
+ },
409
+ preventAssignment: true,
410
+ }),
411
+ minify ? terser() : null,
412
+ ],
413
+ };
437
414
  }
438
415
  function getRollupOutputOptions({ mode, output, sourcemap, }) {
439
- if (mode === 'browser') {
440
- return {
441
- file: output,
442
- format: 'es',
443
- inlineDynamicImports: true,
444
- sourcemap,
445
- };
446
- }
447
- else {
448
- return {
449
- file: output,
450
- format: 'cjs',
451
- exports: 'auto',
452
- inlineDynamicImports: true,
453
- sourcemap,
454
- };
455
- }
416
+ return {
417
+ file: output,
418
+ format: mode === 'browser' ? 'es' : 'cjs',
419
+ exports: 'auto',
420
+ inlineDynamicImports: true,
421
+ sourcemap,
422
+ };
456
423
  }
457
424
  function formatRollupError(error) {
458
425
  var _a;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@directus/extensions-sdk",
3
- "version": "9.21.0",
3
+ "version": "9.21.2",
4
4
  "description": "A toolkit to develop extensions to extend Directus",
5
5
  "homepage": "https://directus.io",
6
6
  "bugs": {
@@ -41,7 +41,6 @@
41
41
  "!**/*.d.ts.map"
42
42
  ],
43
43
  "dependencies": {
44
- "@directus/shared": "9.21.0",
45
44
  "@rollup/plugin-commonjs": "23.0.2",
46
45
  "@rollup/plugin-json": "5.0.1",
47
46
  "@rollup/plugin-node-resolve": "15.0.1",
@@ -51,21 +50,22 @@
51
50
  "@vue/compiler-sfc": "3.2.45",
52
51
  "chalk": "4.1.1",
53
52
  "commander": "9.4.1",
53
+ "esbuild": "0.15.14",
54
54
  "execa": "5.1.1",
55
55
  "fs-extra": "10.1.0",
56
- "inquirer": "^8.2.4",
56
+ "inquirer": "8.2.4",
57
57
  "ora": "5.4.0",
58
58
  "rollup": "3.3.0",
59
+ "rollup-plugin-esbuild": "5.0.0",
59
60
  "rollup-plugin-styles": "4.0.0",
60
- "rollup-plugin-typescript2": "0.34.1",
61
- "rollup-plugin-vue": "6.0.0"
61
+ "rollup-plugin-vue": "6.0.0",
62
+ "@directus/shared": "9.21.2"
62
63
  },
63
64
  "devDependencies": {
64
65
  "@types/fs-extra": "9.0.13",
65
66
  "@types/inquirer": "8.2.1",
66
67
  "@vitest/coverage-c8": "0.25.2",
67
- "npm-run-all": "4.1.5",
68
- "rimraf": "3.0.2",
68
+ "concurrently": "7.5.0",
69
69
  "typescript": "4.9.3",
70
70
  "vitest": "0.25.2"
71
71
  },
@@ -76,13 +76,12 @@
76
76
  "access": "public"
77
77
  },
78
78
  "scripts": {
79
- "build": "run-p \"build:* {@}\"",
79
+ "build": "concurrently --prefix-colors auto --passthrough-arguments \"pnpm:build:* {@}\"",
80
80
  "build:esm": "tsc --project ./tsconfig.json --module ES2015 --outDir ./dist/esm",
81
81
  "build:cjs": "tsc --project ./tsconfig.json --module CommonJS --outDir ./dist/cjs",
82
82
  "test": "vitest run",
83
83
  "test:watch": "vitest",
84
84
  "test:coverage": "vitest run --coverage",
85
- "cleanup": "rimraf ./dist",
86
85
  "dev": "pnpm build -- -w --preserveWatchOutput --incremental"
87
86
  }
88
87
  }
@@ -22,8 +22,7 @@
22
22
  "forceConsistentCasingInFileNames": true,
23
23
  "allowSyntheticDefaultImports": true,
24
24
  "isolatedModules": true,
25
- "rootDir": "./src",
26
- "sourceMap": true
25
+ "rootDir": "./src"
27
26
  },
28
27
  "include": ["./src/**/*.ts"]
29
28
  }