@sasjs/cli 6.1.0 → 6.2.1
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/build/commands/build/internal/mockSite/assets/persist.js +13 -6
- package/build/commands/build/internal/mockSite/assets/runtime-core.js +636 -22
- package/build/commands/build/internal/mockSite/assets/sw.js +100 -11
- package/build/commands/build/internal/mockSite/mockSite.d.ts +11 -0
- package/build/commands/build/internal/mockSite/mockSite.js +87 -20
- package/build/commands/build/internal/mockSite/spec/mockSite.spec.js +103 -11
- package/build/commands/build/internal/mockSite/spec/persist.spec.js +61 -3
- package/build/commands/build/internal/mockSite/spec/runtime-core.spec.js +506 -0
- package/build/commands/build/internal/mockSite/spec/sw.spec.js +356 -1
- package/package.json +3 -3
|
@@ -150,13 +150,20 @@
|
|
|
150
150
|
writeFiles,
|
|
151
151
|
clear: clearAll,
|
|
152
152
|
snapshot: () => askWorker({ type: 'sasjs-snapshot' }, 'sasjs-snapshot'),
|
|
153
|
+
/**
|
|
154
|
+
* The drive total in bytes, measured by the worker: it owns the stored
|
|
155
|
+
* representation, so the figure stays the one `statSync` reports rather than
|
|
156
|
+
* the length of the strings this store happens to hold - which would count
|
|
157
|
+
* the base64 expansion and the marker of a byte entry.
|
|
158
|
+
*/
|
|
153
159
|
stats: async () => {
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
+
const answer = await askWorker({ type: 'sasjs-stats' }, 'sasjs-stats')
|
|
161
|
+
// a worker that cannot report fails the read, as the other drive reads
|
|
162
|
+
// do: a caller destructuring { files, bytes } must not be handed NaN, and
|
|
163
|
+
// neither must a reply of an older shape that carries no stats at all
|
|
164
|
+
if (answer.error) throw new Error(answer.error)
|
|
165
|
+
if (!answer.stats) throw new Error('sasjs-stats reply carried no stats')
|
|
166
|
+
return answer.stats
|
|
160
167
|
},
|
|
161
168
|
/**
|
|
162
169
|
* Downloads the current drive as `mock-snapshot.json`. Drop that file in the
|