pnpm 6.20.3 → 6.22.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
@@ -34,6 +34,9 @@ To quote the [Rush](https://rushjs.io/) team:
34
34
  <td align="center" valign="middle">
35
35
  <a href="https://prisma.io" target="_blank"><img src="https://raw.githubusercontent.com/pnpm/pnpm.github.io/main/static/img/users/prisma.svg" width="180"></a>
36
36
  </td>
37
+ <td align="center" valign="middle">
38
+ <a href="https://leniolabs.com" target="_blank"><img src="https://raw.githubusercontent.com/pnpm/pnpm.github.io/main/static/img/users/leniolabs.jpg" width="80"></a>
39
+ </td>
37
40
  </tr>
38
41
  </tbody>
39
42
  </table>
@@ -112,7 +115,7 @@ Benchmarks on an app with lots of dependencies:
112
115
  - [Chat](https://r.pnpm.io/chat)
113
116
  - [Twitter](https://twitter.com/pnpmjs)
114
117
 
115
- ### Backers
118
+ ## Backers
116
119
 
117
120
  Thank you to all our backers! [Become a backer](https://opencollective.com/pnpm#backer)
118
121
 
package/bin/pnpm.cjs CHANGED
@@ -15,3 +15,6 @@ ${COMPATIBILITY_PAGE}`)
15
15
  }
16
16
 
17
17
  require('../dist/pnpm.cjs')
18
+
19
+ // if you want to debug at your local env, you can use this
20
+ // require('../lib/pnpm')
@@ -0,0 +1,25 @@
1
+ name: Tests on Windows
2
+ on: [push, pull_request]
3
+ jobs:
4
+ Tests:
5
+ strategy:
6
+ fail-fast: false
7
+ max-parallel: 15
8
+ matrix:
9
+ os: [windows-2022]
10
+ runs-on: ${{ matrix.os }}
11
+ steps:
12
+ - name: Checkout Repository
13
+ uses: actions/checkout@v2
14
+ - name: Install Dependencies
15
+ run: |
16
+ npm install --no-progress
17
+ - name: Set Windows environment
18
+ if: matrix.os == 'windows-latest'
19
+ run: |
20
+ echo 'GYP_MSVS_VERSION=2015' >> $Env:GITHUB_ENV
21
+ echo 'GYP_MSVS_OVERRIDE_PATH=C:\\Dummy' >> $Env:GITHUB_ENV
22
+ - name: Environment Information
23
+ run: npx envinfo
24
+ - name: Run Node tests
25
+ run: npm test
@@ -97,17 +97,15 @@ function configure (gyp, argv, callback) {
97
97
  process.env.GYP_MSVS_VERSION = Math.min(vsInfo.versionYear, 2015)
98
98
  process.env.GYP_MSVS_OVERRIDE_PATH = vsInfo.path
99
99
  }
100
- createConfigGypi({ gyp, buildDir, nodeDir, vsInfo }, (err, configPath) => {
100
+ createConfigGypi({ gyp, buildDir, nodeDir, vsInfo }).then(configPath => {
101
101
  configs.push(configPath)
102
- findConfigs(err)
102
+ findConfigs()
103
+ }).catch(err => {
104
+ callback(err)
103
105
  })
104
106
  }
105
107
 
106
- function findConfigs (err) {
107
- if (err) {
108
- return callback(err)
109
- }
110
-
108
+ function findConfigs () {
111
109
  var name = configNames.shift()
112
110
  if (!name) {
113
111
  return runGyp()
@@ -4,19 +4,45 @@ const fs = require('graceful-fs')
4
4
  const log = require('npmlog')
5
5
  const path = require('path')
6
6
 
7
- function getBaseConfigGypi () {
8
- const config = JSON.parse(JSON.stringify(process.config))
7
+ function parseConfigGypi (config) {
8
+ // translated from tools/js2c.py of Node.js
9
+ // 1. string comments
10
+ config = config.replace(/#.*/g, '')
11
+ // 2. join multiline strings
12
+ config = config.replace(/'$\s+'/mg, '')
13
+ // 3. normalize string literals from ' into "
14
+ config = config.replace(/'/g, '"')
15
+ return JSON.parse(config)
16
+ }
17
+
18
+ async function getBaseConfigGypi ({ gyp, nodeDir }) {
19
+ // try reading $nodeDir/include/node/config.gypi first when:
20
+ // 1. --dist-url or --nodedir is specified
21
+ // 2. and --force-process-config is not specified
22
+ const shouldReadConfigGypi = (gyp.opts.nodedir || gyp.opts['dist-url']) && !gyp.opts['force-process-config']
23
+ if (shouldReadConfigGypi && nodeDir) {
24
+ try {
25
+ const baseConfigGypiPath = path.resolve(nodeDir, 'include/node/config.gypi')
26
+ const baseConfigGypi = await fs.promises.readFile(baseConfigGypiPath)
27
+ return parseConfigGypi(baseConfigGypi.toString())
28
+ } catch (err) {
29
+ log.warn('read config.gypi', err.message)
30
+ }
31
+ }
32
+
33
+ // fallback to process.config if it is invalid
34
+ return JSON.parse(JSON.stringify(process.config))
35
+ }
36
+
37
+ async function getCurrentConfigGypi ({ gyp, nodeDir, vsInfo }) {
38
+ const config = await getBaseConfigGypi({ gyp, nodeDir })
9
39
  if (!config.target_defaults) {
10
40
  config.target_defaults = {}
11
41
  }
12
42
  if (!config.variables) {
13
43
  config.variables = {}
14
44
  }
15
- return config
16
- }
17
45
 
18
- function getCurrentConfigGypi ({ gyp, nodeDir, vsInfo }) {
19
- const config = getBaseConfigGypi()
20
46
  const defaults = config.target_defaults
21
47
  const variables = config.variables
22
48
 
@@ -85,13 +111,13 @@ function getCurrentConfigGypi ({ gyp, nodeDir, vsInfo }) {
85
111
  return config
86
112
  }
87
113
 
88
- function createConfigGypi ({ gyp, buildDir, nodeDir, vsInfo }, callback) {
114
+ async function createConfigGypi ({ gyp, buildDir, nodeDir, vsInfo }) {
89
115
  const configFilename = 'config.gypi'
90
116
  const configPath = path.resolve(buildDir, configFilename)
91
117
 
92
118
  log.verbose('build/' + configFilename, 'creating config file')
93
119
 
94
- const config = getCurrentConfigGypi({ gyp, nodeDir, vsInfo })
120
+ const config = await getCurrentConfigGypi({ gyp, nodeDir, vsInfo })
95
121
 
96
122
  // ensures that any boolean values in config.gypi get stringified
97
123
  function boolsToString (k, v) {
@@ -108,12 +134,13 @@ function createConfigGypi ({ gyp, buildDir, nodeDir, vsInfo }, callback) {
108
134
 
109
135
  const json = JSON.stringify(config, boolsToString, 2)
110
136
  log.verbose('build/' + configFilename, 'writing out config file: %s', configPath)
111
- fs.writeFile(configPath, [prefix, json, ''].join('\n'), (err) => {
112
- callback(err, configPath)
113
- })
137
+ await fs.promises.writeFile(configPath, [prefix, json, ''].join('\n'))
138
+
139
+ return configPath
114
140
  }
115
141
 
116
142
  module.exports = createConfigGypi
117
143
  module.exports.test = {
144
+ parseConfigGypi: parseConfigGypi,
118
145
  getCurrentConfigGypi: getCurrentConfigGypi
119
146
  }
@@ -2,6 +2,7 @@
2
2
 
3
3
  const log = require('npmlog')
4
4
  const execFile = require('child_process').execFile
5
+ const fs = require('fs')
5
6
  const path = require('path').win32
6
7
  const logWithPrefix = require('./util').logWithPrefix
7
8
  const regSearchKeys = require('./util').regSearchKeys
@@ -257,6 +258,10 @@ VisualStudioFinder.prototype = {
257
258
  ret.versionYear = 2019
258
259
  return ret
259
260
  }
261
+ if (ret.versionMajor === 17) {
262
+ ret.versionYear = 2022
263
+ return ret
264
+ }
260
265
  this.log.silly('- unsupported version:', ret.versionMajor)
261
266
  return {}
262
267
  },
@@ -264,15 +269,20 @@ VisualStudioFinder.prototype = {
264
269
  // Helper - process MSBuild information
265
270
  getMSBuild: function getMSBuild (info, versionYear) {
266
271
  const pkg = 'Microsoft.VisualStudio.VC.MSBuild.Base'
272
+ const msbuildPath = path.join(info.path, 'MSBuild', 'Current', 'Bin', 'MSBuild.exe')
267
273
  if (info.packages.indexOf(pkg) !== -1) {
268
274
  this.log.silly('- found VC.MSBuild.Base')
269
275
  if (versionYear === 2017) {
270
276
  return path.join(info.path, 'MSBuild', '15.0', 'Bin', 'MSBuild.exe')
271
277
  }
272
278
  if (versionYear === 2019) {
273
- return path.join(info.path, 'MSBuild', 'Current', 'Bin', 'MSBuild.exe')
279
+ return msbuildPath
274
280
  }
275
281
  }
282
+ // visual studio 2022 don't has msbuild pkg
283
+ if (fs.existsSync(msbuildPath)) {
284
+ return msbuildPath
285
+ }
276
286
  return null
277
287
  },
278
288
 
@@ -293,6 +303,8 @@ VisualStudioFinder.prototype = {
293
303
  return 'v141'
294
304
  } else if (versionYear === 2019) {
295
305
  return 'v142'
306
+ } else if (versionYear === 2022) {
307
+ return 'v143'
296
308
  }
297
309
  this.log.silly('- invalid versionYear:', versionYear)
298
310
  return null
@@ -75,7 +75,8 @@ proto.configDefs = {
75
75
  'dist-url': String, // 'install'
76
76
  tarball: String, // 'install'
77
77
  jobs: String, // 'build'
78
- thin: String // 'configure'
78
+ thin: String, // 'configure'
79
+ 'force-process-config': Boolean // 'configure'
79
80
  }
80
81
 
81
82
  /**
@@ -11,7 +11,7 @@
11
11
  "bindings",
12
12
  "gyp"
13
13
  ],
14
- "version": "8.3.0",
14
+ "version": "8.4.0",
15
15
  "installVersion": 9,
16
16
  "author": "Nathan Rajlich <nathan@tootallnate.net> (http://tootallnate.net)",
17
17
  "repository": {