muhammara 6.0.0 → 6.0.2
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/node_modules/@mapbox/node-pre-gyp/.github/workflows/ci.yml +4 -5
- package/node_modules/@mapbox/node-pre-gyp/.github/workflows/codeql.yml +4 -4
- package/node_modules/@mapbox/node-pre-gyp/.github/workflows/release.yml +4 -4
- package/node_modules/@mapbox/node-pre-gyp/.github/workflows/s3-bucket.yml +47 -0
- package/node_modules/@mapbox/node-pre-gyp/CHANGELOG.md +11 -0
- package/node_modules/@mapbox/node-pre-gyp/README.md +30 -2
- package/node_modules/@mapbox/node-pre-gyp/lib/install.js +79 -0
- package/node_modules/@mapbox/node-pre-gyp/lib/mock/http.js +38 -0
- package/node_modules/@mapbox/node-pre-gyp/lib/mock/s3.js +44 -0
- package/node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js +2 -12
- package/node_modules/@mapbox/node-pre-gyp/lib/publish.js +3 -2
- package/node_modules/@mapbox/node-pre-gyp/lib/util/abi_crosswalk.json +53 -1
- package/node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js +7 -102
- package/node_modules/@mapbox/node-pre-gyp/lib/util/versioning.js +3 -2
- package/node_modules/@mapbox/node-pre-gyp/package.json +9 -4
- package/node_modules/tar/LICENSE.md +55 -0
- package/node_modules/tar/README.md +52 -12
- package/node_modules/tar/dist/commonjs/extract.js +17 -7
- package/node_modules/tar/dist/commonjs/extract.js.map +1 -1
- package/node_modules/tar/dist/commonjs/header.d.ts +0 -1
- package/node_modules/tar/dist/commonjs/header.d.ts.map +1 -1
- package/node_modules/tar/dist/commonjs/header.js +38 -19
- package/node_modules/tar/dist/commonjs/header.js.map +1 -1
- package/node_modules/tar/dist/commonjs/index.js +17 -7
- package/node_modules/tar/dist/commonjs/index.js.map +1 -1
- package/node_modules/tar/dist/commonjs/large-numbers.d.ts +1 -2
- package/node_modules/tar/dist/commonjs/large-numbers.d.ts.map +1 -1
- package/node_modules/tar/dist/commonjs/list.d.ts.map +1 -1
- package/node_modules/tar/dist/commonjs/list.js +24 -10
- package/node_modules/tar/dist/commonjs/list.js.map +1 -1
- package/node_modules/tar/dist/commonjs/make-command.d.ts.map +1 -1
- package/node_modules/tar/dist/commonjs/mkdir.d.ts +1 -3
- package/node_modules/tar/dist/commonjs/mkdir.d.ts.map +1 -1
- package/node_modules/tar/dist/commonjs/mkdir.js +22 -43
- package/node_modules/tar/dist/commonjs/mkdir.js.map +1 -1
- package/node_modules/tar/dist/commonjs/mode-fix.d.ts.map +1 -1
- package/node_modules/tar/dist/commonjs/normalize-unicode.d.ts +1 -1
- package/node_modules/tar/dist/commonjs/normalize-unicode.d.ts.map +1 -1
- package/node_modules/tar/dist/commonjs/normalize-unicode.js +25 -4
- package/node_modules/tar/dist/commonjs/normalize-unicode.js.map +1 -1
- package/node_modules/tar/dist/commonjs/options.d.ts +28 -37
- package/node_modules/tar/dist/commonjs/options.d.ts.map +1 -1
- package/node_modules/tar/dist/commonjs/options.js.map +1 -1
- package/node_modules/tar/dist/commonjs/pack.d.ts +2 -3
- package/node_modules/tar/dist/commonjs/pack.d.ts.map +1 -1
- package/node_modules/tar/dist/commonjs/pack.js +49 -10
- package/node_modules/tar/dist/commonjs/pack.js.map +1 -1
- package/node_modules/tar/dist/commonjs/parse.d.ts +4 -6
- package/node_modules/tar/dist/commonjs/parse.d.ts.map +1 -1
- package/node_modules/tar/dist/commonjs/parse.js +33 -12
- package/node_modules/tar/dist/commonjs/parse.js.map +1 -1
- package/node_modules/tar/dist/commonjs/path-reservations.d.ts.map +1 -1
- package/node_modules/tar/dist/commonjs/path-reservations.js +1 -1
- package/node_modules/tar/dist/commonjs/path-reservations.js.map +1 -1
- package/node_modules/tar/dist/commonjs/pax.d.ts +1 -2
- package/node_modules/tar/dist/commonjs/pax.d.ts.map +1 -1
- package/node_modules/tar/dist/commonjs/read-entry.d.ts +0 -1
- package/node_modules/tar/dist/commonjs/read-entry.d.ts.map +1 -1
- package/node_modules/tar/dist/commonjs/replace.d.ts.map +1 -1
- package/node_modules/tar/dist/commonjs/replace.js +1 -0
- package/node_modules/tar/dist/commonjs/replace.js.map +1 -1
- package/node_modules/tar/dist/commonjs/strip-absolute-path.d.ts.map +1 -1
- package/node_modules/tar/dist/commonjs/strip-trailing-slashes.d.ts.map +1 -1
- package/node_modules/tar/dist/commonjs/types.d.ts.map +1 -1
- package/node_modules/tar/dist/commonjs/unpack.d.ts +2 -4
- package/node_modules/tar/dist/commonjs/unpack.d.ts.map +1 -1
- package/node_modules/tar/dist/commonjs/unpack.js +76 -79
- package/node_modules/tar/dist/commonjs/unpack.js.map +1 -1
- package/node_modules/tar/dist/commonjs/warn-method.d.ts +0 -1
- package/node_modules/tar/dist/commonjs/warn-method.d.ts.map +1 -1
- package/node_modules/tar/dist/commonjs/winchars.d.ts.map +1 -1
- package/node_modules/tar/dist/commonjs/write-entry.d.ts +0 -3
- package/node_modules/tar/dist/commonjs/write-entry.d.ts.map +1 -1
- package/node_modules/tar/dist/commonjs/write-entry.js +17 -7
- package/node_modules/tar/dist/commonjs/write-entry.js.map +1 -1
- package/node_modules/tar/dist/esm/header.d.ts +0 -1
- package/node_modules/tar/dist/esm/header.d.ts.map +1 -1
- package/node_modules/tar/dist/esm/header.js +21 -12
- package/node_modules/tar/dist/esm/header.js.map +1 -1
- package/node_modules/tar/dist/esm/large-numbers.d.ts +1 -2
- package/node_modules/tar/dist/esm/large-numbers.d.ts.map +1 -1
- package/node_modules/tar/dist/esm/list.d.ts.map +1 -1
- package/node_modules/tar/dist/esm/list.js +7 -3
- package/node_modules/tar/dist/esm/list.js.map +1 -1
- package/node_modules/tar/dist/esm/make-command.d.ts.map +1 -1
- package/node_modules/tar/dist/esm/mkdir.d.ts +1 -3
- package/node_modules/tar/dist/esm/mkdir.d.ts.map +1 -1
- package/node_modules/tar/dist/esm/mkdir.js +12 -33
- package/node_modules/tar/dist/esm/mkdir.js.map +1 -1
- package/node_modules/tar/dist/esm/mode-fix.d.ts.map +1 -1
- package/node_modules/tar/dist/esm/normalize-unicode.d.ts +1 -1
- package/node_modules/tar/dist/esm/normalize-unicode.d.ts.map +1 -1
- package/node_modules/tar/dist/esm/normalize-unicode.js +25 -4
- package/node_modules/tar/dist/esm/normalize-unicode.js.map +1 -1
- package/node_modules/tar/dist/esm/options.d.ts +28 -37
- package/node_modules/tar/dist/esm/options.d.ts.map +1 -1
- package/node_modules/tar/dist/esm/options.js.map +1 -1
- package/node_modules/tar/dist/esm/pack.d.ts +2 -3
- package/node_modules/tar/dist/esm/pack.d.ts.map +1 -1
- package/node_modules/tar/dist/esm/pack.js +32 -3
- package/node_modules/tar/dist/esm/pack.js.map +1 -1
- package/node_modules/tar/dist/esm/parse.d.ts +4 -6
- package/node_modules/tar/dist/esm/parse.d.ts.map +1 -1
- package/node_modules/tar/dist/esm/parse.js +34 -13
- package/node_modules/tar/dist/esm/parse.js.map +1 -1
- package/node_modules/tar/dist/esm/path-reservations.d.ts.map +1 -1
- package/node_modules/tar/dist/esm/path-reservations.js +1 -1
- package/node_modules/tar/dist/esm/path-reservations.js.map +1 -1
- package/node_modules/tar/dist/esm/pax.d.ts +1 -2
- package/node_modules/tar/dist/esm/pax.d.ts.map +1 -1
- package/node_modules/tar/dist/esm/read-entry.d.ts +0 -1
- package/node_modules/tar/dist/esm/read-entry.d.ts.map +1 -1
- package/node_modules/tar/dist/esm/replace.d.ts.map +1 -1
- package/node_modules/tar/dist/esm/replace.js +1 -0
- package/node_modules/tar/dist/esm/replace.js.map +1 -1
- package/node_modules/tar/dist/esm/strip-absolute-path.d.ts.map +1 -1
- package/node_modules/tar/dist/esm/strip-trailing-slashes.d.ts.map +1 -1
- package/node_modules/tar/dist/esm/types.d.ts.map +1 -1
- package/node_modules/tar/dist/esm/unpack.d.ts +2 -4
- package/node_modules/tar/dist/esm/unpack.d.ts.map +1 -1
- package/node_modules/tar/dist/esm/unpack.js +59 -72
- package/node_modules/tar/dist/esm/unpack.js.map +1 -1
- package/node_modules/tar/dist/esm/warn-method.d.ts +0 -1
- package/node_modules/tar/dist/esm/warn-method.d.ts.map +1 -1
- package/node_modules/tar/dist/esm/winchars.d.ts.map +1 -1
- package/node_modules/tar/dist/esm/write-entry.d.ts +0 -3
- package/node_modules/tar/dist/esm/write-entry.d.ts.map +1 -1
- package/node_modules/tar/package.json +12 -66
- package/package.json +5 -3
- package/node_modules/@mapbox/node-pre-gyp/changelog_for_version.md +0 -6
- package/node_modules/tar/LICENSE +0 -15
- package/node_modules/tar/node_modules/mkdirp/LICENSE +0 -21
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/package.json +0 -91
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/bin.d.ts +0 -3
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/bin.d.ts.map +0 -1
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/bin.js +0 -80
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/bin.js.map +0 -1
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/find-made.d.ts +0 -4
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/find-made.d.ts.map +0 -1
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/find-made.js +0 -35
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/find-made.js.map +0 -1
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/index.d.ts +0 -39
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/index.d.ts.map +0 -1
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/index.js +0 -53
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/index.js.map +0 -1
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.d.ts +0 -6
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.d.ts.map +0 -1
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.js +0 -79
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/mkdirp-manual.js.map +0 -1
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/mkdirp-native.d.ts +0 -6
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/mkdirp-native.d.ts.map +0 -1
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/mkdirp-native.js +0 -50
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/mkdirp-native.js.map +0 -1
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/opts-arg.d.ts +0 -42
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/opts-arg.d.ts.map +0 -1
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/opts-arg.js +0 -38
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/opts-arg.js.map +0 -1
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/path-arg.d.ts +0 -2
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/path-arg.d.ts.map +0 -1
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/path-arg.js +0 -28
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/path-arg.js.map +0 -1
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/use-native.d.ts +0 -6
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/use-native.d.ts.map +0 -1
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/use-native.js +0 -17
- package/node_modules/tar/node_modules/mkdirp/dist/cjs/src/use-native.js.map +0 -1
- package/node_modules/tar/node_modules/mkdirp/dist/mjs/find-made.d.ts +0 -4
- package/node_modules/tar/node_modules/mkdirp/dist/mjs/find-made.d.ts.map +0 -1
- package/node_modules/tar/node_modules/mkdirp/dist/mjs/find-made.js +0 -30
- package/node_modules/tar/node_modules/mkdirp/dist/mjs/find-made.js.map +0 -1
- package/node_modules/tar/node_modules/mkdirp/dist/mjs/index.d.ts +0 -39
- package/node_modules/tar/node_modules/mkdirp/dist/mjs/index.d.ts.map +0 -1
- package/node_modules/tar/node_modules/mkdirp/dist/mjs/index.js +0 -43
- package/node_modules/tar/node_modules/mkdirp/dist/mjs/index.js.map +0 -1
- package/node_modules/tar/node_modules/mkdirp/dist/mjs/mkdirp-manual.d.ts +0 -6
- package/node_modules/tar/node_modules/mkdirp/dist/mjs/mkdirp-manual.d.ts.map +0 -1
- package/node_modules/tar/node_modules/mkdirp/dist/mjs/mkdirp-manual.js +0 -75
- package/node_modules/tar/node_modules/mkdirp/dist/mjs/mkdirp-manual.js.map +0 -1
- package/node_modules/tar/node_modules/mkdirp/dist/mjs/mkdirp-native.d.ts +0 -6
- package/node_modules/tar/node_modules/mkdirp/dist/mjs/mkdirp-native.d.ts.map +0 -1
- package/node_modules/tar/node_modules/mkdirp/dist/mjs/mkdirp-native.js +0 -46
- package/node_modules/tar/node_modules/mkdirp/dist/mjs/mkdirp-native.js.map +0 -1
- package/node_modules/tar/node_modules/mkdirp/dist/mjs/opts-arg.d.ts +0 -42
- package/node_modules/tar/node_modules/mkdirp/dist/mjs/opts-arg.d.ts.map +0 -1
- package/node_modules/tar/node_modules/mkdirp/dist/mjs/opts-arg.js +0 -34
- package/node_modules/tar/node_modules/mkdirp/dist/mjs/opts-arg.js.map +0 -1
- package/node_modules/tar/node_modules/mkdirp/dist/mjs/package.json +0 -3
- package/node_modules/tar/node_modules/mkdirp/dist/mjs/path-arg.d.ts +0 -2
- package/node_modules/tar/node_modules/mkdirp/dist/mjs/path-arg.d.ts.map +0 -1
- package/node_modules/tar/node_modules/mkdirp/dist/mjs/path-arg.js +0 -24
- package/node_modules/tar/node_modules/mkdirp/dist/mjs/path-arg.js.map +0 -1
- package/node_modules/tar/node_modules/mkdirp/dist/mjs/use-native.d.ts +0 -6
- package/node_modules/tar/node_modules/mkdirp/dist/mjs/use-native.d.ts.map +0 -1
- package/node_modules/tar/node_modules/mkdirp/dist/mjs/use-native.js +0 -14
- package/node_modules/tar/node_modules/mkdirp/dist/mjs/use-native.js.map +0 -1
- package/node_modules/tar/node_modules/mkdirp/package.json +0 -91
- package/node_modules/tar/node_modules/mkdirp/readme.markdown +0 -281
|
@@ -11,14 +11,13 @@ jobs:
|
|
|
11
11
|
ci:
|
|
12
12
|
strategy:
|
|
13
13
|
fail-fast: false
|
|
14
|
-
max-parallel: 9
|
|
15
14
|
matrix:
|
|
16
|
-
node-version: ['
|
|
17
|
-
os: [macos-latest, ubuntu-latest, windows-latest]
|
|
15
|
+
node-version: ['20.x', '24.x', 'lts/*']
|
|
16
|
+
os: [macos-latest, ubuntu-latest, ubuntu-24.04-arm, windows-latest]
|
|
18
17
|
runs-on: ${{ matrix.os }}
|
|
19
18
|
steps:
|
|
20
|
-
- uses: actions/checkout@
|
|
21
|
-
- uses: actions/setup-node@
|
|
19
|
+
- uses: actions/checkout@v6
|
|
20
|
+
- uses: actions/setup-node@v6
|
|
22
21
|
with:
|
|
23
22
|
node-version: ${{ matrix.node-version }}
|
|
24
23
|
- run: npm ci
|
|
@@ -38,11 +38,11 @@ jobs:
|
|
|
38
38
|
|
|
39
39
|
steps:
|
|
40
40
|
- name: Checkout repository
|
|
41
|
-
uses: actions/checkout@
|
|
41
|
+
uses: actions/checkout@v6
|
|
42
42
|
|
|
43
43
|
# Initializes the CodeQL tools for scanning.
|
|
44
44
|
- name: Initialize CodeQL
|
|
45
|
-
uses: github/codeql-action/init@
|
|
45
|
+
uses: github/codeql-action/init@v4
|
|
46
46
|
with:
|
|
47
47
|
languages: ${{ matrix.language }}
|
|
48
48
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
@@ -56,7 +56,7 @@ jobs:
|
|
|
56
56
|
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
|
|
57
57
|
# If this step fails, then you should remove it and run the build manually (see below)
|
|
58
58
|
- name: Autobuild
|
|
59
|
-
uses: github/codeql-action/autobuild@
|
|
59
|
+
uses: github/codeql-action/autobuild@v4
|
|
60
60
|
|
|
61
61
|
# ℹ️ Command-line programs to run using the OS shell.
|
|
62
62
|
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
|
@@ -69,6 +69,6 @@ jobs:
|
|
|
69
69
|
# ./location_of_script_within_repo/buildscript.sh
|
|
70
70
|
|
|
71
71
|
- name: Perform CodeQL Analysis
|
|
72
|
-
uses: github/codeql-action/analyze@
|
|
72
|
+
uses: github/codeql-action/analyze@v4
|
|
73
73
|
with:
|
|
74
74
|
category: "/language:${{matrix.language}}"
|
|
@@ -13,9 +13,9 @@ jobs:
|
|
|
13
13
|
run:
|
|
14
14
|
shell: bash
|
|
15
15
|
steps:
|
|
16
|
-
- uses: actions/checkout@
|
|
16
|
+
- uses: actions/checkout@v6
|
|
17
17
|
|
|
18
|
-
- uses: actions/setup-node@
|
|
18
|
+
- uses: actions/setup-node@v6
|
|
19
19
|
with:
|
|
20
20
|
node-version: 22
|
|
21
21
|
|
|
@@ -43,9 +43,9 @@ jobs:
|
|
|
43
43
|
shell: bash
|
|
44
44
|
|
|
45
45
|
steps:
|
|
46
|
-
- uses: actions/checkout@
|
|
46
|
+
- uses: actions/checkout@v6
|
|
47
47
|
|
|
48
|
-
- uses: actions/setup-node@
|
|
48
|
+
- uses: actions/setup-node@v6
|
|
49
49
|
with:
|
|
50
50
|
node-version: 22
|
|
51
51
|
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
name: S3 Bucket Test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches:
|
|
7
|
+
- master
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
test-on-os-node-matrix:
|
|
12
|
+
runs-on: ${{ matrix.os }}
|
|
13
|
+
strategy:
|
|
14
|
+
matrix:
|
|
15
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
16
|
+
node: [20, 'lts/*']
|
|
17
|
+
env:
|
|
18
|
+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
19
|
+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
20
|
+
S3_BUCKET: ${{ secrets.S3_BUCKET }}
|
|
21
|
+
|
|
22
|
+
name: Test S3 Bucket - Node ${{ matrix.node }} on ${{ matrix.os }}
|
|
23
|
+
|
|
24
|
+
steps:
|
|
25
|
+
- name: Checkout ${{ github.ref }}
|
|
26
|
+
uses: actions/checkout@v6
|
|
27
|
+
|
|
28
|
+
- name: Setup node ${{ matrix.node }}
|
|
29
|
+
uses: actions/setup-node@v6
|
|
30
|
+
with:
|
|
31
|
+
node-version: ${{ matrix.node }}
|
|
32
|
+
|
|
33
|
+
- name: NPM Install
|
|
34
|
+
run: npm install
|
|
35
|
+
|
|
36
|
+
- name: Show Environment Info
|
|
37
|
+
run: |
|
|
38
|
+
printenv
|
|
39
|
+
node --version
|
|
40
|
+
npm --version
|
|
41
|
+
|
|
42
|
+
- name: Run S3 Tests (against ${{ env.S3_BUCKET }} bucket)
|
|
43
|
+
run: |
|
|
44
|
+
npm run bucket ${{ env.S3_BUCKET }}
|
|
45
|
+
npm run test:s3
|
|
46
|
+
if: ${{ env.S3_BUCKET != '' }}
|
|
47
|
+
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# node-pre-gyp changelog
|
|
2
2
|
|
|
3
|
+
## master
|
|
4
|
+
|
|
5
|
+
## 2.0.3
|
|
6
|
+
- Revert "Bump nopt from 8.0.0 to 9.0.0 (#919)" (#925)[https://github.com/mapbox/node-pre-gyp/pull/925]
|
|
7
|
+
|
|
8
|
+
## 2.0.2
|
|
9
|
+
- Support private ACL for S3 buckets [#923](https://github.com/mapbox/node-pre-gyp/pull/923)
|
|
10
|
+
|
|
11
|
+
## 2.0.1
|
|
12
|
+
- Update abi_crosswalk.json for abi 137 / node 24 (https://github.com/mapbox/node-pre-gyp/pull/904)
|
|
13
|
+
|
|
3
14
|
## 2.0.0
|
|
4
15
|
- Supported Node versions are now stable versions of Node 18+. We will attempt to track the [Node.js release schedule](https://github.com/nodejs/release#release-schedule) and will regularly retire support for versions that have reached EOL.
|
|
5
16
|
- Fixed use of `s3ForcePathStyle` for installation [#650](https://github.com/mapbox/node-pre-gyp/pull/650)
|
|
@@ -85,6 +85,7 @@ Options include:
|
|
|
85
85
|
- `--target=0.4.0`: Pass the target node or node-webkit version to compile against
|
|
86
86
|
- `--target_arch=ia32`: Pass the target arch and override the host `arch`. Any value that is [supported by Node.js](https://nodejs.org/api/os.html#osarch) is valid.
|
|
87
87
|
- `--target_platform=win32`: Pass the target platform and override the host `platform`. Valid values are `linux`, `darwin`, `win32`, `sunos`, `freebsd`, `openbsd`, and `aix`.
|
|
88
|
+
- `--acl=<acl>`: Set the S3 ACL when publishing binaries (e.g., `public-read`, `private`). Overrides the `binary.acl` setting in package.json.
|
|
88
89
|
|
|
89
90
|
Both `--build-from-source` and `--fallback-to-build` can be passed alone or they can provide values. You can pass `--fallback-to-build=false` to override the option as declared in package.json. In addition to being able to pass `--build-from-source` you can also pass `--build-from-source=myapp` where `myapp` is the name of your module.
|
|
90
91
|
|
|
@@ -185,6 +186,33 @@ Your S3 server region.
|
|
|
185
186
|
|
|
186
187
|
Set `s3ForcePathStyle` to true if the endpoint url should not be prefixed with the bucket name. If false (default), the server endpoint would be constructed as `bucket_name.your_server.com`.
|
|
187
188
|
|
|
189
|
+
###### acl
|
|
190
|
+
|
|
191
|
+
The S3 Access Control List (ACL) to apply when publishing binaries. Defaults to `'public-read'` for backward compatibility. Common values include:
|
|
192
|
+
|
|
193
|
+
- `public-read` - (default) Binary is publicly accessible by anyone
|
|
194
|
+
- `private` - Binary requires AWS credentials to download
|
|
195
|
+
- `authenticated-read` - Any authenticated AWS user can download
|
|
196
|
+
- `bucket-owner-read` - Bucket owner gets READ access
|
|
197
|
+
- `bucket-owner-full-control` - Bucket owner gets FULL_CONTROL access
|
|
198
|
+
|
|
199
|
+
**For private binaries:**
|
|
200
|
+
- Users installing your package will need AWS credentials configured (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables)
|
|
201
|
+
- The `aws-sdk` package must be available at install time
|
|
202
|
+
- If authentication fails, node-pre-gyp will fall back to building from source (if `--fallback-to-build` is specified)
|
|
203
|
+
|
|
204
|
+
You can also specify the ACL via command-line flag: `node-pre-gyp publish --acl=private`
|
|
205
|
+
|
|
206
|
+
Example for private binaries:
|
|
207
|
+
```json
|
|
208
|
+
"binary": {
|
|
209
|
+
"module_name": "your_module",
|
|
210
|
+
"module_path": "./lib/binding/",
|
|
211
|
+
"host": "https://your-bucket.s3.us-east-1.amazonaws.com",
|
|
212
|
+
"acl": "private"
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
188
216
|
##### The `binary` object has optional properties
|
|
189
217
|
|
|
190
218
|
###### remote_path
|
|
@@ -734,11 +762,11 @@ Using the `npm` config argument: `--{module_name}_binary_host_mirror` can downlo
|
|
|
734
762
|
e.g.: Install [v8-profiler](https://www.npmjs.com/package/v8-profiler) from `npm`.
|
|
735
763
|
|
|
736
764
|
```bash
|
|
737
|
-
$ npm install v8-profiler --profiler_binary_host_mirror=https://
|
|
765
|
+
$ npm install v8-profiler --profiler_binary_host_mirror=https://registry.npmmirror.com/node-inspector/
|
|
738
766
|
```
|
|
739
767
|
|
|
740
768
|
e.g.: Install [canvas-prebuilt](https://www.npmjs.com/package/canvas-prebuilt) from `npm`.
|
|
741
769
|
|
|
742
770
|
```bash
|
|
743
|
-
$ npm install canvas-prebuilt --canvas_prebuilt_binary_host_mirror=https://
|
|
771
|
+
$ npm install canvas-prebuilt --canvas_prebuilt_binary_host_mirror=https://registry.npmmirror.com/canvas-prebuilt/
|
|
744
772
|
```
|
|
@@ -10,6 +10,8 @@ const log = require('./util/log.js');
|
|
|
10
10
|
const existsAsync = fs.exists || path.exists;
|
|
11
11
|
const versioning = require('./util/versioning.js');
|
|
12
12
|
const napi = require('./util/napi.js');
|
|
13
|
+
const s3_setup = require('./util/s3_setup.js');
|
|
14
|
+
const url = require('url');
|
|
13
15
|
// for fetching binaries
|
|
14
16
|
const fetch = require('node-fetch');
|
|
15
17
|
const tar = require('tar');
|
|
@@ -23,6 +25,65 @@ try {
|
|
|
23
25
|
// do nothing
|
|
24
26
|
}
|
|
25
27
|
|
|
28
|
+
function place_binary_authenticated(opts, targetDir, callback) {
|
|
29
|
+
log.info('install', 'Attempting authenticated S3 download');
|
|
30
|
+
|
|
31
|
+
// Check if AWS credentials are available
|
|
32
|
+
if (!process.env.AWS_ACCESS_KEY_ID || !process.env.AWS_SECRET_ACCESS_KEY) {
|
|
33
|
+
const err = new Error('Binary is private but AWS credentials not found. Please configure AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables, or use --fallback-to-build to compile from source.');
|
|
34
|
+
err.statusCode = 403;
|
|
35
|
+
return callback(err);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
const config = s3_setup.detect(opts);
|
|
40
|
+
const s3 = s3_setup.get_s3(config);
|
|
41
|
+
const key_name = url.resolve(config.prefix, opts.package_name);
|
|
42
|
+
|
|
43
|
+
log.info('install', 'Downloading from S3:', config.bucket, key_name);
|
|
44
|
+
|
|
45
|
+
const s3_opts = {
|
|
46
|
+
Bucket: config.bucket,
|
|
47
|
+
Key: key_name
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
s3.getObject(s3_opts, (err, data) => {
|
|
51
|
+
if (err) {
|
|
52
|
+
log.error('install', 'Authenticated S3 download failed:', err.message);
|
|
53
|
+
return callback(err);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
log.info('install', 'Authenticated download successful, extracting...');
|
|
57
|
+
|
|
58
|
+
const { Readable } = require('stream');
|
|
59
|
+
const dataStream = Readable.from(data.Body);
|
|
60
|
+
|
|
61
|
+
let extractions = 0;
|
|
62
|
+
const countExtractions = (entry) => {
|
|
63
|
+
extractions += 1;
|
|
64
|
+
log.info('install', `unpacking ${entry.path}`);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
dataStream.pipe(extract(targetDir, countExtractions))
|
|
68
|
+
.on('error', (e) => {
|
|
69
|
+
callback(e);
|
|
70
|
+
})
|
|
71
|
+
.on('close', () => {
|
|
72
|
+
log.info('install', `extracted file count: ${extractions}`);
|
|
73
|
+
callback();
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
} catch (e) {
|
|
77
|
+
if (e.code === 'MODULE_NOT_FOUND' && e.message.includes('aws-sdk')) {
|
|
78
|
+
const err = new Error('Binary is private and requires aws-sdk for authenticated download. Please run: npm install aws-sdk');
|
|
79
|
+
err.statusCode = 403;
|
|
80
|
+
return callback(err);
|
|
81
|
+
}
|
|
82
|
+
log.error('install', 'Error setting up authenticated download:', e.message);
|
|
83
|
+
callback(e);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
26
87
|
function place_binary(uri, targetDir, opts, callback) {
|
|
27
88
|
log.log('GET', uri);
|
|
28
89
|
|
|
@@ -63,6 +124,14 @@ function place_binary(uri, targetDir, opts, callback) {
|
|
|
63
124
|
fetch(sanitized, { agent })
|
|
64
125
|
.then((res) => {
|
|
65
126
|
if (!res.ok) {
|
|
127
|
+
// If we get 403 Forbidden, the binary might be private - try authenticated download
|
|
128
|
+
if (res.status === 403) {
|
|
129
|
+
log.info('install', 'Received 403 Forbidden - attempting authenticated download');
|
|
130
|
+
// Call place_binary_authenticated and return a special marker
|
|
131
|
+
// to prevent the promise chain from calling callback again
|
|
132
|
+
place_binary_authenticated(opts, targetDir, callback);
|
|
133
|
+
return { authenticated: true };
|
|
134
|
+
}
|
|
66
135
|
throw new Error(`response status ${res.status} ${res.statusText} on ${sanitized}`);
|
|
67
136
|
}
|
|
68
137
|
const dataStream = res.body;
|
|
@@ -87,6 +156,9 @@ function place_binary(uri, targetDir, opts, callback) {
|
|
|
87
156
|
});
|
|
88
157
|
})
|
|
89
158
|
.then((text) => {
|
|
159
|
+
if (text && text.authenticated) {
|
|
160
|
+
return; // Don't call callback - place_binary_authenticated will handle it
|
|
161
|
+
}
|
|
90
162
|
log.info(text);
|
|
91
163
|
callback();
|
|
92
164
|
})
|
|
@@ -232,3 +304,10 @@ function install(gyp, argv, callback) {
|
|
|
232
304
|
});
|
|
233
305
|
}
|
|
234
306
|
}
|
|
307
|
+
|
|
308
|
+
// setting an environment variable: node_pre_gyp_mock_s3 to any value
|
|
309
|
+
// enables intercepting outgoing http requests to s3 (using nock) and
|
|
310
|
+
// serving them from a mocked S3 file system (using mock-aws-s3)
|
|
311
|
+
if (process.env.node_pre_gyp_mock_s3) {
|
|
312
|
+
require('./mock/http')();
|
|
313
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = exports = http_mock;
|
|
4
|
+
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
const nock = require('nock');
|
|
8
|
+
const os = require('os');
|
|
9
|
+
|
|
10
|
+
const log = require('../util/log.js');
|
|
11
|
+
log.heading = 'node-pre-gyp'; // differentiate node-pre-gyp's logs from npm's
|
|
12
|
+
|
|
13
|
+
function http_mock() {
|
|
14
|
+
log.warn('mocking http requests to s3');
|
|
15
|
+
|
|
16
|
+
const basePath = `${os.tmpdir()}/mock`;
|
|
17
|
+
|
|
18
|
+
nock(new RegExp('([a-z0-9]+[.])*s3[.]us-east-1[.]amazonaws[.]com'))
|
|
19
|
+
.persist()
|
|
20
|
+
.get(() => true) //a function that always returns true is a catch all for nock
|
|
21
|
+
.reply(
|
|
22
|
+
(uri) => {
|
|
23
|
+
const bucket = 'npg-mock-bucket';
|
|
24
|
+
const mockDir = uri.indexOf(bucket) === -1 ? `${basePath}/${bucket}` : basePath;
|
|
25
|
+
const filepath = path.join(mockDir, uri.replace(new RegExp('%2B', 'g'), '+'));
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
fs.accessSync(filepath, fs.constants.R_OK);
|
|
29
|
+
} catch (e) {
|
|
30
|
+
return [404, 'not found\n'];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// mock s3 functions write to disk
|
|
34
|
+
// return what is read from it.
|
|
35
|
+
return [200, fs.createReadStream(filepath)];
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = exports = s3_mock;
|
|
4
|
+
|
|
5
|
+
const AWSMock = require('mock-aws-s3');
|
|
6
|
+
const os = require('os');
|
|
7
|
+
|
|
8
|
+
const log = require('../util/log.js');
|
|
9
|
+
log.heading = 'node-pre-gyp'; // differentiate node-pre-gyp's logs from npm's
|
|
10
|
+
|
|
11
|
+
function s3_mock() {
|
|
12
|
+
log.warn('mocking s3 operations');
|
|
13
|
+
|
|
14
|
+
AWSMock.config.basePath = `${os.tmpdir()}/mock`;
|
|
15
|
+
|
|
16
|
+
const s3 = AWSMock.S3();
|
|
17
|
+
|
|
18
|
+
// wrapped callback maker. fs calls return code of ENOENT but AWS.S3 returns
|
|
19
|
+
// NotFound.
|
|
20
|
+
const wcb = (fn) => (err, ...args) => {
|
|
21
|
+
if (err && err.code === 'ENOENT') {
|
|
22
|
+
err.code = 'NotFound';
|
|
23
|
+
}
|
|
24
|
+
return fn(err, ...args);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
listObjects(params, callback) {
|
|
29
|
+
return s3.listObjects(params, wcb(callback));
|
|
30
|
+
},
|
|
31
|
+
headObject(params, callback) {
|
|
32
|
+
return s3.headObject(params, wcb(callback));
|
|
33
|
+
},
|
|
34
|
+
deleteObject(params, callback) {
|
|
35
|
+
return s3.deleteObject(params, wcb(callback));
|
|
36
|
+
},
|
|
37
|
+
putObject(params, callback) {
|
|
38
|
+
return s3.putObject(params, wcb(callback));
|
|
39
|
+
},
|
|
40
|
+
getObject(params, callback) {
|
|
41
|
+
return s3.getObject(params, wcb(callback));
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -10,13 +10,6 @@ module.exports = exports;
|
|
|
10
10
|
* Module dependencies.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
// load mocking control function for accessing s3 via https. the function is a noop always returning
|
|
14
|
-
// false if not mocking.
|
|
15
|
-
exports.mockS3Http = require('./util/s3_setup').get_mockS3Http();
|
|
16
|
-
exports.mockS3Http('on');
|
|
17
|
-
const mocking = exports.mockS3Http('get');
|
|
18
|
-
|
|
19
|
-
|
|
20
13
|
const fs = require('fs');
|
|
21
14
|
const path = require('path');
|
|
22
15
|
const nopt = require('nopt');
|
|
@@ -42,10 +35,6 @@ const cli_commands = [
|
|
|
42
35
|
];
|
|
43
36
|
const aliases = {};
|
|
44
37
|
|
|
45
|
-
if (mocking) {
|
|
46
|
-
log.warn(`mocking s3 to ${process.env.node_pre_gyp_mock_s3}`);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
38
|
// this is a getter to avoid circular reference warnings with node v14.
|
|
50
39
|
Object.defineProperty(exports, 'find', {
|
|
51
40
|
get: function() {
|
|
@@ -109,7 +98,8 @@ proto.configDefs = {
|
|
|
109
98
|
debug: Boolean, // 'build'
|
|
110
99
|
directory: String, // bin
|
|
111
100
|
proxy: String, // 'install'
|
|
112
|
-
loglevel: String // everywhere
|
|
101
|
+
loglevel: String, // everywhere
|
|
102
|
+
acl: String // 'publish' - S3 ACL for published binaries
|
|
113
103
|
};
|
|
114
104
|
|
|
115
105
|
/**
|
|
@@ -43,12 +43,13 @@ function publish(gyp, argv, callback) {
|
|
|
43
43
|
// the object does not already exist
|
|
44
44
|
log.info('publish', 'Preparing to put object');
|
|
45
45
|
const s3_put_opts = {
|
|
46
|
-
ACL:
|
|
46
|
+
ACL: opts.acl,
|
|
47
47
|
Body: fs.createReadStream(tarball),
|
|
48
48
|
Key: key_name,
|
|
49
49
|
Bucket: config.bucket
|
|
50
50
|
};
|
|
51
|
-
log.info('publish', 'Putting object', s3_put_opts.ACL
|
|
51
|
+
log.info('publish', 'Putting object with ACL:', s3_put_opts.ACL);
|
|
52
|
+
log.info('publish', 'Bucket:', s3_put_opts.Bucket, 'Key:', s3_put_opts.Key);
|
|
52
53
|
try {
|
|
53
54
|
s3.putObject(s3_put_opts, (err2, resp) => {
|
|
54
55
|
log.info('publish', 'returned from putting object');
|
|
@@ -2927,6 +2927,14 @@
|
|
|
2927
2927
|
"node_abi": 108,
|
|
2928
2928
|
"v8": "10.2"
|
|
2929
2929
|
},
|
|
2930
|
+
"18.20.7": {
|
|
2931
|
+
"node_abi": 108,
|
|
2932
|
+
"v8": "10.2"
|
|
2933
|
+
},
|
|
2934
|
+
"18.20.8": {
|
|
2935
|
+
"node_abi": 108,
|
|
2936
|
+
"v8": "10.2"
|
|
2937
|
+
},
|
|
2930
2938
|
"19.0.0": {
|
|
2931
2939
|
"node_abi": 111,
|
|
2932
2940
|
"v8": "10.7"
|
|
@@ -3099,6 +3107,18 @@
|
|
|
3099
3107
|
"node_abi": 115,
|
|
3100
3108
|
"v8": "11.3"
|
|
3101
3109
|
},
|
|
3110
|
+
"20.18.3": {
|
|
3111
|
+
"node_abi": 115,
|
|
3112
|
+
"v8": "11.3"
|
|
3113
|
+
},
|
|
3114
|
+
"20.19.0": {
|
|
3115
|
+
"node_abi": 115,
|
|
3116
|
+
"v8": "11.3"
|
|
3117
|
+
},
|
|
3118
|
+
"20.19.1": {
|
|
3119
|
+
"node_abi": 115,
|
|
3120
|
+
"v8": "11.3"
|
|
3121
|
+
},
|
|
3102
3122
|
"21.0.0": {
|
|
3103
3123
|
"node_abi": 120,
|
|
3104
3124
|
"v8": "11.8"
|
|
@@ -3219,6 +3239,14 @@
|
|
|
3219
3239
|
"node_abi": 127,
|
|
3220
3240
|
"v8": "12.4"
|
|
3221
3241
|
},
|
|
3242
|
+
"22.14.0": {
|
|
3243
|
+
"node_abi": 127,
|
|
3244
|
+
"v8": "12.4"
|
|
3245
|
+
},
|
|
3246
|
+
"22.15.0": {
|
|
3247
|
+
"node_abi": 127,
|
|
3248
|
+
"v8": "12.4"
|
|
3249
|
+
},
|
|
3222
3250
|
"23.0.0": {
|
|
3223
3251
|
"node_abi": 131,
|
|
3224
3252
|
"v8": "12.9"
|
|
@@ -3250,5 +3278,29 @@
|
|
|
3250
3278
|
"23.6.1": {
|
|
3251
3279
|
"node_abi": 131,
|
|
3252
3280
|
"v8": "12.9"
|
|
3281
|
+
},
|
|
3282
|
+
"23.7.0": {
|
|
3283
|
+
"node_abi": 131,
|
|
3284
|
+
"v8": "12.9"
|
|
3285
|
+
},
|
|
3286
|
+
"23.8.0": {
|
|
3287
|
+
"node_abi": 131,
|
|
3288
|
+
"v8": "12.9"
|
|
3289
|
+
},
|
|
3290
|
+
"23.9.0": {
|
|
3291
|
+
"node_abi": 131,
|
|
3292
|
+
"v8": "12.9"
|
|
3293
|
+
},
|
|
3294
|
+
"23.10.0": {
|
|
3295
|
+
"node_abi": 131,
|
|
3296
|
+
"v8": "12.9"
|
|
3297
|
+
},
|
|
3298
|
+
"23.11.0": {
|
|
3299
|
+
"node_abi": 131,
|
|
3300
|
+
"v8": "12.9"
|
|
3301
|
+
},
|
|
3302
|
+
"24.0.0": {
|
|
3303
|
+
"node_abi": 137,
|
|
3304
|
+
"v8": "13.6"
|
|
3253
3305
|
}
|
|
3254
|
-
}
|
|
3306
|
+
}
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
module.exports = exports;
|
|
4
4
|
|
|
5
5
|
const url = require('url');
|
|
6
|
-
const fs = require('fs');
|
|
7
|
-
const path = require('path');
|
|
8
6
|
|
|
9
7
|
module.exports.detect = function(opts) {
|
|
10
8
|
const config = {};
|
|
@@ -60,40 +58,11 @@ module.exports.detect = function(opts) {
|
|
|
60
58
|
};
|
|
61
59
|
|
|
62
60
|
module.exports.get_s3 = function(config) {
|
|
63
|
-
|
|
61
|
+
// setting an environment variable: node_pre_gyp_mock_s3 to any value
|
|
62
|
+
// enables intercepting outgoing http requests to s3 (using nock) and
|
|
63
|
+
// serving them from a mocked S3 file system (using mock-aws-s3)
|
|
64
64
|
if (process.env.node_pre_gyp_mock_s3) {
|
|
65
|
-
|
|
66
|
-
// for the mock code.
|
|
67
|
-
const AWSMock = require('mock-aws-s3');
|
|
68
|
-
const os = require('os');
|
|
69
|
-
|
|
70
|
-
AWSMock.config.basePath = `${os.tmpdir()}/mock`;
|
|
71
|
-
|
|
72
|
-
const s3 = AWSMock.S3();
|
|
73
|
-
|
|
74
|
-
// wrapped callback maker. fs calls return code of ENOENT but AWS.S3 returns
|
|
75
|
-
// NotFound.
|
|
76
|
-
const wcb = (fn) => (err, ...args) => {
|
|
77
|
-
if (err && err.code === 'ENOENT') {
|
|
78
|
-
err.code = 'NotFound';
|
|
79
|
-
}
|
|
80
|
-
return fn(err, ...args);
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
return {
|
|
84
|
-
listObjects(params, callback) {
|
|
85
|
-
return s3.listObjects(params, wcb(callback));
|
|
86
|
-
},
|
|
87
|
-
headObject(params, callback) {
|
|
88
|
-
return s3.headObject(params, wcb(callback));
|
|
89
|
-
},
|
|
90
|
-
deleteObject(params, callback) {
|
|
91
|
-
return s3.deleteObject(params, wcb(callback));
|
|
92
|
-
},
|
|
93
|
-
putObject(params, callback) {
|
|
94
|
-
return s3.putObject(params, wcb(callback));
|
|
95
|
-
}
|
|
96
|
-
};
|
|
65
|
+
return require('../mock/s3')();
|
|
97
66
|
}
|
|
98
67
|
|
|
99
68
|
// if not mocking then setup real s3.
|
|
@@ -115,73 +84,9 @@ module.exports.get_s3 = function(config) {
|
|
|
115
84
|
},
|
|
116
85
|
putObject(params, callback) {
|
|
117
86
|
return s3.putObject(params, callback);
|
|
87
|
+
},
|
|
88
|
+
getObject(params, callback) {
|
|
89
|
+
return s3.getObject(params, callback);
|
|
118
90
|
}
|
|
119
91
|
};
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
//
|
|
126
|
-
// function to get the mocking control function. if not mocking it returns a no-op.
|
|
127
|
-
//
|
|
128
|
-
// if mocking it sets up the mock http interceptors that use the mocked s3 file system
|
|
129
|
-
// to fulfill responses.
|
|
130
|
-
module.exports.get_mockS3Http = function() {
|
|
131
|
-
let mock_s3 = false;
|
|
132
|
-
if (!process.env.node_pre_gyp_mock_s3) {
|
|
133
|
-
return () => mock_s3;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
const nock = require('nock');
|
|
137
|
-
// the bucket used for testing, as addressed by https.
|
|
138
|
-
const host = 'https://mapbox-node-pre-gyp-public-testing-bucket.s3.us-east-1.amazonaws.com';
|
|
139
|
-
const mockDir = process.env.node_pre_gyp_mock_s3 + '/mapbox-node-pre-gyp-public-testing-bucket';
|
|
140
|
-
|
|
141
|
-
// function to setup interceptors. they are "turned off" by setting mock_s3 to false.
|
|
142
|
-
const mock_http = () => {
|
|
143
|
-
// eslint-disable-next-line no-unused-vars
|
|
144
|
-
function get(uri, requestBody) {
|
|
145
|
-
const filepath = path.join(mockDir, uri.replace('%2B', '+'));
|
|
146
|
-
|
|
147
|
-
try {
|
|
148
|
-
fs.accessSync(filepath, fs.constants.R_OK);
|
|
149
|
-
} catch (e) {
|
|
150
|
-
return [404, 'not found\n'];
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
// the mock s3 functions just write to disk, so just read from it.
|
|
154
|
-
return [200, fs.createReadStream(filepath)];
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// eslint-disable-next-line no-unused-vars
|
|
158
|
-
return nock(host)
|
|
159
|
-
.persist()
|
|
160
|
-
.get(() => mock_s3) // mock any uri for s3 when true
|
|
161
|
-
.reply(get);
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
// setup interceptors. they check the mock_s3 flag to determine whether to intercept.
|
|
165
|
-
mock_http(nock, host, mockDir);
|
|
166
|
-
// function to turn matching all requests to s3 on/off.
|
|
167
|
-
const mockS3Http = (action) => {
|
|
168
|
-
const previous = mock_s3;
|
|
169
|
-
if (action === 'off') {
|
|
170
|
-
mock_s3 = false;
|
|
171
|
-
} else if (action === 'on') {
|
|
172
|
-
mock_s3 = true;
|
|
173
|
-
} else if (action !== 'get') {
|
|
174
|
-
throw new Error(`illegal action for setMockHttp ${action}`);
|
|
175
|
-
}
|
|
176
|
-
return previous;
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
// call mockS3Http with the argument
|
|
180
|
-
// - 'on' - turn it on
|
|
181
|
-
// - 'off' - turn it off (used by fetch.test.js so it doesn't interfere with redirects)
|
|
182
|
-
// - 'get' - return true or false for 'on' or 'off'
|
|
183
|
-
return mockS3Http;
|
|
184
92
|
};
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
@@ -307,11 +307,12 @@ module.exports.evaluate = function(package_json, options, napi_build_version) {
|
|
|
307
307
|
toolset: options.toolset || '', // address https://github.com/mapbox/node-pre-gyp/issues/119
|
|
308
308
|
bucket: package_json.binary.bucket,
|
|
309
309
|
region: package_json.binary.region,
|
|
310
|
-
s3ForcePathStyle: package_json.binary.s3ForcePathStyle || false
|
|
310
|
+
s3ForcePathStyle: package_json.binary.s3ForcePathStyle || false,
|
|
311
|
+
acl: options.acl || package_json.binary.acl || 'public-read'
|
|
311
312
|
};
|
|
312
313
|
// support host mirror with npm config `--{module_name}_binary_host_mirror`
|
|
313
314
|
// e.g.: https://github.com/node-inspector/v8-profiler/blob/master/package.json#L25
|
|
314
|
-
// > npm install v8-profiler --profiler_binary_host_mirror=https://
|
|
315
|
+
// > npm install v8-profiler --profiler_binary_host_mirror=https://registry.npmmirror.com/node-inspector/
|
|
315
316
|
const validModuleName = opts.module_name.replace('-', '_');
|
|
316
317
|
const host = process.env['npm_config_' + validModuleName + '_binary_host_mirror'] || package_json.binary.host;
|
|
317
318
|
opts.host = fix_slashes(eval_template(host, opts));
|