piral-cli 0.15.0-alpha.3933 → 0.15.0-alpha.4027

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.
Files changed (44) hide show
  1. package/lib/apps/build-pilet.d.ts +4 -0
  2. package/lib/apps/build-pilet.js +5 -4
  3. package/lib/apps/build-pilet.js.map +1 -1
  4. package/lib/apps/debug-pilet.d.ts +4 -0
  5. package/lib/apps/debug-pilet.js +4 -3
  6. package/lib/apps/debug-pilet.js.map +1 -1
  7. package/lib/apps/publish-pilet.d.ts +9 -1
  8. package/lib/apps/publish-pilet.js +4 -2
  9. package/lib/apps/publish-pilet.js.map +1 -1
  10. package/lib/commands.js +16 -0
  11. package/lib/commands.js.map +1 -1
  12. package/lib/common/http.d.ts +2 -1
  13. package/lib/common/http.js +18 -4
  14. package/lib/common/http.js.map +1 -1
  15. package/lib/common/index.d.ts +1 -0
  16. package/lib/common/index.js +1 -0
  17. package/lib/common/index.js.map +1 -1
  18. package/lib/common/info.d.ts +1 -0
  19. package/lib/common/info.js +3 -1
  20. package/lib/common/info.js.map +1 -1
  21. package/lib/common/parallel.d.ts +1 -0
  22. package/lib/common/parallel.js +29 -0
  23. package/lib/common/parallel.js.map +1 -0
  24. package/lib/common/spec.js +3 -2
  25. package/lib/common/spec.js.map +1 -1
  26. package/lib/external/index.js +69 -2
  27. package/lib/helpers.d.ts +2 -1
  28. package/lib/helpers.js +2 -1
  29. package/lib/helpers.js.map +1 -1
  30. package/lib/types/public.d.ts +1 -0
  31. package/package.json +2 -2
  32. package/src/apps/build-pilet.ts +105 -99
  33. package/src/apps/debug-pilet.ts +61 -54
  34. package/src/apps/publish-pilet.ts +16 -2
  35. package/src/commands.ts +18 -0
  36. package/src/common/http.test.ts +7 -7
  37. package/src/common/http.ts +21 -3
  38. package/src/common/index.ts +1 -0
  39. package/src/common/info.ts +3 -0
  40. package/src/common/parallel.test.ts +28 -0
  41. package/src/common/parallel.ts +21 -0
  42. package/src/common/spec.ts +3 -2
  43. package/src/helpers.ts +2 -0
  44. package/src/types/public.ts +2 -0
@@ -5,6 +5,7 @@ const fs_1 = require("fs");
5
5
  const hash_1 = require("./hash");
6
6
  const checkV1 = /^\/\/\s*@pilet\s+v:1\s*\(([A-Za-z0-9\_\:\-]+)\)/;
7
7
  const checkV2 = /^\/\/\s*@pilet\s+v:2\s*(?:\(([A-Za-z0-9\_\:\-]+),\s*(.*)\))?/;
8
+ const isUrl = /^https?:\/\//;
8
9
  function getDependencies(deps, basePath) {
9
10
  try {
10
11
  const depMap = JSON.parse(deps);
@@ -12,8 +13,8 @@ function getDependencies(deps, basePath) {
12
13
  return Object.keys(depMap).reduce((obj, depName) => {
13
14
  const depUrl = depMap[depName];
14
15
  if (typeof depUrl === 'string') {
15
- const url = new URL(depUrl, basePath);
16
- obj[depName] = url.href;
16
+ const url = isUrl.test(depUrl) ? depUrl : `${basePath}${depUrl}`;
17
+ obj[depName] = url;
17
18
  }
18
19
  return obj;
19
20
  }, {});
@@ -1 +1 @@
1
- {"version":3,"file":"spec.js","sourceRoot":"","sources":["../../src/common/spec.ts"],"names":[],"mappings":";;;AAAA,2BAAwD;AACxD,iCAAuD;AAEvD,MAAM,OAAO,GAAG,iDAAiD,CAAC;AAClE,MAAM,OAAO,GAAG,8DAA8D,CAAC;AAE/E,SAAS,eAAe,CAAC,IAAY,EAAE,QAAgB;IACrD,IAAI;QACF,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAEhC,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;YACxC,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE;gBACjD,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;gBAE/B,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;oBAC9B,MAAM,GAAG,GAAG,IAAI,GAAG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AAC,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC7C,OAAO;gBACL,IAAI,EAAE,IAAI;gBACV,UAAU;gBACV,SAAS,EAAE,IAAA,uBAAgB,EAAC,OAAO,CAAC;aACrC,CAAC;SACH;aAAM,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;YAChC,qEAAqE;YACrE,MAAM,CAAC,EAAE,UAAU,EAAE,iBAAiB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAChE,OAAO;gBACL,IAAI,EAAE,IAAI;gBACV,UAAU;gBACV,YAAY,EAAE,eAAe,CAAC,iBAAiB,EAAE,QAAQ,CAAC;aAC3D,CAAC;SACH;aAAM;YACL,oBAAoB;YACpB,OAAO;gBACL,IAAI,EAAE,IAAI;gBACV,IAAI,EAAE,IAAA,kBAAW,EAAC,OAAO,CAAC;gBAC1B,OAAO,EAAE,IAAI;aACd,CAAC;SACH;KACF;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;AA/BD,4CA+BC"}
@@ -49833,7 +49833,7 @@ const ITERATOR = doIter && Symbol.iterator
49833
49833
  // or Buffer.alloc, and Buffer in node 10 deprecated the ctor.
49834
49834
  // .M, this is fine .\^/M..
49835
49835
  const B = Buffer.alloc ? Buffer
49836
- : /* istanbul ignore next */ __webpack_require__(32).Buffer
49836
+ : /* istanbul ignore next */ __webpack_require__(921).Buffer
49837
49837
 
49838
49838
  // events that mean 'the stream is over'
49839
49839
  // these are treated specially, and re-emitted
@@ -59712,7 +59712,74 @@ module.exports = function isAbsoluteURL(url) {
59712
59712
  /* 918 */,
59713
59713
  /* 919 */,
59714
59714
  /* 920 */,
59715
- /* 921 */,
59715
+ /* 921 */
59716
+ /***/ (function(module, exports, __webpack_require__) {
59717
+
59718
+ /* eslint-disable node/no-deprecated-api */
59719
+ var buffer = __webpack_require__(293)
59720
+ var Buffer = buffer.Buffer
59721
+
59722
+ // alternative to using Object.keys for old browsers
59723
+ function copyProps (src, dst) {
59724
+ for (var key in src) {
59725
+ dst[key] = src[key]
59726
+ }
59727
+ }
59728
+ if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
59729
+ module.exports = buffer
59730
+ } else {
59731
+ // Copy properties from require('buffer')
59732
+ copyProps(buffer, exports)
59733
+ exports.Buffer = SafeBuffer
59734
+ }
59735
+
59736
+ function SafeBuffer (arg, encodingOrOffset, length) {
59737
+ return Buffer(arg, encodingOrOffset, length)
59738
+ }
59739
+
59740
+ // Copy static methods from Buffer
59741
+ copyProps(Buffer, SafeBuffer)
59742
+
59743
+ SafeBuffer.from = function (arg, encodingOrOffset, length) {
59744
+ if (typeof arg === 'number') {
59745
+ throw new TypeError('Argument must not be a number')
59746
+ }
59747
+ return Buffer(arg, encodingOrOffset, length)
59748
+ }
59749
+
59750
+ SafeBuffer.alloc = function (size, fill, encoding) {
59751
+ if (typeof size !== 'number') {
59752
+ throw new TypeError('Argument must be a number')
59753
+ }
59754
+ var buf = Buffer(size)
59755
+ if (fill !== undefined) {
59756
+ if (typeof encoding === 'string') {
59757
+ buf.fill(fill, encoding)
59758
+ } else {
59759
+ buf.fill(fill)
59760
+ }
59761
+ } else {
59762
+ buf.fill(0)
59763
+ }
59764
+ return buf
59765
+ }
59766
+
59767
+ SafeBuffer.allocUnsafe = function (size) {
59768
+ if (typeof size !== 'number') {
59769
+ throw new TypeError('Argument must be a number')
59770
+ }
59771
+ return Buffer(size)
59772
+ }
59773
+
59774
+ SafeBuffer.allocUnsafeSlow = function (size) {
59775
+ if (typeof size !== 'number') {
59776
+ throw new TypeError('Argument must be a number')
59777
+ }
59778
+ return buffer.SlowBuffer(size)
59779
+ }
59780
+
59781
+
59782
+ /***/ }),
59716
59783
  /* 922 */
59717
59784
  /***/ (function(module, __unusedexports, __webpack_require__) {
59718
59785
 
package/lib/helpers.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { ForceOverwrite, SourceLanguage } from './common/enums';
2
- import { Framework, NpmClientType, PiletSchemaVersion, PiletPublishSource, PiralBuildType, PiletBuildType } from './types';
2
+ import { Framework, NpmClientType, PiletSchemaVersion, PiletPublishSource, PiralBuildType, PiletBuildType, PiletPublishScheme } from './types';
3
3
  export declare const schemaKeys: Array<PiletSchemaVersion>;
4
+ export declare const publishModeKeys: Array<PiletPublishScheme>;
4
5
  export declare const fromKeys: Array<PiletPublishSource>;
5
6
  export declare const piralBuildTypeKeys: Array<PiralBuildType>;
6
7
  export declare const piletBuildTypeKeys: Array<PiletBuildType>;
package/lib/helpers.js CHANGED
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.keyOfPiletLanguage = exports.valueOfPiletLanguage = exports.piletLanguageKeys = exports.keyOfForceOverwrite = exports.valueOfForceOverwrite = exports.forceOverwriteKeys = exports.frameworkKeys = exports.availableReleaseProviders = exports.availableBundlers = exports.bundlerKeys = exports.clientTypeKeys = exports.piletBuildTypeKeys = exports.piralBuildTypeKeys = exports.fromKeys = exports.schemaKeys = void 0;
3
+ exports.keyOfPiletLanguage = exports.valueOfPiletLanguage = exports.piletLanguageKeys = exports.keyOfForceOverwrite = exports.valueOfForceOverwrite = exports.forceOverwriteKeys = exports.frameworkKeys = exports.availableReleaseProviders = exports.availableBundlers = exports.bundlerKeys = exports.clientTypeKeys = exports.piletBuildTypeKeys = exports.piralBuildTypeKeys = exports.fromKeys = exports.publishModeKeys = exports.schemaKeys = void 0;
4
4
  const enums_1 = require("./common/enums");
5
5
  const constants_1 = require("./common/constants");
6
6
  exports.schemaKeys = ['v0', 'v1', 'v2', 'none'];
7
+ exports.publishModeKeys = ['none', 'basic', 'bearer', 'digest'];
7
8
  exports.fromKeys = ['local', 'remote', 'npm'];
8
9
  exports.piralBuildTypeKeys = ['all', 'release', 'emulator', 'emulator-sources'];
9
10
  exports.piletBuildTypeKeys = ['default', 'standalone', 'manifest'];
@@ -1 +1 @@
1
- {"version":3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,yBAAiB,EAAE;QAChD,IAAI,gBAAgB,KAAK,GAAG,EAAE;YAC5B,OAAO,sBAAc,CAAC,gBAAgB,CAAC,CAAC;SACzC;KACF;IAED,OAAO,sBAAc,CAAC,EAAE,CAAC;AAC3B,CAAC;AARD,oDAQC;AAED,SAAgB,kBAAkB,CAAC,KAAqB;IACtD,KAAK,MAAM,gBAAgB,IAAI,yBAAiB,EAAE;QAChD,IAAI,sBAAc,CAAC,gBAAgB,CAAC,KAAK,KAAK,EAAE;YAC9C,OAAO,gBAAgB,CAAC;SACzB;KACF;IAED,OAAO,yBAAiB,CAAC,CAAC,CAAC,CAAC;AAC9B,CAAC;AARD,gDAQC"}
@@ -189,6 +189,7 @@ export interface BundlerDefinition {
189
189
  buildPilet: BuildPiletBundlerDefinition;
190
190
  }
191
191
  export declare type PiletSchemaVersion = 'none' | 'v0' | 'v1' | 'v2';
192
+ export declare type PiletPublishScheme = 'none' | 'digest' | 'bearer' | 'basic';
192
193
  export declare type PiletPublishSource = 'local' | 'npm' | 'remote';
193
194
  export declare type PiralBuildType = 'all' | 'release' | 'emulator' | 'emulator-sources';
194
195
  export declare type PiletBuildType = 'default' | 'standalone' | 'manifest';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "piral-cli",
3
- "version": "0.15.0-alpha.3933",
3
+ "version": "0.15.0-alpha.4027",
4
4
  "description": "The standard CLI for creating and building a Piral instance or a Pilet.",
5
5
  "keywords": [
6
6
  "portal",
@@ -78,5 +78,5 @@
78
78
  "typescript": "^4.0.2",
79
79
  "yargs": "^15.4.1"
80
80
  },
81
- "gitHead": "520a272d09f02543153f1d8b2ae23a3ae10acd6f"
81
+ "gitHead": "324ff88850415188d0015efc509346705224a4dc"
82
82
  }
@@ -14,14 +14,48 @@ import {
14
14
  fail,
15
15
  config,
16
16
  log,
17
- createDirectory,
18
17
  writeJson,
19
18
  getPiletSpecMeta,
20
19
  getFileNames,
21
20
  copy,
22
21
  checkAppShellPackage,
22
+ cpuCount,
23
+ concurrentWorkers,
23
24
  } from '../common';
24
25
 
26
+ interface PiletData {
27
+ id: string;
28
+ package: any;
29
+ path: string;
30
+ outFile: string;
31
+ outDir: string;
32
+ }
33
+
34
+ function createMetadata(outDir: string, outFile: string, pilets: Array<PiletData>) {
35
+ return writeJson(
36
+ outDir,
37
+ outFile,
38
+ pilets.map((p) => ({
39
+ name: p.package.name,
40
+ version: p.package.version,
41
+ link: `./${p.id}/${p.outFile}`,
42
+ ...getPiletSpecMeta(p.path, `./${p.id}/`),
43
+ })),
44
+ );
45
+ }
46
+
47
+ function copyPilets(outDir: string, pilets: Array<PiletData>) {
48
+ return Promise.all(
49
+ pilets.map(async (p) => {
50
+ const files = await getFileNames(p.outDir);
51
+
52
+ for (const file of files) {
53
+ await copy(resolve(p.outDir, file), resolve(outDir, p.id, file), ForceOverwrite.yes);
54
+ }
55
+ }),
56
+ );
57
+ }
58
+
25
59
  export interface BuildPiletOptions {
26
60
  /**
27
61
  * Sets the name of the Piral instance.
@@ -50,6 +84,11 @@ export interface BuildPiletOptions {
50
84
  */
51
85
  declaration?: boolean;
52
86
 
87
+ /**
88
+ * Sets the maximum number of parallel build processes.
89
+ */
90
+ concurrency?: number;
91
+
53
92
  /**
54
93
  * Sets the log level to use (1-5).
55
94
  */
@@ -109,39 +148,6 @@ export interface BuildPiletOptions {
109
148
  };
110
149
  }
111
150
 
112
- interface PiletData {
113
- id: string;
114
- package: any;
115
- path: string;
116
- outFile: string;
117
- outDir: string;
118
- }
119
-
120
- function createMetadata(outDir: string, outFile: string, pilets: Array<PiletData>) {
121
- return writeJson(
122
- outDir,
123
- outFile,
124
- pilets.map((p) => ({
125
- name: p.package.name,
126
- version: p.package.version,
127
- link: `./${p.id}/${p.outFile}`,
128
- ...getPiletSpecMeta(p.path, p.outDir),
129
- })),
130
- );
131
- }
132
-
133
- function copyPilets(outDir: string, pilets: Array<PiletData>) {
134
- return Promise.all(
135
- pilets.map(async (p) => {
136
- const files = await getFileNames(p.outDir);
137
-
138
- for (const file of files) {
139
- await copy(resolve(p.outDir, file), resolve(outDir, p.id, file), ForceOverwrite.yes);
140
- }
141
- }),
142
- );
143
- }
144
-
145
151
  export const buildPiletDefaults: BuildPiletOptions = {
146
152
  entry: './src/index',
147
153
  target: './dist/index.js',
@@ -153,6 +159,7 @@ export const buildPiletDefaults: BuildPiletOptions = {
153
159
  contentHash: true,
154
160
  optimizeModules: false,
155
161
  schemaVersion: config.schemaVersion,
162
+ concurrency: cpuCount,
156
163
  declaration: true,
157
164
  };
158
165
 
@@ -165,6 +172,7 @@ export async function buildPilet(baseDir = process.cwd(), options: BuildPiletOpt
165
172
  contentHash = buildPiletDefaults.contentHash,
166
173
  logLevel = buildPiletDefaults.logLevel,
167
174
  fresh = buildPiletDefaults.fresh,
175
+ concurrency = buildPiletDefaults.concurrency,
168
176
  optimizeModules = buildPiletDefaults.optimizeModules,
169
177
  schemaVersion = buildPiletDefaults.schemaVersion,
170
178
  declaration = buildPiletDefaults.declaration,
@@ -187,77 +195,75 @@ export async function buildPilet(baseDir = process.cwd(), options: BuildPiletOpt
187
195
  fail('entryFileMissing_0077');
188
196
  }
189
197
 
190
- const pilets = await Promise.all(
191
- allEntries.map(async (entryModule) => {
192
- const targetDir = dirname(entryModule);
193
- const { peerDependencies, peerModules, root, appPackage, appFile, piletPackage, ignored, importmap } =
194
- await retrievePiletData(targetDir, app);
195
- const externals = [...Object.keys(peerDependencies), ...peerModules];
196
- const dest = resolve(root, target);
197
- const outDir = dirname(dest);
198
- const outFile = basename(dest);
199
-
200
- if (fresh) {
201
- progress('Removing output directory ...');
202
- await removeDirectory(outDir);
203
- }
198
+ const pilets = await concurrentWorkers(allEntries, concurrency, async (entryModule) => {
199
+ const targetDir = dirname(entryModule);
200
+ const { peerDependencies, peerModules, root, appPackage, appFile, piletPackage, ignored, importmap } =
201
+ await retrievePiletData(targetDir, app);
202
+ const externals = [...Object.keys(peerDependencies), ...peerModules];
203
+ const dest = resolve(root, target);
204
+ const outDir = dirname(dest);
205
+ const outFile = basename(dest);
206
+
207
+ if (fresh) {
208
+ progress('Removing output directory ...');
209
+ await removeDirectory(outDir);
210
+ }
204
211
 
205
- logInfo('Bundle pilet ...');
206
-
207
- await hooks.beforeBuild?.({ root, outDir, importmap, entryModule, schemaVersion, piletPackage });
208
-
209
- await callPiletBuild(
210
- {
211
- root,
212
- piral: appPackage.name,
213
- optimizeModules,
214
- sourceMaps,
215
- contentHash,
216
- minify,
217
- externals,
218
- targetDir,
219
- importmap,
220
- outFile,
221
- outDir,
222
- entryModule: `./${relative(root, entryModule)}`,
223
- logLevel,
224
- version: schemaVersion,
225
- ignored,
226
- _,
227
- },
228
- bundlerName,
229
- );
212
+ logInfo('Bundle pilet ...');
230
213
 
231
- await hooks.afterBuild?.({ root, outDir, importmap, entryModule, schemaVersion, piletPackage });
232
-
233
- if (declaration) {
234
- await hooks.beforeDeclaration?.({ root, outDir, entryModule, piletPackage });
235
- await createPiletDeclaration(
236
- piletPackage.name,
237
- root,
238
- entryModule,
239
- externals,
240
- outDir,
241
- ForceOverwrite.yes,
242
- logLevel,
243
- );
244
- await hooks.afterDeclaration?.({ root, outDir, entryModule, piletPackage });
245
- }
214
+ await hooks.beforeBuild?.({ root, outDir, importmap, entryModule, schemaVersion, piletPackage });
246
215
 
247
- logDone(`Pilet "${piletPackage.name}" built successfully!`);
216
+ await callPiletBuild(
217
+ {
218
+ root,
219
+ piral: appPackage.name,
220
+ optimizeModules,
221
+ sourceMaps,
222
+ contentHash,
223
+ minify,
224
+ externals,
225
+ targetDir,
226
+ importmap,
227
+ outFile,
228
+ outDir,
229
+ entryModule: `./${relative(root, entryModule)}`,
230
+ logLevel,
231
+ version: schemaVersion,
232
+ ignored,
233
+ _,
234
+ },
235
+ bundlerName,
236
+ );
248
237
 
249
- return {
250
- id: piletPackage.name.replace(/[^a-zA-Z0-9\-]/gi, ''),
238
+ await hooks.afterBuild?.({ root, outDir, importmap, entryModule, schemaVersion, piletPackage });
239
+
240
+ if (declaration) {
241
+ await hooks.beforeDeclaration?.({ root, outDir, entryModule, piletPackage });
242
+ await createPiletDeclaration(
243
+ piletPackage.name,
251
244
  root,
252
- appFile,
253
- appPackage,
245
+ entryModule,
246
+ externals,
254
247
  outDir,
255
- outFile,
256
- path: dest,
257
- package: piletPackage,
258
- };
259
- }),
260
- );
248
+ ForceOverwrite.yes,
249
+ logLevel,
250
+ );
251
+ await hooks.afterDeclaration?.({ root, outDir, entryModule, piletPackage });
252
+ }
253
+
254
+ logDone(`Pilet "${piletPackage.name}" built successfully!`);
255
+
256
+ return {
257
+ id: piletPackage.name.replace(/[^a-zA-Z0-9\-]/gi, ''),
258
+ root,
259
+ appFile,
260
+ appPackage,
261
+ outDir,
262
+ outFile,
263
+ path: dest,
264
+ package: piletPackage,
265
+ };
266
+ });
261
267
 
262
268
  if (type === 'standalone') {
263
269
  const distDir = dirname(resolve(fullBase, target));
@@ -16,6 +16,8 @@ import {
16
16
  fail,
17
17
  log,
18
18
  logDone,
19
+ cpuCount,
20
+ concurrentWorkers,
19
21
  } from '../common';
20
22
 
21
23
  export interface DebugPiletOptions {
@@ -57,6 +59,11 @@ export interface DebugPiletOptions {
57
59
  */
58
60
  port?: number;
59
61
 
62
+ /**
63
+ * Sets the maximum number of parallel build processes.
64
+ */
65
+ concurrency?: number;
66
+
60
67
  /**
61
68
  * Defines if hot module reloading (HMR) should be integrated for faster debugging.
62
69
  */
@@ -112,6 +119,7 @@ export const debugPiletDefaults: DebugPiletOptions = {
112
119
  hmr: true,
113
120
  optimizeModules: false,
114
121
  schemaVersion: config.schemaVersion,
122
+ concurrency: cpuCount,
115
123
  };
116
124
 
117
125
  const injectorName = resolve(__dirname, '../injectors/pilet.js');
@@ -168,6 +176,7 @@ export async function debugPilet(baseDir = process.cwd(), options: DebugPiletOpt
168
176
  open = debugPiletDefaults.open,
169
177
  hmr = debugPiletDefaults.hmr,
170
178
  logLevel = debugPiletDefaults.logLevel,
179
+ concurrency = debugPiletDefaults.concurrency,
171
180
  optimizeModules = debugPiletDefaults.optimizeModules,
172
181
  schemaVersion = debugPiletDefaults.schemaVersion,
173
182
  _ = {},
@@ -204,63 +213,61 @@ export async function debugPilet(baseDir = process.cwd(), options: DebugPiletOpt
204
213
  process.stdout.setMaxListeners(maxListeners);
205
214
  process.stdin.setMaxListeners(maxListeners);
206
215
 
207
- const pilets = await Promise.all(
208
- allEntries.map(async (entryModule) => {
209
- const targetDir = dirname(entryModule);
210
- const { peerDependencies, peerModules, root, appPackage, appFile, ignored, emulator, importmap } =
211
- await retrievePiletData(targetDir, app);
212
- const externals = [...Object.keys(peerDependencies), ...peerModules];
213
- const mocks = join(targetDir, 'mocks');
214
- const dest = resolve(root, target);
215
- const outDir = dirname(dest);
216
- const outFile = basename(dest);
217
- const exists = await checkExistingDirectory(mocks);
218
-
219
- if (exists) {
220
- if (krasConfig.directory === undefined) {
221
- krasConfig.directory = mocks;
222
- }
223
-
224
- krasConfig.sources.push(mocks);
216
+ const pilets = await concurrentWorkers(allEntries, concurrency, async (entryModule) => {
217
+ const targetDir = dirname(entryModule);
218
+ const { peerDependencies, peerModules, root, appPackage, appFile, ignored, emulator, importmap } =
219
+ await retrievePiletData(targetDir, app);
220
+ const externals = [...Object.keys(peerDependencies), ...peerModules];
221
+ const mocks = join(targetDir, 'mocks');
222
+ const dest = resolve(root, target);
223
+ const outDir = dirname(dest);
224
+ const outFile = basename(dest);
225
+ const exists = await checkExistingDirectory(mocks);
226
+
227
+ if (exists) {
228
+ if (krasConfig.directory === undefined) {
229
+ krasConfig.directory = mocks;
225
230
  }
226
231
 
227
- await hooks.beforeBuild?.({ root, importmap, entryModule, schemaVersion });
228
-
229
- const bundler = await callPiletDebug(
230
- {
231
- root,
232
- piral: appPackage.name,
233
- optimizeModules,
234
- hmr,
235
- externals,
236
- targetDir,
237
- importmap,
238
- outFile,
239
- outDir,
240
- entryModule: `./${relative(root, entryModule)}`,
241
- logLevel,
242
- version: schemaVersion,
243
- ignored,
244
- _,
245
- },
246
- bundlerName,
247
- );
248
-
249
- bundler.on((args) => {
250
- hooks.afterBuild?.({ ...args, root, importmap, entryModule, schemaVersion, bundler, outFile, outDir });
251
- });
252
-
253
- return {
254
- emulator,
255
- appFile,
256
- appVersion: appPackage.version,
257
- externals,
258
- piral: appPackage.name,
259
- bundler,
232
+ krasConfig.sources.push(mocks);
233
+ }
234
+
235
+ await hooks.beforeBuild?.({ root, importmap, entryModule, schemaVersion });
236
+
237
+ const bundler = await callPiletDebug(
238
+ {
260
239
  root,
261
- };
262
- }),
263
- );
240
+ piral: appPackage.name,
241
+ optimizeModules,
242
+ hmr,
243
+ externals,
244
+ targetDir,
245
+ importmap,
246
+ outFile,
247
+ outDir,
248
+ entryModule: `./${relative(root, entryModule)}`,
249
+ logLevel,
250
+ version: schemaVersion,
251
+ ignored,
252
+ _,
253
+ },
254
+ bundlerName,
255
+ );
256
+
257
+ bundler.on((args) => {
258
+ hooks.afterBuild?.({ ...args, root, importmap, entryModule, schemaVersion, bundler, outFile, outDir });
259
+ });
260
+
261
+ return {
262
+ emulator,
263
+ appFile,
264
+ appVersion: appPackage.version,
265
+ externals,
266
+ piral: appPackage.name,
267
+ bundler,
268
+ root,
269
+ };
270
+ });
264
271
 
265
272
  // sanity check see #250
266
273
  checkSanity(pilets);
@@ -1,6 +1,6 @@
1
1
  import { relative, dirname, basename, resolve } from 'path';
2
2
  import { callPiletBuild } from '../bundler';
3
- import { LogLevels, PiletSchemaVersion, PiletPublishSource } from '../types';
3
+ import { LogLevels, PiletSchemaVersion, PiletPublishSource, PiletPublishScheme } from '../types';
4
4
  import {
5
5
  postFile,
6
6
  readBinary,
@@ -72,11 +72,21 @@ export interface PublishPiletOptions {
72
72
  */
73
73
  fields?: Record<string, string>;
74
74
 
75
+ /**
76
+ * Places additional headers that should be posted to the feed service.
77
+ */
78
+ headers?: Record<string, string>;
79
+
75
80
  /**
76
81
  * Sets the bundler to use for building, if any specific.
77
82
  */
78
83
  bundlerName?: string;
79
84
 
85
+ /**
86
+ * Sets the authorization scheme to use.
87
+ */
88
+ mode?: PiletPublishScheme;
89
+
80
90
  /**
81
91
  * Additional arguments for a specific bundler.
82
92
  */
@@ -90,8 +100,10 @@ export const publishPiletDefaults: PublishPiletOptions = {
90
100
  cert: undefined,
91
101
  logLevel: LogLevels.info,
92
102
  schemaVersion: config.schemaVersion,
103
+ mode: 'basic',
93
104
  from: 'local',
94
105
  fields: {},
106
+ headers: {},
95
107
  };
96
108
 
97
109
  async function getFiles(
@@ -200,6 +212,8 @@ export async function publishPilet(baseDir = process.cwd(), options: PublishPile
200
212
  schemaVersion = publishPiletDefaults.schemaVersion,
201
213
  cert = config.cert ?? publishPiletDefaults.cert,
202
214
  fields = publishPiletDefaults.fields,
215
+ headers = publishPiletDefaults.headers,
216
+ mode = publishPiletDefaults.mode,
203
217
  _ = {},
204
218
  bundlerName,
205
219
  } = options;
@@ -240,7 +254,7 @@ export async function publishPilet(baseDir = process.cwd(), options: PublishPile
240
254
 
241
255
  if (content) {
242
256
  progress(`Publishing "%s" ...`, file, url);
243
- const result = await postFile(url, apiKey, content, fields, ca);
257
+ const result = await postFile(url, mode, apiKey, content, fields, headers, ca);
244
258
 
245
259
  if (result.success) {
246
260
  successfulUploads.push(file);