@sanity/pkg-utils 2.0.4-beta.1 → 2.0.5
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/LICENSE +1 -1
- package/dist/_chunks/{build-77dacddc.cjs → build-39c45d5c.cjs} +11 -7
- package/dist/_chunks/{build-77dacddc.cjs.map → build-39c45d5c.cjs.map} +1 -1
- package/dist/_chunks/buildAction-e21a8aeb.cjs +49 -0
- package/dist/_chunks/{buildAction-15e03999.cjs.map → buildAction-e21a8aeb.cjs.map} +1 -1
- package/dist/_chunks/{check-4c6bb15d.cjs → check-60977fef.cjs} +2 -2
- package/dist/_chunks/{check-4c6bb15d.cjs.map → check-60977fef.cjs.map} +1 -1
- package/dist/_chunks/checkAction-bf0f2047.cjs +31 -0
- package/dist/_chunks/{checkAction-fa6a293a.cjs.map → checkAction-bf0f2047.cjs.map} +1 -1
- package/dist/_chunks/{index-03f2cc83.cjs → index-fbd66d35.cjs} +41 -53
- package/dist/_chunks/index-fbd66d35.cjs.map +1 -0
- package/dist/_chunks/{resolveBuildContext-65b5c5d5.cjs → resolveBuildContext-8833c9b4.cjs} +26 -22
- package/dist/_chunks/resolveBuildContext-8833c9b4.cjs.map +1 -0
- package/dist/_chunks/{watch-2663890e.cjs → watch-8c069c12.cjs} +11 -7
- package/dist/_chunks/{watch-2663890e.cjs.map → watch-8c069c12.cjs.map} +1 -1
- package/dist/_chunks/watchAction-b5f7b64b.cjs +51 -0
- package/dist/_chunks/{watchAction-808ed88d.cjs.map → watchAction-b5f7b64b.cjs.map} +1 -1
- package/dist/cli.cjs +4 -4
- package/dist/index.cjs +40 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +65 -80
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/src/node/core/pkg/loadPkgWithReporting.ts +7 -1
- package/src/node/core/pkg/types.ts +1 -1
- package/src/node/core/pkg/validateExports.ts +1 -1
- package/src/node/core/pkg/validatePkg.ts +2 -4
- package/src/node/tasks/rollup/resolveRollupConfig.ts +3 -8
- package/dist/_chunks/buildAction-15e03999.cjs +0 -18
- package/dist/_chunks/checkAction-fa6a293a.cjs +0 -17
- package/dist/_chunks/index-03f2cc83.cjs.map +0 -1
- package/dist/_chunks/resolveBuildContext-65b5c5d5.cjs.map +0 -1
- package/dist/_chunks/watchAction-808ed88d.cjs +0 -17
package/dist/index.cjs
CHANGED
|
@@ -3,11 +3,46 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
var build = require('./_chunks/build-
|
|
7
|
-
var check = require('./_chunks/check-
|
|
8
|
-
var resolveBuildContext = require('./_chunks/resolveBuildContext-
|
|
9
|
-
var index = require('./_chunks/index-
|
|
10
|
-
var watch = require('./_chunks/watch-
|
|
6
|
+
var build = require('./_chunks/build-39c45d5c.cjs');
|
|
7
|
+
var check = require('./_chunks/check-60977fef.cjs');
|
|
8
|
+
var resolveBuildContext = require('./_chunks/resolveBuildContext-8833c9b4.cjs');
|
|
9
|
+
var index = require('./_chunks/index-fbd66d35.cjs');
|
|
10
|
+
var watch = require('./_chunks/watch-8c069c12.cjs');
|
|
11
|
+
require('fs/promises');
|
|
12
|
+
require('pkg-up');
|
|
13
|
+
require('typescript');
|
|
14
|
+
require('fs');
|
|
15
|
+
require('path');
|
|
16
|
+
require('chalk');
|
|
17
|
+
require('esbuild');
|
|
18
|
+
require('treeify');
|
|
19
|
+
require('pretty-bytes');
|
|
20
|
+
require('esbuild-register/dist/node');
|
|
21
|
+
require('find-config');
|
|
22
|
+
require('zod');
|
|
23
|
+
require('browserslist');
|
|
24
|
+
require('rxjs');
|
|
25
|
+
require('util');
|
|
26
|
+
require('rimraf');
|
|
27
|
+
require('@microsoft/api-extractor');
|
|
28
|
+
require('mkdirp');
|
|
29
|
+
require('prettier');
|
|
30
|
+
require('@microsoft/tsdoc-config');
|
|
31
|
+
require('jsonc-parser');
|
|
32
|
+
require('recast');
|
|
33
|
+
require('recast/parsers/typescript');
|
|
34
|
+
require('rollup');
|
|
35
|
+
require('@rollup/plugin-alias');
|
|
36
|
+
require('@rollup/plugin-babel');
|
|
37
|
+
require('@rollup/plugin-commonjs');
|
|
38
|
+
require('@rollup/plugin-json');
|
|
39
|
+
require('@rollup/plugin-node-resolve');
|
|
40
|
+
require('@rollup/plugin-replace');
|
|
41
|
+
require('@rollup/plugin-terser');
|
|
42
|
+
require('rollup-plugin-esbuild');
|
|
43
|
+
require('rxjs/operators');
|
|
44
|
+
require('globby');
|
|
45
|
+
require('chokidar');
|
|
11
46
|
function defineConfig(configOptions) {
|
|
12
47
|
return configOptions;
|
|
13
48
|
}
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/node/core/config/defineConfig.ts"],"sourcesContent":["import {PkgConfigOptions} from './types'\n\n/** @public */\nexport function defineConfig(configOptions: PkgConfigOptions): PkgConfigOptions {\n return configOptions\n}\n"],"names":["defineConfig","configOptions"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/node/core/config/defineConfig.ts"],"sourcesContent":["import {PkgConfigOptions} from './types'\n\n/** @public */\nexport function defineConfig(configOptions: PkgConfigOptions): PkgConfigOptions {\n return configOptions\n}\n"],"names":["defineConfig","configOptions"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,SAASA,aAAaC,aAAmD,EAAA;EACvE,OAAAA,aAAA;AACT;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
const _excluded = ["_path"];
|
|
2
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
3
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
8
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
1
9
|
import path from 'path';
|
|
2
10
|
import { register } from 'esbuild-register/dist/node';
|
|
3
11
|
import pkgUp from 'pkg-up';
|
|
@@ -100,7 +108,7 @@ function defineConfig(configOptions) {
|
|
|
100
108
|
return configOptions;
|
|
101
109
|
}
|
|
102
110
|
const pkgSchema = z.object({
|
|
103
|
-
type: z.enum(["commonjs", "module"]),
|
|
111
|
+
type: z.optional(z.enum(["commonjs", "module"])),
|
|
104
112
|
name: z.string(),
|
|
105
113
|
version: z.string(),
|
|
106
114
|
license: z.string(),
|
|
@@ -133,11 +141,7 @@ const pkgSchema = z.object({
|
|
|
133
141
|
browserslist: z.optional(z.array(z.string()))
|
|
134
142
|
});
|
|
135
143
|
function validatePkg(input) {
|
|
136
|
-
|
|
137
|
-
return {
|
|
138
|
-
...pkg,
|
|
139
|
-
type: pkg.type || "commonjs"
|
|
140
|
-
};
|
|
144
|
+
return pkgSchema.parse(input);
|
|
141
145
|
}
|
|
142
146
|
async function loadPkg(options) {
|
|
143
147
|
const {
|
|
@@ -156,9 +160,13 @@ async function loadPkgWithReporting(options) {
|
|
|
156
160
|
logger
|
|
157
161
|
} = options;
|
|
158
162
|
try {
|
|
159
|
-
|
|
163
|
+
const pkg = await loadPkg({
|
|
160
164
|
cwd
|
|
161
165
|
});
|
|
166
|
+
if (pkg.type === void 0) {
|
|
167
|
+
logger.warn('no "type" field in package.json, defaulting to "commonjs"');
|
|
168
|
+
}
|
|
169
|
+
return pkg;
|
|
162
170
|
} catch (err) {
|
|
163
171
|
if (err instanceof ZodError) {
|
|
164
172
|
for (const issue of err.issues) {
|
|
@@ -189,7 +197,7 @@ function validateExports(_exports, options) {
|
|
|
189
197
|
extMap,
|
|
190
198
|
pkg
|
|
191
199
|
} = options;
|
|
192
|
-
const ext = extMap[pkg.type];
|
|
200
|
+
const ext = extMap[pkg.type || "commonjs"];
|
|
193
201
|
const errors = [];
|
|
194
202
|
for (const exp of _exports) {
|
|
195
203
|
if (exp.require && !exp.require.endsWith(ext.commonjs)) {
|
|
@@ -250,11 +258,10 @@ function parseExports(options) {
|
|
|
250
258
|
}
|
|
251
259
|
Object.assign(rootExport, exportEntry);
|
|
252
260
|
} else {
|
|
253
|
-
const extraExport = {
|
|
261
|
+
const extraExport = _objectSpread({
|
|
254
262
|
_exported: true,
|
|
255
|
-
_path: exportPath
|
|
256
|
-
|
|
257
|
-
};
|
|
263
|
+
_path: exportPath
|
|
264
|
+
}, exportEntry);
|
|
258
265
|
extraExports.push(extraExport);
|
|
259
266
|
}
|
|
260
267
|
} else {
|
|
@@ -286,9 +293,7 @@ function getPkgExtMap(options) {
|
|
|
286
293
|
const {
|
|
287
294
|
legacyExports
|
|
288
295
|
} = options;
|
|
289
|
-
const ret = {
|
|
290
|
-
...DEFAULT_PKG_EXT_MAP
|
|
291
|
-
};
|
|
296
|
+
const ret = _objectSpread({}, DEFAULT_PKG_EXT_MAP);
|
|
292
297
|
if (legacyExports) {
|
|
293
298
|
ret["commonjs"] = {
|
|
294
299
|
commonjs: ".js",
|
|
@@ -477,13 +482,12 @@ async function resolveBuildContext(options) {
|
|
|
477
482
|
strict
|
|
478
483
|
}).reduce((acc, x) => {
|
|
479
484
|
const {
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
return {
|
|
484
|
-
...acc,
|
|
485
|
+
_path: exportPath
|
|
486
|
+
} = x,
|
|
487
|
+
exportEntry = _objectWithoutProperties(x, _excluded);
|
|
488
|
+
return _objectSpread(_objectSpread({}, acc), {}, {
|
|
485
489
|
[exportPath]: exportEntry
|
|
486
|
-
};
|
|
490
|
+
});
|
|
487
491
|
}, {});
|
|
488
492
|
const exports = resolveConfigProperty(config == null ? void 0 : config.exports, parsedExports);
|
|
489
493
|
const parsedExternal = [...(pkg.dependencies ? Object.keys(pkg.dependencies) : []), ...(pkg.peerDependencies ? Object.keys(pkg.peerDependencies) : [])];
|
|
@@ -541,10 +545,9 @@ function resolveBuildTasks(ctx) {
|
|
|
541
545
|
const tasks = [];
|
|
542
546
|
const exports = Object.entries(ctx.exports || {}).map(_ref2 => {
|
|
543
547
|
let [_path, exp] = _ref2;
|
|
544
|
-
return {
|
|
545
|
-
_path
|
|
546
|
-
|
|
547
|
-
};
|
|
548
|
+
return _objectSpread({
|
|
549
|
+
_path
|
|
550
|
+
}, exp);
|
|
548
551
|
});
|
|
549
552
|
const dtsTask = {
|
|
550
553
|
type: "build:dts",
|
|
@@ -725,14 +728,13 @@ async function buildTypes(options) {
|
|
|
725
728
|
tsconfig,
|
|
726
729
|
strict = false
|
|
727
730
|
} = options;
|
|
728
|
-
const compilerOptions = {
|
|
729
|
-
...tsconfig.options,
|
|
731
|
+
const compilerOptions = _objectSpread(_objectSpread({}, tsconfig.options), {}, {
|
|
730
732
|
declaration: true,
|
|
731
733
|
declarationDir: outDir,
|
|
732
734
|
emitDeclarationOnly: true,
|
|
733
735
|
noEmit: false,
|
|
734
736
|
outDir
|
|
735
|
-
};
|
|
737
|
+
});
|
|
736
738
|
const program = ts.createProgram(tsconfig.fileNames, compilerOptions);
|
|
737
739
|
const emitResult = program.emit();
|
|
738
740
|
const allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
|
|
@@ -806,18 +808,15 @@ async function createTSDocConfig(opts) {
|
|
|
806
808
|
syntaxKind: t.syntaxKind,
|
|
807
809
|
allowMultiple: t.allowMultiple
|
|
808
810
|
})));
|
|
809
|
-
const supportForTags = {
|
|
810
|
-
...tsDocBaseConfig.supportForTags
|
|
811
|
-
};
|
|
811
|
+
const supportForTags = _objectSpread({}, tsDocBaseConfig.supportForTags);
|
|
812
812
|
for (const customTag of customTags) {
|
|
813
813
|
supportForTags["@".concat(customTag.name)] = true;
|
|
814
814
|
}
|
|
815
|
-
return TSDocConfigFile.loadFromObject({
|
|
816
|
-
...tsDocBaseConfig,
|
|
815
|
+
return TSDocConfigFile.loadFromObject(_objectSpread(_objectSpread({}, tsDocBaseConfig), {}, {
|
|
817
816
|
noStandardTags: false,
|
|
818
817
|
tagDefinitions,
|
|
819
818
|
supportForTags
|
|
820
|
-
});
|
|
819
|
+
}));
|
|
821
820
|
}
|
|
822
821
|
async function extractModuleBlocksFromTypes(_ref3) {
|
|
823
822
|
let {
|
|
@@ -957,10 +956,9 @@ async function extractTypes(options) {
|
|
|
957
956
|
tsOutDir: tmpPath
|
|
958
957
|
});
|
|
959
958
|
const code = [typesBuf.toString(), ...moduleBlocks].join("\n\n");
|
|
960
|
-
await fs.writeFile(typesPath, prettier.format(code, {
|
|
961
|
-
...prettierConfig,
|
|
959
|
+
await fs.writeFile(typesPath, prettier.format(code, _objectSpread(_objectSpread({}, prettierConfig), {}, {
|
|
962
960
|
filepath: typesPath
|
|
963
|
-
}));
|
|
961
|
+
})));
|
|
964
962
|
files.push({
|
|
965
963
|
type: "types",
|
|
966
964
|
path: typesPath
|
|
@@ -1161,7 +1159,7 @@ function resolveRollupConfig(ctx, buildTask) {
|
|
|
1161
1159
|
pkg,
|
|
1162
1160
|
ts
|
|
1163
1161
|
} = ctx;
|
|
1164
|
-
const outputExt = extMap[pkg.type][format];
|
|
1162
|
+
const outputExt = extMap[pkg.type || "commonjs"][format];
|
|
1165
1163
|
const minify = (_ref4 = config == null ? void 0 : config.minify) !== null && _ref4 !== void 0 ? _ref4 : false;
|
|
1166
1164
|
const outDir = path.relative(cwd, distPath);
|
|
1167
1165
|
const pathAliases = Object.fromEntries(Object.entries(((_a = ts.config) == null ? void 0 : _a.options.paths) || {}).map(_ref5 => {
|
|
@@ -1170,10 +1168,9 @@ function resolveRollupConfig(ctx, buildTask) {
|
|
|
1170
1168
|
return [key, path.resolve(cwd, ((_a2 = ts.config) == null ? void 0 : _a2.options.baseUrl) || ".", val[0])];
|
|
1171
1169
|
}));
|
|
1172
1170
|
const entries = buildTask.entries.map(entry => {
|
|
1173
|
-
return {
|
|
1174
|
-
...entry,
|
|
1171
|
+
return _objectSpread(_objectSpread({}, entry), {}, {
|
|
1175
1172
|
name: path.relative(outDir, entry.output).replace(/\.[^/.]+$/, "")
|
|
1176
|
-
};
|
|
1173
|
+
});
|
|
1177
1174
|
}, {});
|
|
1178
1175
|
const exportIds = _exports && Object.keys(_exports).map(exportPath => path.join(pkg.name, exportPath));
|
|
1179
1176
|
const sourcePaths = _exports && Object.values(_exports).map(e => path.resolve(cwd, e.source));
|
|
@@ -1183,29 +1180,22 @@ function resolveRollupConfig(ctx, buildTask) {
|
|
|
1183
1180
|
}));
|
|
1184
1181
|
const defaultPlugins = [replace({
|
|
1185
1182
|
preventAssignment: true,
|
|
1186
|
-
values: {
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
"process.env.PKG_RUNTIME": JSON.stringify(runtime),
|
|
1201
|
-
"process.env.PKG_VERSION": JSON.stringify(process.env.PKG_VERSION || pkg.version),
|
|
1202
|
-
...replacements
|
|
1203
|
-
})
|
|
1204
|
-
}
|
|
1183
|
+
values: _objectSpread({}, pkg.name === "@sanity/pkg-utils" ? _objectSpread({}, replacements) : _objectSpread({
|
|
1184
|
+
"process.env.PKG_FILE_PATH": arg => {
|
|
1185
|
+
const sourcePath = "./" + path.relative(cwd, arg);
|
|
1186
|
+
const entry = entries.find(e => e.source === sourcePath);
|
|
1187
|
+
if (!entry) {
|
|
1188
|
+
console.error("could not find source entry: ".concat(sourcePath));
|
|
1189
|
+
return "null";
|
|
1190
|
+
}
|
|
1191
|
+
return JSON.stringify(path.relative(cwd, path.resolve(outDir, entry.name + outputExt)));
|
|
1192
|
+
},
|
|
1193
|
+
"process.env.PKG_FORMAT": JSON.stringify(format),
|
|
1194
|
+
"process.env.PKG_RUNTIME": JSON.stringify(runtime),
|
|
1195
|
+
"process.env.PKG_VERSION": JSON.stringify(process.env.PKG_VERSION || pkg.version)
|
|
1196
|
+
}, replacements))
|
|
1205
1197
|
}), alias({
|
|
1206
|
-
entries: {
|
|
1207
|
-
...pathAliases
|
|
1208
|
-
}
|
|
1198
|
+
entries: _objectSpread({}, pathAliases)
|
|
1209
1199
|
}), nodeResolve({
|
|
1210
1200
|
browser: runtime === "browser",
|
|
1211
1201
|
extensions: [".cjs", ".mjs", ".js", ".jsx", ".json", ".node"],
|
|
@@ -1222,9 +1212,9 @@ function resolveRollupConfig(ctx, buildTask) {
|
|
|
1222
1212
|
tsconfig: ctx.ts.configPath || "tsconfig.json"
|
|
1223
1213
|
}), getBabelOutputPlugin({
|
|
1224
1214
|
babelrc: false,
|
|
1215
|
+
plugins: ["@babel/plugin-proposal-object-rest-spread"],
|
|
1225
1216
|
presets: [["@babel/preset-env", {
|
|
1226
|
-
targets: pkg.browserslist || DEFAULT_BROWSERSLIST_QUERY
|
|
1227
|
-
modules: false
|
|
1217
|
+
targets: pkg.browserslist || DEFAULT_BROWSERSLIST_QUERY
|
|
1228
1218
|
}]]
|
|
1229
1219
|
}), minify && terser({
|
|
1230
1220
|
compress: {
|
|
@@ -1265,10 +1255,9 @@ function resolveRollupConfig(ctx, buildTask) {
|
|
|
1265
1255
|
return false;
|
|
1266
1256
|
},
|
|
1267
1257
|
input: entries.reduce((acc, entry) => {
|
|
1268
|
-
return {
|
|
1269
|
-
...acc,
|
|
1258
|
+
return _objectSpread(_objectSpread({}, acc), {}, {
|
|
1270
1259
|
[entry.name]: entry.source
|
|
1271
|
-
};
|
|
1260
|
+
});
|
|
1272
1261
|
}, {}),
|
|
1273
1262
|
plugins,
|
|
1274
1263
|
treeshake: {
|
|
@@ -1296,8 +1285,7 @@ function resolveRollupConfig(ctx, buildTask) {
|
|
|
1296
1285
|
format,
|
|
1297
1286
|
interop: "compat",
|
|
1298
1287
|
minifyInternalExports: minify,
|
|
1299
|
-
sourcemap: (_ref11 = config == null ? void 0 : config.sourcemap) !== null && _ref11 !== void 0 ? _ref11 : true
|
|
1300
|
-
hoistTransitiveImports: false
|
|
1288
|
+
sourcemap: (_ref11 = config == null ? void 0 : config.sourcemap) !== null && _ref11 !== void 0 ? _ref11 : true
|
|
1301
1289
|
}
|
|
1302
1290
|
};
|
|
1303
1291
|
}
|
|
@@ -1353,8 +1341,7 @@ async function execPromise(ctx, task) {
|
|
|
1353
1341
|
inputOptions,
|
|
1354
1342
|
outputOptions
|
|
1355
1343
|
} = resolveRollupConfig(ctx, task);
|
|
1356
|
-
const bundle = await rollup({
|
|
1357
|
-
...inputOptions,
|
|
1344
|
+
const bundle = await rollup(_objectSpread(_objectSpread({}, inputOptions), {}, {
|
|
1358
1345
|
onwarn(warning) {
|
|
1359
1346
|
consoleSpy.messages.push({
|
|
1360
1347
|
type: "warn",
|
|
@@ -1362,7 +1349,7 @@ async function execPromise(ctx, task) {
|
|
|
1362
1349
|
args: [warning.message]
|
|
1363
1350
|
});
|
|
1364
1351
|
}
|
|
1365
|
-
});
|
|
1352
|
+
}));
|
|
1366
1353
|
const {
|
|
1367
1354
|
output
|
|
1368
1355
|
} = await bundle.generate(outputOptions);
|
|
@@ -1395,10 +1382,9 @@ const rollupWatchTask = {
|
|
|
1395
1382
|
outputOptions
|
|
1396
1383
|
} = resolveRollupConfig(ctx, task);
|
|
1397
1384
|
return new Observable(observer => {
|
|
1398
|
-
const watchOptions = {
|
|
1399
|
-
...inputOptions,
|
|
1385
|
+
const watchOptions = _objectSpread(_objectSpread({}, inputOptions), {}, {
|
|
1400
1386
|
output: outputOptions
|
|
1401
|
-
};
|
|
1387
|
+
});
|
|
1402
1388
|
const watcher = watch$1(watchOptions);
|
|
1403
1389
|
watcher.on("event", event => {
|
|
1404
1390
|
observer.next(event);
|
|
@@ -1727,10 +1713,9 @@ function resolveWatchTasks(ctx) {
|
|
|
1727
1713
|
const tasks = [];
|
|
1728
1714
|
const exports = Object.entries(ctx.exports || {}).map(_ref17 => {
|
|
1729
1715
|
let [_path, exp] = _ref17;
|
|
1730
|
-
return {
|
|
1731
|
-
_path
|
|
1732
|
-
|
|
1733
|
-
};
|
|
1716
|
+
return _objectSpread({
|
|
1717
|
+
_path
|
|
1718
|
+
}, exp);
|
|
1734
1719
|
});
|
|
1735
1720
|
const dtsTask = {
|
|
1736
1721
|
type: "watch:dts",
|