Skip to content

Commit b657ff0

Browse files
authored
FAQ entries for Math.pow(BitInt) & import.meta.url (#234)
1 parent 60682d4 commit b657ff0

File tree

5 files changed

+70
-70
lines changed

5 files changed

+70
-70
lines changed

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Dependencies
2-
/node_modules
2+
node_modules/
33

44
# Production
5-
/build
5+
build/
66

77
# Generated files
88
.docusaurus

docs/api/FAQ.md

+31
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,34 @@ When running into TypeScript errors, ensure that you are on a recent version. Th
114114
Additionally the [rxjs library](https://github.com/ReactiveX/rxjs/) (used internally by the API), requires at least a [TypeScript 4.2 version](https://github.com/ReactiveX/rxjs/blob/6bd1c5f3cf0e387973b44698c48bc933e8c528aa/package.json#L9), without it the Observable types are not correctly resolved.
115115

116116
The API itself generally always uses the latest TypeScript versions under development, but the use of new of features are delayed to at least 2 major versions to not require immediate upgrades of the compilers.
117+
118+
119+
## On Webpack 4 I have a parse error on import.meta.url
120+
121+
Under CJS environments `__dirname` is used to determine package locations, on ESM environments the `new URL('.', import.meta.url).pathname` form is used to yeild the same results. This resolves a long-running issue wher the functionality was not available under ESM environments.
122+
123+
Webpack 4 doesn't support the `import.meta.url` syntax (the Webpack 5 betas added support, which was not backported), however there is a plugin available to add this functionality, specifically [https://www.npmjs.com/package/@open-wc/webpack-import-meta-loader](https://www.npmjs.com/package/@open-wc/webpack-import-meta-loader).
124+
125+
The following config has been verified as working for old versions of Webpack -
126+
127+
```js
128+
module: {
129+
rules: [
130+
{
131+
test: /\.js$/,
132+
loader: require.resolve('@open-wc/webpack-import-meta-loader'),
133+
}
134+
],
135+
},
136+
```
137+
138+
139+
## Under my babel build, I have a BigInt to number conversion error
140+
141+
This is casued by a Babel config that transforms inputs such as `2 ** 32` to `Math.pow(2, 32)`. The `transform-exponentiation-operator` is not `BigInt` aware, which means that it aloso transforms
142+
`BigInt(2) ** BigInt(256)` into an invalid `Math.pow(BigInt(2), BigInt(256))` which then fails on execution.
143+
144+
It is not specific to the API or libraries, but rather the local build environment and a known issue [https://github.com/blockstack/stacks.js/issues/1096#issuecomment-946350299](https://github.com/blockstack/stacks.js/issues/1096#issuecomment-946350299) which can be fixed with 1 of two overrides as per the linked issue -
145+
146+
- exclude Babel `transform-exponentiation-operator`
147+
- adjust browserslist to exclude old versions

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"@docusaurus/core": "2.0.0-beta.14",
1919
"@docusaurus/preset-classic": "2.0.0-beta.14",
2020
"@mdx-js/react": "^1.6.22",
21-
"@polkadot/dev": "^0.65.11",
21+
"@polkadot/dev": "^0.65.16",
2222
"@polkadot/typegen": "^7.2.1",
2323
"clsx": "^1.1.1",
2424
"react": "^17.0.2",

packages/build/CONTRIBUTORS

-32
This file was deleted.

yarn.lock

+36-35
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ __metadata:
232232
languageName: node
233233
linkType: hard
234234

235-
"@babel/core@npm:^7.1.0, @babel/core@npm:^7.12.3, @babel/core@npm:^7.15.5, @babel/core@npm:^7.16.0, @babel/core@npm:^7.16.7, @babel/core@npm:^7.7.2":
235+
"@babel/core@npm:^7.1.0, @babel/core@npm:^7.12.3, @babel/core@npm:^7.15.5, @babel/core@npm:^7.16.0, @babel/core@npm:^7.16.7, @babel/core@npm:^7.7.2, @babel/core@npm:^7.8.0":
236236
version: 7.16.7
237237
resolution: "@babel/core@npm:7.16.7"
238238
dependencies:
@@ -2220,9 +2220,9 @@ __metadata:
22202220
languageName: node
22212221
linkType: hard
22222222

2223-
"@jest/core@npm:^27.4.6":
2224-
version: 27.4.6
2225-
resolution: "@jest/core@npm:27.4.6"
2223+
"@jest/core@npm:^27.4.7":
2224+
version: 27.4.7
2225+
resolution: "@jest/core@npm:27.4.7"
22262226
dependencies:
22272227
"@jest/console": ^27.4.6
22282228
"@jest/reporters": ^27.4.6
@@ -2236,7 +2236,7 @@ __metadata:
22362236
exit: ^0.1.2
22372237
graceful-fs: ^4.2.4
22382238
jest-changed-files: ^27.4.2
2239-
jest-config: ^27.4.6
2239+
jest-config: ^27.4.7
22402240
jest-haste-map: ^27.4.6
22412241
jest-message-util: ^27.4.6
22422242
jest-regex-util: ^27.4.0
@@ -2257,7 +2257,7 @@ __metadata:
22572257
peerDependenciesMeta:
22582258
node-notifier:
22592259
optional: true
2260-
checksum: 903c2c45e74a276795453a743b6ca8344e3bad8d8b169760286ca4cc828c1d51e903f67971b9e244ebf9b88286a99bccc587a23a28fea23fd80ae846113b3834
2260+
checksum: 24ed123ef1819fa8c6069706760efac9904ee8824b22c346259be2017d820b5e578a4d444339448a576a0158e6fec91d18fdedb201bc97d7390b105d665f3642
22612261
languageName: node
22622262
linkType: hard
22632263

@@ -2721,9 +2721,9 @@ __metadata:
27212721
languageName: node
27222722
linkType: hard
27232723

2724-
"@polkadot/dev@npm:^0.65.11":
2725-
version: 0.65.11
2726-
resolution: "@polkadot/dev@npm:0.65.11"
2724+
"@polkadot/dev@npm:^0.65.16":
2725+
version: 0.65.16
2726+
resolution: "@polkadot/dev@npm:0.65.16"
27272727
dependencies:
27282728
"@babel/cli": ^7.16.7
27292729
"@babel/core": ^7.16.7
@@ -2745,7 +2745,7 @@ __metadata:
27452745
"@rollup/plugin-commonjs": ^21.0.1
27462746
"@rollup/plugin-inject": ^4.0.4
27472747
"@rollup/plugin-json": ^4.1.0
2748-
"@rollup/plugin-node-resolve": ^13.1.2
2748+
"@rollup/plugin-node-resolve": ^13.1.3
27492749
"@rushstack/eslint-patch": ^1.1.0
27502750
"@typescript-eslint/eslint-plugin": 5.9.0
27512751
"@typescript-eslint/parser": 5.9.0
@@ -2773,9 +2773,9 @@ __metadata:
27732773
gh-release: ^6.0.1
27742774
glob: ^7.2.0
27752775
glob2base: ^0.0.12
2776-
jest: ^27.4.6
2777-
jest-cli: ^27.4.6
2778-
jest-config: ^27.4.6
2776+
jest: ^27.4.7
2777+
jest-cli: ^27.4.7
2778+
jest-config: ^27.4.7
27792779
jest-haste-map: ^27.4.6
27802780
jest-resolve: ^27.4.6
27812781
madge: ^5.0.1
@@ -2809,7 +2809,7 @@ __metadata:
28092809
polkadot-exec-rollup: scripts/polkadot-exec-rollup.mjs
28102810
polkadot-exec-tsc: scripts/polkadot-exec-tsc.mjs
28112811
polkadot-exec-webpack: scripts/polkadot-exec-webpack.mjs
2812-
checksum: fff61419134166317047d50f30761596fba9b0fdffeae0e544edac09f4a49388ed969586dc2a121d83bcfcfdaa8a56111206f5fe7a745ef2be223d14b31eb9fa
2812+
checksum: 0b3c310278cfa86dfb13f88496d61cab64ad4c4cdf2876a38f62637eb1c376930881c6315ecda55ae0a2ae1592a67d69be4a55711a937a00fbe939b7abe644b1
28132813
languageName: node
28142814
linkType: hard
28152815

@@ -3181,9 +3181,9 @@ __metadata:
31813181
languageName: node
31823182
linkType: hard
31833183

3184-
"@rollup/plugin-node-resolve@npm:^13.1.2":
3185-
version: 13.1.2
3186-
resolution: "@rollup/plugin-node-resolve@npm:13.1.2"
3184+
"@rollup/plugin-node-resolve@npm:^13.1.3":
3185+
version: 13.1.3
3186+
resolution: "@rollup/plugin-node-resolve@npm:13.1.3"
31873187
dependencies:
31883188
"@rollup/pluginutils": ^3.1.0
31893189
"@types/resolve": 1.17.1
@@ -3193,7 +3193,7 @@ __metadata:
31933193
resolve: ^1.19.0
31943194
peerDependencies:
31953195
rollup: ^2.42.0
3196-
checksum: b75cd8f8110a3001fa6af76fb0feb0ebfe96d6394383147276106f11d296307719aec58364b92f402723749b74e6de82d002570d3accfaede572ad3b1d8534ba
3196+
checksum: c275843aef884ff15ed7edb8a3b8fd072a72d517632098f6e9c25ef2c00f7842559565cc77e16c59eb119b8c4e2d858a8b5a94701ca6f85ae6a4f60a6e31f0ab
31973197
languageName: node
31983198
linkType: hard
31993199

@@ -9783,18 +9783,18 @@ __metadata:
97839783
languageName: node
97849784
linkType: hard
97859785

9786-
"jest-cli@npm:^27.4.6":
9787-
version: 27.4.6
9788-
resolution: "jest-cli@npm:27.4.6"
9786+
"jest-cli@npm:^27.4.7":
9787+
version: 27.4.7
9788+
resolution: "jest-cli@npm:27.4.7"
97899789
dependencies:
9790-
"@jest/core": ^27.4.6
9790+
"@jest/core": ^27.4.7
97919791
"@jest/test-result": ^27.4.6
97929792
"@jest/types": ^27.4.2
97939793
chalk: ^4.0.0
97949794
exit: ^0.1.2
97959795
graceful-fs: ^4.2.4
97969796
import-local: ^3.0.2
9797-
jest-config: ^27.4.6
9797+
jest-config: ^27.4.7
97989798
jest-util: ^27.4.2
97999799
jest-validate: ^27.4.6
98009800
prompts: ^2.0.1
@@ -9806,14 +9806,15 @@ __metadata:
98069806
optional: true
98079807
bin:
98089808
jest: bin/jest.js
9809-
checksum: 924dd24b74f33f79fa8cbc577d4c13aa8645b41d53c4678b6f999dd02d7fe027c397db1898e4b4cda08001efb65dd29ed4492e2818d149098092df8314ed441b
9809+
checksum: bf301039f1c14ef3fa2b7699b7b94328faa5549e34cb1573610c894bedd036ad36e31e6af436e11b3aa85e22e409a05d1fef1624bebc2da7ed416ce969b87307
98109810
languageName: node
98119811
linkType: hard
98129812

9813-
"jest-config@npm:^27.4.6":
9814-
version: 27.4.6
9815-
resolution: "jest-config@npm:27.4.6"
9813+
"jest-config@npm:^27.4.7":
9814+
version: 27.4.7
9815+
resolution: "jest-config@npm:27.4.7"
98169816
dependencies:
9817+
"@babel/core": ^7.8.0
98179818
"@jest/test-sequencer": ^27.4.6
98189819
"@jest/types": ^27.4.2
98199820
babel-jest: ^27.4.6
@@ -9840,7 +9841,7 @@ __metadata:
98409841
peerDependenciesMeta:
98419842
ts-node:
98429843
optional: true
9843-
checksum: 90dafbf8bcc01ffab0bc085bd8ca5f9866f6c7a13202c3031ab6a668ed4a9a21e9eb4537ea0cb575765dc3099e70f2f9089bb25a4627b05d2bde50f06bddcc33
9844+
checksum: 23d5bacc483b2674d6efcd6bfc66bcde7c2b428511b50d17a22a2750d85bfc23753f9e41f504411e411e848e34ec61244bdae9da8782df4ada6e284106f71a4d
98449845
languageName: node
98459846
linkType: hard
98469847

@@ -10214,21 +10215,21 @@ __metadata:
1021410215
languageName: node
1021510216
linkType: hard
1021610217

10217-
"jest@npm:^27.4.6":
10218-
version: 27.4.6
10219-
resolution: "jest@npm:27.4.6"
10218+
"jest@npm:^27.4.7":
10219+
version: 27.4.7
10220+
resolution: "jest@npm:27.4.7"
1022010221
dependencies:
10221-
"@jest/core": ^27.4.6
10222+
"@jest/core": ^27.4.7
1022210223
import-local: ^3.0.2
10223-
jest-cli: ^27.4.6
10224+
jest-cli: ^27.4.7
1022410225
peerDependencies:
1022510226
node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0
1022610227
peerDependenciesMeta:
1022710228
node-notifier:
1022810229
optional: true
1022910230
bin:
1023010231
jest: bin/jest.js
10231-
checksum: 5b7bf3d1017f96110c6197e301f0e7bf1733ab300034e4f00ef0921e5fbf2e26e167454a7637bdac46df14385b1e1386cd2ad7d9aefe5793c60f775be2043534
10232+
checksum: 28ce948b30c074907393f37553acac4422d0f60190776e62b3403e4c742d33dd6012e3a20748254a43e38b5b4ce52d813b13a3a5be1d43d6d12429bd08ce1a23
1023210233
languageName: node
1023310234
linkType: hard
1023410235

@@ -12200,7 +12201,7 @@ __metadata:
1220012201
"@docusaurus/core": 2.0.0-beta.14
1220112202
"@docusaurus/preset-classic": 2.0.0-beta.14
1220212203
"@mdx-js/react": ^1.6.22
12203-
"@polkadot/dev": ^0.65.11
12204+
"@polkadot/dev": ^0.65.16
1220412205
"@polkadot/typegen": ^7.2.1
1220512206
clsx: ^1.1.1
1220612207
react: ^17.0.2

0 commit comments

Comments
 (0)