@sasjs/utils 3.7.4 → 4.0.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/README.md CHANGED
@@ -6,6 +6,29 @@
6
6
 
7
7
  A library of utilities and types for SASjs written in TypeScript.
8
8
 
9
+ ## Entry points
10
+
11
+ This is a Node library, and the barrel - `import { x } from '@sasjs/utils'` - is its Node
12
+ entry point. Importing from it pulls in the modules that only Node can run: `fs-extra` and
13
+ `@fast-csv/format` through `./file`, `prompts` through `./input`, `chalk` and `consola`
14
+ through `./logger` and `./formatter`.
15
+
16
+ Code that is bundled for a browser imports the subpath it needs instead:
17
+
18
+ ```
19
+ import { ServerType } from '@sasjs/utils/types'
20
+ import { prefixMessage } from '@sasjs/utils/error'
21
+ import { isSpecialMissing } from '@sasjs/utils/input/validators'
22
+ import { bytesToSize } from '@sasjs/utils/utils'
23
+ ```
24
+
25
+ The hash and sync helpers - `getHash`, `compareHashes`, `extractHashArray`,
26
+ `generateCompileProgram`, `generateProgramToGetRemoteHash`, `generateProgramToSyncHashDiff`
27
+ and `findResourcesNotPresentLocally` - live in `@sasjs/utils/fs`. They hash files and
28
+ folders on disk, so they are Node-only, and the barrel does not re-export them: a browser
29
+ bundle that imports the barrel for anything else no longer reaches `crypto`, which used to
30
+ arrive with the whole AES/RSA/ECDSA polyfill suite behind it.
31
+
9
32
  ## Contributors ✨
10
33
 
11
34
  Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
package/index.d.ts CHANGED
@@ -8,4 +8,3 @@ export * from './time';
8
8
  export * from './types';
9
9
  export * from './utils';
10
10
  export * from './compileTree';
11
- export * from './fs';
package/index.js CHANGED
@@ -20,5 +20,10 @@ __exportStar(require("./time"), exports);
20
20
  __exportStar(require("./types"), exports);
21
21
  __exportStar(require("./utils"), exports);
22
22
  __exportStar(require("./compileTree"), exports);
23
- __exportStar(require("./fs"), exports);
23
+ // './fs' is deliberately absent: it is the only module here that imports
24
+ // `crypto`, and re-exporting it put that - plus browserify-sign, parse-asn1,
25
+ // asn1.js and vm-browserify, roughly 555 KB of AES/RSA/ECDSA polyfills and a
26
+ // vm shim's dynamic code execution - into every browser bundle that imported
27
+ // anything from this barrel. The helpers live at '@sasjs/utils/fs' instead.
28
+ // See sasjs/utils#275.
24
29
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAsB;AACtB,yCAAsB;AACtB,8CAA2B;AAC3B,0CAAuB;AACvB,2CAAwB;AACxB,6CAA0B;AAC1B,yCAAsB;AACtB,0CAAuB;AACvB,0CAAuB;AACvB,gDAA6B;AAC7B,uCAAoB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAsB;AACtB,yCAAsB;AACtB,8CAA2B;AAC3B,0CAAuB;AACvB,2CAAwB;AACxB,6CAA0B;AAC1B,yCAAsB;AACtB,0CAAuB;AACvB,0CAAuB;AACvB,gDAA6B;AAC7B,yEAAyE;AACzE,6EAA6E;AAC7E,6EAA6E;AAC7E,6EAA6E;AAC7E,4EAA4E;AAC5E,uBAAuB"}
package/package.json CHANGED
@@ -95,5 +95,5 @@
95
95
  "jwt-decode": "4.0.0",
96
96
  "prompts": "2.4.2"
97
97
  },
98
- "version": "3.7.4"
98
+ "version": "4.0.0"
99
99
  }