@directus/extensions-sdk 9.0.1 → 9.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/dist/cjs/cli/commands/build.d.ts +1 -0
- package/dist/cjs/cli/commands/build.d.ts.map +1 -1
- package/dist/cjs/cli/commands/build.js +7 -6
- package/dist/cjs/cli/run.js +1 -0
- package/dist/cjs/cli/utils/load-config.d.ts.map +1 -1
- package/dist/cjs/cli/utils/load-config.js +1 -1
- package/dist/esm/cli/commands/build.d.ts +1 -0
- package/dist/esm/cli/commands/build.d.ts.map +1 -1
- package/dist/esm/cli/commands/build.js +7 -6
- package/dist/esm/cli/run.js +1 -0
- package/dist/esm/cli/utils/load-config.d.ts.map +1 -1
- package/dist/esm/cli/utils/load-config.js +1 -1
- package/package.json +5 -5
- package/src/cli/commands/build.ts +17 -7
- package/src/cli/run.ts +1 -0
- package/src/cli/utils/load-config.ts +3 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/build.ts"],"names":[],"mappings":"AA4BA,aAAK,YAAY,GAAG;
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/build.ts"],"names":[],"mappings":"AA4BA,aAAK,YAAY,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,wBAA8B,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA6FxE"}
|
|
@@ -60,8 +60,8 @@ async function build(options) {
|
|
|
60
60
|
}
|
|
61
61
|
const config = await (0, load_config_1.default)();
|
|
62
62
|
const spinner = (0, ora_1.default)('Building Directus extension...').start();
|
|
63
|
-
const rollupOptions = getRollupOptions(type, language, input, config.plugins);
|
|
64
|
-
const rollupOutputOptions = getRollupOutputOptions(type, output);
|
|
63
|
+
const rollupOptions = getRollupOptions(type, language, input, config.plugins, options);
|
|
64
|
+
const rollupOutputOptions = getRollupOutputOptions(type, output, options);
|
|
65
65
|
if (options.watch) {
|
|
66
66
|
const watcher = (0, rollup_1.watch)({
|
|
67
67
|
...rollupOptions,
|
|
@@ -101,7 +101,7 @@ async function build(options) {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
exports.default = build;
|
|
104
|
-
function getRollupOptions(type, language, input, plugins = []) {
|
|
104
|
+
function getRollupOptions(type, language, input, plugins = [], options) {
|
|
105
105
|
if ((0, utils_1.isAppExtension)(type)) {
|
|
106
106
|
return {
|
|
107
107
|
input,
|
|
@@ -120,7 +120,7 @@ function getRollupOptions(type, language, input, plugins = []) {
|
|
|
120
120
|
},
|
|
121
121
|
preventAssignment: true,
|
|
122
122
|
}),
|
|
123
|
-
(0, rollup_plugin_terser_1.terser)(),
|
|
123
|
+
options.sourceMaps ? null : (0, rollup_plugin_terser_1.terser)(),
|
|
124
124
|
],
|
|
125
125
|
};
|
|
126
126
|
}
|
|
@@ -140,12 +140,12 @@ function getRollupOptions(type, language, input, plugins = []) {
|
|
|
140
140
|
},
|
|
141
141
|
preventAssignment: true,
|
|
142
142
|
}),
|
|
143
|
-
(0, rollup_plugin_terser_1.terser)(),
|
|
143
|
+
options.sourceMaps ? null : (0, rollup_plugin_terser_1.terser)(),
|
|
144
144
|
],
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
-
function getRollupOutputOptions(type, output) {
|
|
148
|
+
function getRollupOutputOptions(type, output, options) {
|
|
149
149
|
if ((0, utils_1.isAppExtension)(type)) {
|
|
150
150
|
return {
|
|
151
151
|
file: output,
|
|
@@ -157,6 +157,7 @@ function getRollupOutputOptions(type, output) {
|
|
|
157
157
|
file: output,
|
|
158
158
|
format: 'cjs',
|
|
159
159
|
exports: 'default',
|
|
160
|
+
sourcemap: options.sourceMaps,
|
|
160
161
|
};
|
|
161
162
|
}
|
|
162
163
|
}
|
package/dist/cjs/cli/run.js
CHANGED
|
@@ -25,5 +25,6 @@ program
|
|
|
25
25
|
.option('-l, --language <language>', 'overwrite the language to use')
|
|
26
26
|
.option('-f, --force', 'ignore the package manifest')
|
|
27
27
|
.option('-w, --watch', 'watch and rebuild on changes')
|
|
28
|
+
.option('-m --sourceMaps', 'include source maps in output')
|
|
28
29
|
.action(build_1.default);
|
|
29
30
|
program.parse(process.argv);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-config.d.ts","sourceRoot":"","sources":["../../../../src/cli/utils/load-config.ts"],"names":[],"mappings":"AAQA,wBAA8B,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"load-config.d.ts","sourceRoot":"","sources":["../../../../src/cli/utils/load-config.ts"],"names":[],"mappings":"AAQA,wBAA8B,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAYvE"}
|
|
@@ -11,7 +11,7 @@ const _import = new Function('url', 'return import(url)');
|
|
|
11
11
|
async function loadConfig() {
|
|
12
12
|
for (const fileName of CONFIG_FILE_NAMES) {
|
|
13
13
|
if (await fs_extra_1.default.pathExists(fileName)) {
|
|
14
|
-
const configFile = await _import(path_1.default.join(process.cwd(), fileName));
|
|
14
|
+
const configFile = await _import(path_1.default.relative(__dirname, path_1.default.join(process.cwd(), fileName)).split(path_1.default.sep).join(path_1.default.posix.sep));
|
|
15
15
|
return configFile.default;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/build.ts"],"names":[],"mappings":"AA4BA,aAAK,YAAY,GAAG;
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/build.ts"],"names":[],"mappings":"AA4BA,aAAK,YAAY,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,wBAA8B,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA6FxE"}
|
|
@@ -55,8 +55,8 @@ export default async function build(options) {
|
|
|
55
55
|
}
|
|
56
56
|
const config = await loadConfig();
|
|
57
57
|
const spinner = ora('Building Directus extension...').start();
|
|
58
|
-
const rollupOptions = getRollupOptions(type, language, input, config.plugins);
|
|
59
|
-
const rollupOutputOptions = getRollupOutputOptions(type, output);
|
|
58
|
+
const rollupOptions = getRollupOptions(type, language, input, config.plugins, options);
|
|
59
|
+
const rollupOutputOptions = getRollupOutputOptions(type, output, options);
|
|
60
60
|
if (options.watch) {
|
|
61
61
|
const watcher = rollupWatch({
|
|
62
62
|
...rollupOptions,
|
|
@@ -95,7 +95,7 @@ export default async function build(options) {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
function getRollupOptions(type, language, input, plugins = []) {
|
|
98
|
+
function getRollupOptions(type, language, input, plugins = [], options) {
|
|
99
99
|
if (isAppExtension(type)) {
|
|
100
100
|
return {
|
|
101
101
|
input,
|
|
@@ -114,7 +114,7 @@ function getRollupOptions(type, language, input, plugins = []) {
|
|
|
114
114
|
},
|
|
115
115
|
preventAssignment: true,
|
|
116
116
|
}),
|
|
117
|
-
terser(),
|
|
117
|
+
options.sourceMaps ? null : terser(),
|
|
118
118
|
],
|
|
119
119
|
};
|
|
120
120
|
}
|
|
@@ -134,12 +134,12 @@ function getRollupOptions(type, language, input, plugins = []) {
|
|
|
134
134
|
},
|
|
135
135
|
preventAssignment: true,
|
|
136
136
|
}),
|
|
137
|
-
terser(),
|
|
137
|
+
options.sourceMaps ? null : terser(),
|
|
138
138
|
],
|
|
139
139
|
};
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
function getRollupOutputOptions(type, output) {
|
|
142
|
+
function getRollupOutputOptions(type, output, options) {
|
|
143
143
|
if (isAppExtension(type)) {
|
|
144
144
|
return {
|
|
145
145
|
file: output,
|
|
@@ -151,6 +151,7 @@ function getRollupOutputOptions(type, output) {
|
|
|
151
151
|
file: output,
|
|
152
152
|
format: 'cjs',
|
|
153
153
|
exports: 'default',
|
|
154
|
+
sourcemap: options.sourceMaps,
|
|
154
155
|
};
|
|
155
156
|
}
|
|
156
157
|
}
|
package/dist/esm/cli/run.js
CHANGED
|
@@ -20,5 +20,6 @@ program
|
|
|
20
20
|
.option('-l, --language <language>', 'overwrite the language to use')
|
|
21
21
|
.option('-f, --force', 'ignore the package manifest')
|
|
22
22
|
.option('-w, --watch', 'watch and rebuild on changes')
|
|
23
|
+
.option('-m --sourceMaps', 'include source maps in output')
|
|
23
24
|
.action(build);
|
|
24
25
|
program.parse(process.argv);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-config.d.ts","sourceRoot":"","sources":["../../../../src/cli/utils/load-config.ts"],"names":[],"mappings":"AAQA,wBAA8B,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"load-config.d.ts","sourceRoot":"","sources":["../../../../src/cli/utils/load-config.ts"],"names":[],"mappings":"AAQA,wBAA8B,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAYvE"}
|
|
@@ -6,7 +6,7 @@ const _import = new Function('url', 'return import(url)');
|
|
|
6
6
|
export default async function loadConfig() {
|
|
7
7
|
for (const fileName of CONFIG_FILE_NAMES) {
|
|
8
8
|
if (await fse.pathExists(fileName)) {
|
|
9
|
-
const configFile = await _import(path.join(process.cwd(), fileName));
|
|
9
|
+
const configFile = await _import(path.relative(__dirname, path.join(process.cwd(), fileName)).split(path.sep).join(path.posix.sep));
|
|
10
10
|
return configFile.default;
|
|
11
11
|
}
|
|
12
12
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@directus/extensions-sdk",
|
|
3
|
-
"version": "9.0
|
|
3
|
+
"version": "9.2.0",
|
|
4
4
|
"description": "A toolkit to develop extensions to extend Directus.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"node": ">=12.20.0"
|
|
30
30
|
},
|
|
31
31
|
"author": "Nicola Krumschmidt",
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "776c105aacfda559a1ebf49cb2220599652f6c48",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@directus/shared": "9.0
|
|
34
|
+
"@directus/shared": "9.2.0",
|
|
35
35
|
"@rollup/plugin-commonjs": "^21.0.0",
|
|
36
36
|
"@rollup/plugin-json": "^4.1.0",
|
|
37
37
|
"@rollup/plugin-node-resolve": "^13.0.0",
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
"rollup": "^2.51.2",
|
|
46
46
|
"rollup-plugin-styles": "^3.14.1",
|
|
47
47
|
"rollup-plugin-terser": "^7.0.2",
|
|
48
|
-
"rollup-plugin-typescript2": "^0.
|
|
48
|
+
"rollup-plugin-typescript2": "^0.31.0",
|
|
49
49
|
"rollup-plugin-vue": "^6.0.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"npm-run-all": "4.1.5",
|
|
53
53
|
"rimraf": "3.0.2",
|
|
54
|
-
"typescript": "4.
|
|
54
|
+
"typescript": "4.5.2"
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -26,7 +26,15 @@ import { getLanguageFromPath, isLanguage } from '../utils/languages';
|
|
|
26
26
|
import { Language } from '../types';
|
|
27
27
|
import loadConfig from '../utils/load-config';
|
|
28
28
|
|
|
29
|
-
type BuildOptions = {
|
|
29
|
+
type BuildOptions = {
|
|
30
|
+
type: string;
|
|
31
|
+
input: string;
|
|
32
|
+
output: string;
|
|
33
|
+
language: string;
|
|
34
|
+
force: boolean;
|
|
35
|
+
watch: boolean;
|
|
36
|
+
sourceMaps: boolean;
|
|
37
|
+
};
|
|
30
38
|
|
|
31
39
|
export default async function build(options: BuildOptions): Promise<void> {
|
|
32
40
|
const packagePath = path.resolve('package.json');
|
|
@@ -79,8 +87,8 @@ export default async function build(options: BuildOptions): Promise<void> {
|
|
|
79
87
|
|
|
80
88
|
const spinner = ora('Building Directus extension...').start();
|
|
81
89
|
|
|
82
|
-
const rollupOptions = getRollupOptions(type, language, input, config.plugins);
|
|
83
|
-
const rollupOutputOptions = getRollupOutputOptions(type, output);
|
|
90
|
+
const rollupOptions = getRollupOptions(type, language, input, config.plugins, options);
|
|
91
|
+
const rollupOutputOptions = getRollupOutputOptions(type, output, options);
|
|
84
92
|
|
|
85
93
|
if (options.watch) {
|
|
86
94
|
const watcher = rollupWatch({
|
|
@@ -127,7 +135,8 @@ function getRollupOptions(
|
|
|
127
135
|
type: ExtensionType,
|
|
128
136
|
language: Language,
|
|
129
137
|
input: string,
|
|
130
|
-
plugins: Plugin[] = []
|
|
138
|
+
plugins: Plugin[] = [],
|
|
139
|
+
options: BuildOptions
|
|
131
140
|
): RollupOptions {
|
|
132
141
|
if (isAppExtension(type)) {
|
|
133
142
|
return {
|
|
@@ -147,7 +156,7 @@ function getRollupOptions(
|
|
|
147
156
|
},
|
|
148
157
|
preventAssignment: true,
|
|
149
158
|
}),
|
|
150
|
-
terser(),
|
|
159
|
+
options.sourceMaps ? null : terser(),
|
|
151
160
|
],
|
|
152
161
|
};
|
|
153
162
|
} else {
|
|
@@ -166,13 +175,13 @@ function getRollupOptions(
|
|
|
166
175
|
},
|
|
167
176
|
preventAssignment: true,
|
|
168
177
|
}),
|
|
169
|
-
terser(),
|
|
178
|
+
options.sourceMaps ? null : terser(),
|
|
170
179
|
],
|
|
171
180
|
};
|
|
172
181
|
}
|
|
173
182
|
}
|
|
174
183
|
|
|
175
|
-
function getRollupOutputOptions(type: ExtensionType, output: string): RollupOutputOptions {
|
|
184
|
+
function getRollupOutputOptions(type: ExtensionType, output: string, options: BuildOptions): RollupOutputOptions {
|
|
176
185
|
if (isAppExtension(type)) {
|
|
177
186
|
return {
|
|
178
187
|
file: output,
|
|
@@ -183,6 +192,7 @@ function getRollupOutputOptions(type: ExtensionType, output: string): RollupOutp
|
|
|
183
192
|
file: output,
|
|
184
193
|
format: 'cjs',
|
|
185
194
|
exports: 'default',
|
|
195
|
+
sourcemap: options.sourceMaps,
|
|
186
196
|
};
|
|
187
197
|
}
|
|
188
198
|
}
|
package/src/cli/run.ts
CHANGED
|
@@ -25,6 +25,7 @@ program
|
|
|
25
25
|
.option('-l, --language <language>', 'overwrite the language to use')
|
|
26
26
|
.option('-f, --force', 'ignore the package manifest')
|
|
27
27
|
.option('-w, --watch', 'watch and rebuild on changes')
|
|
28
|
+
.option('-m --sourceMaps', 'include source maps in output')
|
|
28
29
|
.action(build);
|
|
29
30
|
|
|
30
31
|
program.parse(process.argv);
|
|
@@ -9,7 +9,9 @@ const _import = new Function('url', 'return import(url)');
|
|
|
9
9
|
export default async function loadConfig(): Promise<Record<string, any>> {
|
|
10
10
|
for (const fileName of CONFIG_FILE_NAMES) {
|
|
11
11
|
if (await fse.pathExists(fileName)) {
|
|
12
|
-
const configFile = await _import(
|
|
12
|
+
const configFile = await _import(
|
|
13
|
+
path.relative(__dirname, path.join(process.cwd(), fileName)).split(path.sep).join(path.posix.sep)
|
|
14
|
+
);
|
|
13
15
|
|
|
14
16
|
return configFile.default;
|
|
15
17
|
}
|