@sanity/pkg-utils 2.0.4-beta.1 → 2.0.4
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-47518e48.cjs} +11 -7
- package/dist/_chunks/{build-77dacddc.cjs.map → build-47518e48.cjs.map} +1 -1
- package/dist/_chunks/buildAction-0eb8c03a.cjs +49 -0
- package/dist/_chunks/{buildAction-15e03999.cjs.map → buildAction-0eb8c03a.cjs.map} +1 -1
- package/dist/_chunks/{check-4c6bb15d.cjs → check-5451f989.cjs} +2 -2
- package/dist/_chunks/{check-4c6bb15d.cjs.map → check-5451f989.cjs.map} +1 -1
- package/dist/_chunks/checkAction-f67b99f8.cjs +31 -0
- package/dist/_chunks/{checkAction-fa6a293a.cjs.map → checkAction-f67b99f8.cjs.map} +1 -1
- package/dist/_chunks/{index-03f2cc83.cjs → index-583ee0d8.cjs} +40 -52
- package/dist/_chunks/index-583ee0d8.cjs.map +1 -0
- package/dist/_chunks/{resolveBuildContext-65b5c5d5.cjs → resolveBuildContext-2fe45294.cjs} +20 -17
- package/dist/_chunks/{resolveBuildContext-65b5c5d5.cjs.map → resolveBuildContext-2fe45294.cjs.map} +1 -1
- package/dist/_chunks/{watch-2663890e.cjs → watch-563b0b60.cjs} +11 -7
- package/dist/_chunks/{watch-2663890e.cjs.map → watch-563b0b60.cjs.map} +1 -1
- package/dist/_chunks/watchAction-e6c84b20.cjs +51 -0
- package/dist/_chunks/{watchAction-808ed88d.cjs.map → watchAction-e6c84b20.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.js +58 -74
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/src/node/tasks/rollup/resolveRollupConfig.ts +2 -7
- 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/watchAction-808ed88d.cjs +0 -17
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var watch = require('./watch-563b0b60.cjs');
|
|
4
|
+
var handleError = require('./handleError-4062ca45.cjs');
|
|
5
|
+
require('path');
|
|
6
|
+
require('rxjs');
|
|
7
|
+
require('./resolveBuildContext-2fe45294.cjs');
|
|
8
|
+
require('esbuild-register/dist/node');
|
|
9
|
+
require('pkg-up');
|
|
10
|
+
require('fs/promises');
|
|
11
|
+
require('find-config');
|
|
12
|
+
require('chalk');
|
|
13
|
+
require('zod');
|
|
14
|
+
require('typescript');
|
|
15
|
+
require('browserslist');
|
|
16
|
+
require('fs');
|
|
17
|
+
require('./index-583ee0d8.cjs');
|
|
18
|
+
require('util');
|
|
19
|
+
require('rimraf');
|
|
20
|
+
require('@microsoft/api-extractor');
|
|
21
|
+
require('mkdirp');
|
|
22
|
+
require('prettier');
|
|
23
|
+
require('@microsoft/tsdoc-config');
|
|
24
|
+
require('jsonc-parser');
|
|
25
|
+
require('recast');
|
|
26
|
+
require('recast/parsers/typescript');
|
|
27
|
+
require('rollup');
|
|
28
|
+
require('@rollup/plugin-alias');
|
|
29
|
+
require('@rollup/plugin-babel');
|
|
30
|
+
require('@rollup/plugin-commonjs');
|
|
31
|
+
require('@rollup/plugin-json');
|
|
32
|
+
require('@rollup/plugin-node-resolve');
|
|
33
|
+
require('@rollup/plugin-replace');
|
|
34
|
+
require('@rollup/plugin-terser');
|
|
35
|
+
require('rollup-plugin-esbuild');
|
|
36
|
+
require('rxjs/operators');
|
|
37
|
+
require('globby');
|
|
38
|
+
require('chokidar');
|
|
39
|
+
async function watchAction(options) {
|
|
40
|
+
try {
|
|
41
|
+
await watch.watch({
|
|
42
|
+
cwd: process.cwd(),
|
|
43
|
+
strict: options.strict,
|
|
44
|
+
tsconfig: options.tsconfig
|
|
45
|
+
});
|
|
46
|
+
} catch (err) {
|
|
47
|
+
handleError.handleError(err);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.watchAction = watchAction;
|
|
51
|
+
//# sourceMappingURL=watchAction-e6c84b20.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watchAction-
|
|
1
|
+
{"version":3,"file":"watchAction-e6c84b20.cjs","sources":["../../src/cli/watchAction.ts"],"sourcesContent":["import {watch} from '../node/watch'\nimport {handleError} from './handleError'\n\nexport async function watchAction(options: {strict?: boolean; tsconfig?: string}): Promise<void> {\n try {\n await watch({\n cwd: process.cwd(),\n strict: options.strict,\n tsconfig: options.tsconfig,\n })\n } catch (err) {\n handleError(err)\n }\n}\n"],"names":["watchAction","options","watch","cwd","process","strict","tsconfig","err","handleError"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,eAAsBA,YAAYC,OAA+D,EAAA;EAC3F,IAAA;IACF,MAAMC,WAAM,CAAA;MACVC,GAAA,EAAKC,QAAQD,GAAI,EAAA;MACjBE,QAAQJ,OAAQ,CAAAI,MAAA;MAChBC,UAAUL,OAAQ,CAAAK;IAAA,CACnB,CAAA;WACMC,GAAP,EAAA;IACAC,WAAA,CAAAA,WAAA,CAAYD,GAAG,CAAA;EACjB;AACF;"}
|
package/dist/cli.cjs
CHANGED
|
@@ -7,13 +7,13 @@ function _interopDefaultCompat(e) {
|
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
9
|
var cac__default = /*#__PURE__*/_interopDefaultCompat(cac);
|
|
10
|
-
var version = "2.0.4
|
|
10
|
+
var version = "2.0.4";
|
|
11
11
|
const cli = cac__default.default();
|
|
12
12
|
cli.command("", "Check").option("--strict", "Strict mode").option("--tsconfig [tsconfig]", "[string] tsconfig.json").action(async options => {
|
|
13
13
|
const {
|
|
14
14
|
checkAction: statusAction
|
|
15
15
|
} = await Promise.resolve().then(function () {
|
|
16
|
-
return require('./_chunks/checkAction-
|
|
16
|
+
return require('./_chunks/checkAction-f67b99f8.cjs');
|
|
17
17
|
});
|
|
18
18
|
return statusAction(options);
|
|
19
19
|
});
|
|
@@ -21,7 +21,7 @@ cli.command("build", "Build package").option("--emitDeclarationOnly", "Emit d.ts
|
|
|
21
21
|
const {
|
|
22
22
|
buildAction
|
|
23
23
|
} = await Promise.resolve().then(function () {
|
|
24
|
-
return require('./_chunks/buildAction-
|
|
24
|
+
return require('./_chunks/buildAction-0eb8c03a.cjs');
|
|
25
25
|
});
|
|
26
26
|
return buildAction(options);
|
|
27
27
|
});
|
|
@@ -29,7 +29,7 @@ cli.command("watch", "Watch package").option("--strict", "Strict mode").option("
|
|
|
29
29
|
const {
|
|
30
30
|
watchAction
|
|
31
31
|
} = await Promise.resolve().then(function () {
|
|
32
|
-
return require('./_chunks/watchAction-
|
|
32
|
+
return require('./_chunks/watchAction-e6c84b20.cjs');
|
|
33
33
|
});
|
|
34
34
|
return watchAction(options);
|
|
35
35
|
});
|
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-47518e48.cjs');
|
|
7
|
+
var check = require('./_chunks/check-5451f989.cjs');
|
|
8
|
+
var resolveBuildContext = require('./_chunks/resolveBuildContext-2fe45294.cjs');
|
|
9
|
+
var index = require('./_chunks/index-583ee0d8.cjs');
|
|
10
|
+
var watch = require('./_chunks/watch-563b0b60.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.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';
|
|
@@ -134,10 +142,9 @@ const pkgSchema = z.object({
|
|
|
134
142
|
});
|
|
135
143
|
function validatePkg(input) {
|
|
136
144
|
const pkg = pkgSchema.parse(input);
|
|
137
|
-
return {
|
|
138
|
-
...pkg,
|
|
145
|
+
return _objectSpread(_objectSpread({}, pkg), {}, {
|
|
139
146
|
type: pkg.type || "commonjs"
|
|
140
|
-
};
|
|
147
|
+
});
|
|
141
148
|
}
|
|
142
149
|
async function loadPkg(options) {
|
|
143
150
|
const {
|
|
@@ -250,11 +257,10 @@ function parseExports(options) {
|
|
|
250
257
|
}
|
|
251
258
|
Object.assign(rootExport, exportEntry);
|
|
252
259
|
} else {
|
|
253
|
-
const extraExport = {
|
|
260
|
+
const extraExport = _objectSpread({
|
|
254
261
|
_exported: true,
|
|
255
|
-
_path: exportPath
|
|
256
|
-
|
|
257
|
-
};
|
|
262
|
+
_path: exportPath
|
|
263
|
+
}, exportEntry);
|
|
258
264
|
extraExports.push(extraExport);
|
|
259
265
|
}
|
|
260
266
|
} else {
|
|
@@ -286,9 +292,7 @@ function getPkgExtMap(options) {
|
|
|
286
292
|
const {
|
|
287
293
|
legacyExports
|
|
288
294
|
} = options;
|
|
289
|
-
const ret = {
|
|
290
|
-
...DEFAULT_PKG_EXT_MAP
|
|
291
|
-
};
|
|
295
|
+
const ret = _objectSpread({}, DEFAULT_PKG_EXT_MAP);
|
|
292
296
|
if (legacyExports) {
|
|
293
297
|
ret["commonjs"] = {
|
|
294
298
|
commonjs: ".js",
|
|
@@ -477,13 +481,12 @@ async function resolveBuildContext(options) {
|
|
|
477
481
|
strict
|
|
478
482
|
}).reduce((acc, x) => {
|
|
479
483
|
const {
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
return {
|
|
484
|
-
...acc,
|
|
484
|
+
_path: exportPath
|
|
485
|
+
} = x,
|
|
486
|
+
exportEntry = _objectWithoutProperties(x, _excluded);
|
|
487
|
+
return _objectSpread(_objectSpread({}, acc), {}, {
|
|
485
488
|
[exportPath]: exportEntry
|
|
486
|
-
};
|
|
489
|
+
});
|
|
487
490
|
}, {});
|
|
488
491
|
const exports = resolveConfigProperty(config == null ? void 0 : config.exports, parsedExports);
|
|
489
492
|
const parsedExternal = [...(pkg.dependencies ? Object.keys(pkg.dependencies) : []), ...(pkg.peerDependencies ? Object.keys(pkg.peerDependencies) : [])];
|
|
@@ -541,10 +544,9 @@ function resolveBuildTasks(ctx) {
|
|
|
541
544
|
const tasks = [];
|
|
542
545
|
const exports = Object.entries(ctx.exports || {}).map(_ref2 => {
|
|
543
546
|
let [_path, exp] = _ref2;
|
|
544
|
-
return {
|
|
545
|
-
_path
|
|
546
|
-
|
|
547
|
-
};
|
|
547
|
+
return _objectSpread({
|
|
548
|
+
_path
|
|
549
|
+
}, exp);
|
|
548
550
|
});
|
|
549
551
|
const dtsTask = {
|
|
550
552
|
type: "build:dts",
|
|
@@ -725,14 +727,13 @@ async function buildTypes(options) {
|
|
|
725
727
|
tsconfig,
|
|
726
728
|
strict = false
|
|
727
729
|
} = options;
|
|
728
|
-
const compilerOptions = {
|
|
729
|
-
...tsconfig.options,
|
|
730
|
+
const compilerOptions = _objectSpread(_objectSpread({}, tsconfig.options), {}, {
|
|
730
731
|
declaration: true,
|
|
731
732
|
declarationDir: outDir,
|
|
732
733
|
emitDeclarationOnly: true,
|
|
733
734
|
noEmit: false,
|
|
734
735
|
outDir
|
|
735
|
-
};
|
|
736
|
+
});
|
|
736
737
|
const program = ts.createProgram(tsconfig.fileNames, compilerOptions);
|
|
737
738
|
const emitResult = program.emit();
|
|
738
739
|
const allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
|
|
@@ -806,18 +807,15 @@ async function createTSDocConfig(opts) {
|
|
|
806
807
|
syntaxKind: t.syntaxKind,
|
|
807
808
|
allowMultiple: t.allowMultiple
|
|
808
809
|
})));
|
|
809
|
-
const supportForTags = {
|
|
810
|
-
...tsDocBaseConfig.supportForTags
|
|
811
|
-
};
|
|
810
|
+
const supportForTags = _objectSpread({}, tsDocBaseConfig.supportForTags);
|
|
812
811
|
for (const customTag of customTags) {
|
|
813
812
|
supportForTags["@".concat(customTag.name)] = true;
|
|
814
813
|
}
|
|
815
|
-
return TSDocConfigFile.loadFromObject({
|
|
816
|
-
...tsDocBaseConfig,
|
|
814
|
+
return TSDocConfigFile.loadFromObject(_objectSpread(_objectSpread({}, tsDocBaseConfig), {}, {
|
|
817
815
|
noStandardTags: false,
|
|
818
816
|
tagDefinitions,
|
|
819
817
|
supportForTags
|
|
820
|
-
});
|
|
818
|
+
}));
|
|
821
819
|
}
|
|
822
820
|
async function extractModuleBlocksFromTypes(_ref3) {
|
|
823
821
|
let {
|
|
@@ -957,10 +955,9 @@ async function extractTypes(options) {
|
|
|
957
955
|
tsOutDir: tmpPath
|
|
958
956
|
});
|
|
959
957
|
const code = [typesBuf.toString(), ...moduleBlocks].join("\n\n");
|
|
960
|
-
await fs.writeFile(typesPath, prettier.format(code, {
|
|
961
|
-
...prettierConfig,
|
|
958
|
+
await fs.writeFile(typesPath, prettier.format(code, _objectSpread(_objectSpread({}, prettierConfig), {}, {
|
|
962
959
|
filepath: typesPath
|
|
963
|
-
}));
|
|
960
|
+
})));
|
|
964
961
|
files.push({
|
|
965
962
|
type: "types",
|
|
966
963
|
path: typesPath
|
|
@@ -1170,10 +1167,9 @@ function resolveRollupConfig(ctx, buildTask) {
|
|
|
1170
1167
|
return [key, path.resolve(cwd, ((_a2 = ts.config) == null ? void 0 : _a2.options.baseUrl) || ".", val[0])];
|
|
1171
1168
|
}));
|
|
1172
1169
|
const entries = buildTask.entries.map(entry => {
|
|
1173
|
-
return {
|
|
1174
|
-
...entry,
|
|
1170
|
+
return _objectSpread(_objectSpread({}, entry), {}, {
|
|
1175
1171
|
name: path.relative(outDir, entry.output).replace(/\.[^/.]+$/, "")
|
|
1176
|
-
};
|
|
1172
|
+
});
|
|
1177
1173
|
}, {});
|
|
1178
1174
|
const exportIds = _exports && Object.keys(_exports).map(exportPath => path.join(pkg.name, exportPath));
|
|
1179
1175
|
const sourcePaths = _exports && Object.values(_exports).map(e => path.resolve(cwd, e.source));
|
|
@@ -1183,29 +1179,22 @@ function resolveRollupConfig(ctx, buildTask) {
|
|
|
1183
1179
|
}));
|
|
1184
1180
|
const defaultPlugins = [replace({
|
|
1185
1181
|
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
|
-
}
|
|
1182
|
+
values: _objectSpread({}, pkg.name === "@sanity/pkg-utils" ? _objectSpread({}, replacements) : _objectSpread({
|
|
1183
|
+
"process.env.PKG_FILE_PATH": arg => {
|
|
1184
|
+
const sourcePath = "./" + path.relative(cwd, arg);
|
|
1185
|
+
const entry = entries.find(e => e.source === sourcePath);
|
|
1186
|
+
if (!entry) {
|
|
1187
|
+
console.error("could not find source entry: ".concat(sourcePath));
|
|
1188
|
+
return "null";
|
|
1189
|
+
}
|
|
1190
|
+
return JSON.stringify(path.relative(cwd, path.resolve(outDir, entry.name + outputExt)));
|
|
1191
|
+
},
|
|
1192
|
+
"process.env.PKG_FORMAT": JSON.stringify(format),
|
|
1193
|
+
"process.env.PKG_RUNTIME": JSON.stringify(runtime),
|
|
1194
|
+
"process.env.PKG_VERSION": JSON.stringify(process.env.PKG_VERSION || pkg.version)
|
|
1195
|
+
}, replacements))
|
|
1205
1196
|
}), alias({
|
|
1206
|
-
entries: {
|
|
1207
|
-
...pathAliases
|
|
1208
|
-
}
|
|
1197
|
+
entries: _objectSpread({}, pathAliases)
|
|
1209
1198
|
}), nodeResolve({
|
|
1210
1199
|
browser: runtime === "browser",
|
|
1211
1200
|
extensions: [".cjs", ".mjs", ".js", ".jsx", ".json", ".node"],
|
|
@@ -1222,9 +1211,9 @@ function resolveRollupConfig(ctx, buildTask) {
|
|
|
1222
1211
|
tsconfig: ctx.ts.configPath || "tsconfig.json"
|
|
1223
1212
|
}), getBabelOutputPlugin({
|
|
1224
1213
|
babelrc: false,
|
|
1214
|
+
plugins: ["@babel/plugin-proposal-object-rest-spread"],
|
|
1225
1215
|
presets: [["@babel/preset-env", {
|
|
1226
|
-
targets: pkg.browserslist || DEFAULT_BROWSERSLIST_QUERY
|
|
1227
|
-
modules: false
|
|
1216
|
+
targets: pkg.browserslist || DEFAULT_BROWSERSLIST_QUERY
|
|
1228
1217
|
}]]
|
|
1229
1218
|
}), minify && terser({
|
|
1230
1219
|
compress: {
|
|
@@ -1265,10 +1254,9 @@ function resolveRollupConfig(ctx, buildTask) {
|
|
|
1265
1254
|
return false;
|
|
1266
1255
|
},
|
|
1267
1256
|
input: entries.reduce((acc, entry) => {
|
|
1268
|
-
return {
|
|
1269
|
-
...acc,
|
|
1257
|
+
return _objectSpread(_objectSpread({}, acc), {}, {
|
|
1270
1258
|
[entry.name]: entry.source
|
|
1271
|
-
};
|
|
1259
|
+
});
|
|
1272
1260
|
}, {}),
|
|
1273
1261
|
plugins,
|
|
1274
1262
|
treeshake: {
|
|
@@ -1296,8 +1284,7 @@ function resolveRollupConfig(ctx, buildTask) {
|
|
|
1296
1284
|
format,
|
|
1297
1285
|
interop: "compat",
|
|
1298
1286
|
minifyInternalExports: minify,
|
|
1299
|
-
sourcemap: (_ref11 = config == null ? void 0 : config.sourcemap) !== null && _ref11 !== void 0 ? _ref11 : true
|
|
1300
|
-
hoistTransitiveImports: false
|
|
1287
|
+
sourcemap: (_ref11 = config == null ? void 0 : config.sourcemap) !== null && _ref11 !== void 0 ? _ref11 : true
|
|
1301
1288
|
}
|
|
1302
1289
|
};
|
|
1303
1290
|
}
|
|
@@ -1353,8 +1340,7 @@ async function execPromise(ctx, task) {
|
|
|
1353
1340
|
inputOptions,
|
|
1354
1341
|
outputOptions
|
|
1355
1342
|
} = resolveRollupConfig(ctx, task);
|
|
1356
|
-
const bundle = await rollup({
|
|
1357
|
-
...inputOptions,
|
|
1343
|
+
const bundle = await rollup(_objectSpread(_objectSpread({}, inputOptions), {}, {
|
|
1358
1344
|
onwarn(warning) {
|
|
1359
1345
|
consoleSpy.messages.push({
|
|
1360
1346
|
type: "warn",
|
|
@@ -1362,7 +1348,7 @@ async function execPromise(ctx, task) {
|
|
|
1362
1348
|
args: [warning.message]
|
|
1363
1349
|
});
|
|
1364
1350
|
}
|
|
1365
|
-
});
|
|
1351
|
+
}));
|
|
1366
1352
|
const {
|
|
1367
1353
|
output
|
|
1368
1354
|
} = await bundle.generate(outputOptions);
|
|
@@ -1395,10 +1381,9 @@ const rollupWatchTask = {
|
|
|
1395
1381
|
outputOptions
|
|
1396
1382
|
} = resolveRollupConfig(ctx, task);
|
|
1397
1383
|
return new Observable(observer => {
|
|
1398
|
-
const watchOptions = {
|
|
1399
|
-
...inputOptions,
|
|
1384
|
+
const watchOptions = _objectSpread(_objectSpread({}, inputOptions), {}, {
|
|
1400
1385
|
output: outputOptions
|
|
1401
|
-
};
|
|
1386
|
+
});
|
|
1402
1387
|
const watcher = watch$1(watchOptions);
|
|
1403
1388
|
watcher.on("event", event => {
|
|
1404
1389
|
observer.next(event);
|
|
@@ -1727,10 +1712,9 @@ function resolveWatchTasks(ctx) {
|
|
|
1727
1712
|
const tasks = [];
|
|
1728
1713
|
const exports = Object.entries(ctx.exports || {}).map(_ref17 => {
|
|
1729
1714
|
let [_path, exp] = _ref17;
|
|
1730
|
-
return {
|
|
1731
|
-
_path
|
|
1732
|
-
|
|
1733
|
-
};
|
|
1715
|
+
return _objectSpread({
|
|
1716
|
+
_path
|
|
1717
|
+
}, exp);
|
|
1734
1718
|
});
|
|
1735
1719
|
const dtsTask = {
|
|
1736
1720
|
type: "watch:dts",
|