projen 0.50.4 → 0.50.8
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/.jsii +2 -29
- package/API.md +0 -16
- package/changelog.md +1 -6
- package/lib/awscdk/auto-discover.js +1 -1
- package/lib/awscdk/awscdk-app-java.js +1 -1
- package/lib/awscdk/awscdk-app-ts.js +1 -1
- package/lib/awscdk/awscdk-construct.js +2 -2
- package/lib/awscdk/awscdk-deps-java.js +1 -1
- package/lib/awscdk/awscdk-deps-js.js +1 -1
- package/lib/awscdk/awscdk-deps.js +1 -1
- package/lib/awscdk/cdk-config.js +1 -1
- package/lib/awscdk/cdk-tasks.js +1 -1
- package/lib/awscdk/integration-test.js +1 -1
- package/lib/awscdk/lambda-function.js +2 -2
- package/lib/build/build-workflow.js +1 -1
- package/lib/cdk/construct-lib.js +1 -1
- package/lib/cdk/jsii-docgen.js +1 -1
- package/lib/cdk/jsii-project.js +1 -1
- package/lib/cdk8s/cdk8s-app-ts.js +1 -1
- package/lib/cdk8s/cdk8s-construct.js +1 -1
- package/lib/cdktf/cdktf-construct.js +1 -1
- package/lib/cli/cmds/new.js +21 -4
- package/lib/component.js +1 -1
- package/lib/dependencies.js +1 -1
- package/lib/dev-env.js +1 -1
- package/lib/docker-compose.js +2 -2
- package/lib/file.js +1 -1
- package/lib/gitattributes.js +1 -1
- package/lib/github/auto-approve.js +1 -1
- package/lib/github/auto-merge.js +1 -1
- package/lib/github/dependabot.js +1 -1
- package/lib/github/github-project.js +1 -1
- package/lib/github/github.js +1 -1
- package/lib/github/mergify.js +1 -1
- package/lib/github/pr-template.js +1 -1
- package/lib/github/pull-request-lint.js +1 -1
- package/lib/github/stale.js +1 -1
- package/lib/github/task-workflow.js +1 -1
- package/lib/github/workflows.js +1 -1
- package/lib/gitlab/configuration.js +1 -1
- package/lib/gitlab/gitlab-configuration.js +1 -1
- package/lib/gitlab/nested-configuration.d.ts +0 -7
- package/lib/gitlab/nested-configuration.js +2 -16
- package/lib/gitpod.js +1 -1
- package/lib/ignore-file.js +1 -1
- package/lib/ini.js +1 -1
- package/lib/java/java-project.js +1 -1
- package/lib/java/junit.js +1 -1
- package/lib/java/maven-compile.js +1 -1
- package/lib/java/maven-packaging.js +1 -1
- package/lib/java/maven-sample.js +1 -1
- package/lib/java/pom.js +1 -1
- package/lib/java/projenrc.js +1 -1
- package/lib/javascript/bundler.js +1 -1
- package/lib/javascript/eslint.js +1 -1
- package/lib/javascript/jest.js +1 -1
- package/lib/javascript/node-package.js +1 -1
- package/lib/javascript/node-project.js +1 -1
- package/lib/javascript/npm-config.js +1 -1
- package/lib/javascript/prettier.js +1 -1
- package/lib/javascript/projenrc.js +1 -1
- package/lib/javascript/typescript-config.js +1 -1
- package/lib/javascript/upgrade-dependencies.js +2 -2
- package/lib/json.js +1 -1
- package/lib/license.js +1 -1
- package/lib/logger.js +1 -1
- package/lib/makefile.js +1 -1
- package/lib/object-file.js +1 -1
- package/lib/project-build.js +1 -1
- package/lib/project.js +1 -1
- package/lib/projects.js +1 -1
- package/lib/projenrc-json.js +1 -1
- package/lib/python/pip.js +1 -1
- package/lib/python/poetry.js +2 -2
- package/lib/python/projenrc.js +1 -1
- package/lib/python/pytest.js +1 -1
- package/lib/python/python-project.js +1 -1
- package/lib/python/python-sample.js +1 -1
- package/lib/python/requirements-file.js +1 -1
- package/lib/python/setuppy.js +1 -1
- package/lib/python/setuptools.js +1 -1
- package/lib/python/venv.js +1 -1
- package/lib/readme.js +1 -1
- package/lib/release/publisher.js +1 -1
- package/lib/release/release-trigger.js +1 -1
- package/lib/release/release.js +1 -1
- package/lib/sample-file.js +2 -2
- package/lib/semver.js +1 -1
- package/lib/source-code.js +1 -1
- package/lib/task-runtime.js +1 -1
- package/lib/task.js +1 -1
- package/lib/tasks.js +1 -1
- package/lib/testing.js +1 -1
- package/lib/textfile.js +1 -1
- package/lib/toml.js +1 -1
- package/lib/typescript/projenrc.js +1 -1
- package/lib/typescript/typescript-typedoc.js +1 -1
- package/lib/typescript/typescript.js +3 -3
- package/lib/version.js +1 -1
- package/lib/vscode/devcontainer.js +1 -1
- package/lib/vscode/launch-config.js +1 -1
- package/lib/vscode/vscode.js +1 -1
- package/lib/web/next.js +3 -3
- package/lib/web/postcss.js +1 -1
- package/lib/web/react.js +4 -4
- package/lib/web/tailwind.js +1 -1
- package/lib/xmlfile.js +1 -1
- package/lib/yaml.js +1 -1
- package/node_modules/resolve/.eslintrc +33 -8
- package/node_modules/resolve/.github/FUNDING.yml +12 -0
- package/node_modules/resolve/appveyor.yml +4 -2
- package/node_modules/resolve/async.js +3 -0
- package/node_modules/resolve/bin/resolve +47 -0
- package/node_modules/resolve/lib/core.js +1 -2
- package/node_modules/resolve/lib/core.json +81 -12
- package/node_modules/resolve/lib/node-modules-paths.js +1 -1
- package/node_modules/resolve/lib/sync.js +4 -4
- package/node_modules/resolve/package.json +18 -12
- package/node_modules/resolve/readme.markdown +35 -13
- package/node_modules/resolve/sync.js +3 -0
- package/node_modules/resolve/test/mock_sync.js +2 -4
- package/node_modules/resolve/test/node_path.js +1 -1
- package/node_modules/resolve/test/resolver/invalid_main/package.json +1 -1
- package/node_modules/resolve/test/resolver/malformed_package_json/index.js +0 -0
- package/node_modules/resolve/test/resolver/malformed_package_json/package.json +1 -0
- package/node_modules/resolve/test/resolver.js +99 -3
- package/node_modules/resolve/test/resolver_sync.js +88 -3
- package/node_modules/supports-preserve-symlinks-flag/.eslintrc +14 -0
- package/node_modules/supports-preserve-symlinks-flag/.github/FUNDING.yml +12 -0
- package/node_modules/supports-preserve-symlinks-flag/.nycrc +9 -0
- package/node_modules/supports-preserve-symlinks-flag/CHANGELOG.md +22 -0
- package/node_modules/supports-preserve-symlinks-flag/LICENSE +21 -0
- package/node_modules/supports-preserve-symlinks-flag/README.md +42 -0
- package/node_modules/supports-preserve-symlinks-flag/browser.js +3 -0
- package/node_modules/supports-preserve-symlinks-flag/index.js +9 -0
- package/node_modules/supports-preserve-symlinks-flag/package.json +70 -0
- package/node_modules/supports-preserve-symlinks-flag/test/index.js +29 -0
- package/node_modules/xmlbuilder2/node_modules/@types/node/README.md +1 -1
- package/node_modules/xmlbuilder2/node_modules/@types/node/net.d.ts +1 -0
- package/node_modules/xmlbuilder2/node_modules/@types/node/package.json +2 -2
- package/node_modules/xmlbuilder2/node_modules/@types/node/process.d.ts +1 -1
- package/package.json +3 -3
- package/releasetag.txt +1 -1
- package/version.txt +1 -1
- package/node_modules/resolve/.eslintignore +0 -1
- package/node_modules/resolve/test/.eslintrc +0 -5
|
@@ -9,22 +9,22 @@ var realpathFS = fs.realpathSync && typeof fs.realpathSync.native === 'function'
|
|
|
9
9
|
|
|
10
10
|
var defaultIsFile = function isFile(file) {
|
|
11
11
|
try {
|
|
12
|
-
var stat = fs.statSync(file);
|
|
12
|
+
var stat = fs.statSync(file, { throwIfNoEntry: false });
|
|
13
13
|
} catch (e) {
|
|
14
14
|
if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false;
|
|
15
15
|
throw e;
|
|
16
16
|
}
|
|
17
|
-
return stat.isFile() || stat.isFIFO();
|
|
17
|
+
return !!stat && (stat.isFile() || stat.isFIFO());
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
var defaultIsDir = function isDirectory(dir) {
|
|
21
21
|
try {
|
|
22
|
-
var stat = fs.statSync(dir);
|
|
22
|
+
var stat = fs.statSync(dir, { throwIfNoEntry: false });
|
|
23
23
|
} catch (e) {
|
|
24
24
|
if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false;
|
|
25
25
|
throw e;
|
|
26
26
|
}
|
|
27
|
-
return stat.isDirectory();
|
|
27
|
+
return !!stat && stat.isDirectory();
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
var defaultRealpathSync = function realpathSync(x) {
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "resolve",
|
|
3
3
|
"description": "resolve like require.resolve() on behalf of files asynchronously and synchronously",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.21.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git://github.com/browserify/resolve.git"
|
|
8
8
|
},
|
|
9
|
+
"bin": {
|
|
10
|
+
"resolve": "./bin/resolve"
|
|
11
|
+
},
|
|
9
12
|
"main": "index.js",
|
|
10
13
|
"keywords": [
|
|
11
14
|
"resolve",
|
|
@@ -14,9 +17,10 @@
|
|
|
14
17
|
"module"
|
|
15
18
|
],
|
|
16
19
|
"scripts": {
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
+
"prepublishOnly": "safe-publish-latest && cp node_modules/is-core-module/core.json ./lib/ ||:",
|
|
21
|
+
"prepublish": "not-in-publish || npm run prepublishOnly",
|
|
22
|
+
"prelint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')",
|
|
23
|
+
"lint": "eslint --ext=js,mjs --no-eslintrc -c .eslintrc . 'bin/**'",
|
|
20
24
|
"pretests-only": "cd ./test/resolver/nested_symlinks && node mylib/sync && node mylib/async",
|
|
21
25
|
"tests-only": "tape test/*.js",
|
|
22
26
|
"pretest": "npm run lint",
|
|
@@ -25,15 +29,16 @@
|
|
|
25
29
|
"test:multirepo": "cd ./test/resolver/multirepo && npm install && npm test"
|
|
26
30
|
},
|
|
27
31
|
"devDependencies": {
|
|
28
|
-
"@ljharb/eslint-config": "^
|
|
29
|
-
"array.prototype.map": "^1.0.
|
|
30
|
-
"aud": "^1.1.
|
|
32
|
+
"@ljharb/eslint-config": "^20.1.0",
|
|
33
|
+
"array.prototype.map": "^1.0.4",
|
|
34
|
+
"aud": "^1.1.5",
|
|
31
35
|
"eclint": "^2.8.1",
|
|
32
|
-
"eslint": "^
|
|
36
|
+
"eslint": "^8.6.0",
|
|
37
|
+
"in-publish": "^2.0.1",
|
|
33
38
|
"object-keys": "^1.1.1",
|
|
34
|
-
"safe-publish-latest": "^
|
|
39
|
+
"safe-publish-latest": "^2.0.0",
|
|
35
40
|
"tap": "0.4.13",
|
|
36
|
-
"tape": "^5.
|
|
41
|
+
"tape": "^5.4.0"
|
|
37
42
|
},
|
|
38
43
|
"license": "MIT",
|
|
39
44
|
"author": {
|
|
@@ -45,7 +50,8 @@
|
|
|
45
50
|
"url": "https://github.com/sponsors/ljharb"
|
|
46
51
|
},
|
|
47
52
|
"dependencies": {
|
|
48
|
-
"is-core-module": "^2.
|
|
49
|
-
"path-parse": "^1.0.
|
|
53
|
+
"is-core-module": "^2.8.0",
|
|
54
|
+
"path-parse": "^1.0.7",
|
|
55
|
+
"supports-preserve-symlinks-flag": "^1.0.0"
|
|
50
56
|
}
|
|
51
57
|
}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
# resolve
|
|
1
|
+
# resolve <sup>[![Version Badge][2]][1]</sup>
|
|
2
2
|
|
|
3
|
-
implements the [node `require.resolve()`
|
|
4
|
-
algorithm](https://nodejs.org/api/modules.html#modules_all_together)
|
|
5
|
-
such that you can `require.resolve()` on behalf of a file asynchronously and
|
|
6
|
-
synchronously
|
|
3
|
+
implements the [node `require.resolve()` algorithm](https://nodejs.org/api/modules.html#modules_all_together) such that you can `require.resolve()` on behalf of a file asynchronously and synchronously
|
|
7
4
|
|
|
8
|
-
[![
|
|
5
|
+
[![github actions][actions-image]][actions-url]
|
|
6
|
+
[![coverage][codecov-image]][codecov-url]
|
|
7
|
+
[![dependency status][5]][6]
|
|
8
|
+
[![dev dependency status][7]][8]
|
|
9
|
+
[![License][license-image]][license-url]
|
|
10
|
+
[![Downloads][downloads-image]][downloads-url]
|
|
11
|
+
|
|
12
|
+
[![npm badge][11]][1]
|
|
9
13
|
|
|
10
14
|
# example
|
|
11
15
|
|
|
12
16
|
asynchronously resolve:
|
|
13
17
|
|
|
14
18
|
```js
|
|
15
|
-
var resolve = require('resolve');
|
|
19
|
+
var resolve = require('resolve/async'); // or, require('resolve')
|
|
16
20
|
resolve('tap', { basedir: __dirname }, function (err, res) {
|
|
17
21
|
if (err) console.error(err);
|
|
18
22
|
else console.log(res);
|
|
@@ -27,8 +31,8 @@ $ node example/async.js
|
|
|
27
31
|
synchronously resolve:
|
|
28
32
|
|
|
29
33
|
```js
|
|
30
|
-
var resolve = require('resolve');
|
|
31
|
-
var res = resolve
|
|
34
|
+
var resolve = require('resolve/sync'); // or, `require('resolve').sync
|
|
35
|
+
var res = resolve('tap', { basedir: __dirname });
|
|
32
36
|
console.log(res);
|
|
33
37
|
```
|
|
34
38
|
|
|
@@ -41,6 +45,8 @@ $ node example/sync.js
|
|
|
41
45
|
|
|
42
46
|
```js
|
|
43
47
|
var resolve = require('resolve');
|
|
48
|
+
var async = require('resolve/async');
|
|
49
|
+
var sync = require('resolve/sync');
|
|
44
50
|
```
|
|
45
51
|
|
|
46
52
|
For both the synchronous and asynchronous methods, errors may have any of the following `err.code` values:
|
|
@@ -67,7 +73,7 @@ options are:
|
|
|
67
73
|
|
|
68
74
|
* opts.isFile - function to asynchronously test whether a file exists
|
|
69
75
|
|
|
70
|
-
* opts.isDirectory - function to asynchronously test whether a
|
|
76
|
+
* opts.isDirectory - function to asynchronously test whether a file exists and is a directory
|
|
71
77
|
|
|
72
78
|
* opts.realpath - function to asynchronously resolve a potential symlink to its real path
|
|
73
79
|
|
|
@@ -79,7 +85,7 @@ options are:
|
|
|
79
85
|
* `opts.packageFilter(pkg, pkgfile, dir)` - transform the parsed package.json contents before looking at the "main" field
|
|
80
86
|
* pkg - package data
|
|
81
87
|
* pkgfile - path to package.json
|
|
82
|
-
* dir - directory
|
|
88
|
+
* dir - directory that contains package.json
|
|
83
89
|
|
|
84
90
|
* `opts.pathFilter(pkg, path, relativePath)` - transform a path within a package
|
|
85
91
|
* pkg - package data
|
|
@@ -177,7 +183,7 @@ options are:
|
|
|
177
183
|
|
|
178
184
|
* opts.isFile - function to synchronously test whether a file exists
|
|
179
185
|
|
|
180
|
-
* opts.isDirectory - function to synchronously test whether a
|
|
186
|
+
* opts.isDirectory - function to synchronously test whether a file exists and is a directory
|
|
181
187
|
|
|
182
188
|
* opts.realpathSync - function to synchronously resolve a potential symlink to its real path
|
|
183
189
|
|
|
@@ -187,7 +193,7 @@ options are:
|
|
|
187
193
|
|
|
188
194
|
* `opts.packageFilter(pkg, dir)` - transform the parsed package.json contents before looking at the "main" field
|
|
189
195
|
* pkg - package data
|
|
190
|
-
* dir - directory
|
|
196
|
+
* dir - directory that contains package.json (Note: the second argument will change to "pkgfile" in v2)
|
|
191
197
|
|
|
192
198
|
* `opts.pathFilter(pkg, path, relativePath)` - transform a path within a package
|
|
193
199
|
* pkg - package data
|
|
@@ -277,3 +283,19 @@ npm install resolve
|
|
|
277
283
|
# license
|
|
278
284
|
|
|
279
285
|
MIT
|
|
286
|
+
|
|
287
|
+
[1]: https://npmjs.org/package/resolve
|
|
288
|
+
[2]: https://versionbadg.es/browserify/resolve.svg
|
|
289
|
+
[5]: https://david-dm.org/browserify/resolve.svg
|
|
290
|
+
[6]: https://david-dm.org/browserify/resolve
|
|
291
|
+
[7]: https://david-dm.org/browserify/resolve/dev-status.svg
|
|
292
|
+
[8]: https://david-dm.org/browserify/resolve#info=devDependencies
|
|
293
|
+
[11]: https://nodei.co/npm/resolve.png?downloads=true&stars=true
|
|
294
|
+
[license-image]: https://img.shields.io/npm/l/resolve.svg
|
|
295
|
+
[license-url]: LICENSE
|
|
296
|
+
[downloads-image]: https://img.shields.io/npm/dm/resolve.svg
|
|
297
|
+
[downloads-url]: https://npm-stat.com/charts.html?package=resolve
|
|
298
|
+
[codecov-image]: https://codecov.io/gh/browserify/resolve/branch/main/graphs/badge.svg
|
|
299
|
+
[codecov-url]: https://app.codecov.io/gh/browserify/resolve/
|
|
300
|
+
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/browserify/resolve
|
|
301
|
+
[actions-url]: https://github.com/browserify/resolve/actions
|
|
@@ -122,9 +122,8 @@ test('symlinked', function (t) {
|
|
|
122
122
|
var dir = path.dirname(resolved);
|
|
123
123
|
var base = path.basename(resolved);
|
|
124
124
|
return path.join(dir, 'symlinked', base);
|
|
125
|
-
} else {
|
|
126
|
-
return path.join(resolved, 'symlinked');
|
|
127
125
|
}
|
|
126
|
+
return path.join(resolved, 'symlinked');
|
|
128
127
|
}
|
|
129
128
|
};
|
|
130
129
|
}
|
|
@@ -183,9 +182,8 @@ test('readPackageSync', function (t) {
|
|
|
183
182
|
var readPackageSync = function (readFileSync, file) {
|
|
184
183
|
if (file.indexOf(path.join('bar', 'package.json')) >= 0) {
|
|
185
184
|
return { main: './something-else.js' };
|
|
186
|
-
} else {
|
|
187
|
-
return JSON.parse(files[path.resolve(file)]);
|
|
188
185
|
}
|
|
186
|
+
return JSON.parse(files[path.resolve(file)]);
|
|
189
187
|
};
|
|
190
188
|
|
|
191
189
|
t.test('with readPackage', function (st) {
|
|
@@ -63,7 +63,7 @@ test('$NODE_PATH', function (t) {
|
|
|
63
63
|
basedir: path.join(__dirname, 'node_path/x'),
|
|
64
64
|
isDirectory: isDir
|
|
65
65
|
}, function (err, res) {
|
|
66
|
-
var root = require('tap/package.json').main;
|
|
66
|
+
var root = require('tap/package.json').main; // eslint-disable-line global-require
|
|
67
67
|
t.error(err);
|
|
68
68
|
t.equal(res, path.resolve(__dirname, '..', 'node_modules/tap', root), 'tap resolves');
|
|
69
69
|
});
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
var path = require('path');
|
|
2
2
|
var test = require('tape');
|
|
3
3
|
var resolve = require('../');
|
|
4
|
+
var async = require('../async');
|
|
5
|
+
|
|
6
|
+
test('`./async` entry point', function (t) {
|
|
7
|
+
t.equal(resolve, async, '`./async` entry point is the same as `main`');
|
|
8
|
+
t.end();
|
|
9
|
+
});
|
|
4
10
|
|
|
5
11
|
test('async foo', function (t) {
|
|
6
12
|
t.plan(12);
|
|
@@ -288,7 +294,7 @@ test('without basedir', function (t) {
|
|
|
288
294
|
t.plan(1);
|
|
289
295
|
|
|
290
296
|
var dir = path.join(__dirname, 'resolver/without_basedir');
|
|
291
|
-
var tester = require(path.join(dir, 'main.js'));
|
|
297
|
+
var tester = require(path.join(dir, 'main.js')); // eslint-disable-line global-require
|
|
292
298
|
|
|
293
299
|
tester(t, function (err, res, pkg) {
|
|
294
300
|
if (err) {
|
|
@@ -404,7 +410,7 @@ test('non-string "main" field in package.json', function (t) {
|
|
|
404
410
|
var dir = path.join(__dirname, 'resolver');
|
|
405
411
|
resolve('./invalid_main', { basedir: dir }, function (err, res, pkg) {
|
|
406
412
|
t.ok(err, 'errors on non-string main');
|
|
407
|
-
t.equal(err.message, 'package “
|
|
413
|
+
t.equal(err.message, 'package “invalid_main” `main` must be a string');
|
|
408
414
|
t.equal(err.code, 'INVALID_PACKAGE_MAIN');
|
|
409
415
|
t.equal(res, undefined, 'res is undefined');
|
|
410
416
|
t.equal(pkg, undefined, 'pkg is undefined');
|
|
@@ -417,7 +423,7 @@ test('non-string "main" field in package.json', function (t) {
|
|
|
417
423
|
var dir = path.join(__dirname, 'resolver');
|
|
418
424
|
resolve('./invalid_main', { basedir: dir }, function (err, res, pkg) {
|
|
419
425
|
t.ok(err, 'errors on non-string main');
|
|
420
|
-
t.equal(err.message, 'package “
|
|
426
|
+
t.equal(err.message, 'package “invalid_main” `main` must be a string');
|
|
421
427
|
t.equal(err.code, 'INVALID_PACKAGE_MAIN');
|
|
422
428
|
t.equal(res, undefined, 'res is undefined');
|
|
423
429
|
t.equal(pkg, undefined, 'pkg is undefined');
|
|
@@ -448,3 +454,93 @@ test('browser field in package.json', function (t) {
|
|
|
448
454
|
}
|
|
449
455
|
);
|
|
450
456
|
});
|
|
457
|
+
|
|
458
|
+
test('absolute paths', function (t) {
|
|
459
|
+
t.plan(4);
|
|
460
|
+
|
|
461
|
+
var extensionless = __filename.slice(0, -path.extname(__filename).length);
|
|
462
|
+
|
|
463
|
+
resolve(__filename, function (err, res) {
|
|
464
|
+
t.equal(
|
|
465
|
+
res,
|
|
466
|
+
__filename,
|
|
467
|
+
'absolute path to this file resolves'
|
|
468
|
+
);
|
|
469
|
+
});
|
|
470
|
+
resolve(extensionless, function (err, res) {
|
|
471
|
+
t.equal(
|
|
472
|
+
res,
|
|
473
|
+
__filename,
|
|
474
|
+
'extensionless absolute path to this file resolves'
|
|
475
|
+
);
|
|
476
|
+
});
|
|
477
|
+
resolve(__filename, { basedir: process.cwd() }, function (err, res) {
|
|
478
|
+
t.equal(
|
|
479
|
+
res,
|
|
480
|
+
__filename,
|
|
481
|
+
'absolute path to this file with a basedir resolves'
|
|
482
|
+
);
|
|
483
|
+
});
|
|
484
|
+
resolve(extensionless, { basedir: process.cwd() }, function (err, res) {
|
|
485
|
+
t.equal(
|
|
486
|
+
res,
|
|
487
|
+
__filename,
|
|
488
|
+
'extensionless absolute path to this file with a basedir resolves'
|
|
489
|
+
);
|
|
490
|
+
});
|
|
491
|
+
});
|
|
492
|
+
|
|
493
|
+
test('malformed package.json', function (t) {
|
|
494
|
+
/* eslint operator-linebreak: ["error", "before"], function-paren-newline: "off" */
|
|
495
|
+
t.plan(
|
|
496
|
+
(3 * 3) // 3 sets of 3 assertions in the final callback
|
|
497
|
+
+ 2 // 1 readPackage call with malformed package.json
|
|
498
|
+
);
|
|
499
|
+
|
|
500
|
+
var basedir = path.join(__dirname, 'resolver/malformed_package_json');
|
|
501
|
+
var expected = path.join(basedir, 'index.js');
|
|
502
|
+
|
|
503
|
+
resolve('./index.js', { basedir: basedir }, function (err, res, pkg) {
|
|
504
|
+
t.error(err, 'no error');
|
|
505
|
+
t.equal(res, expected, 'malformed package.json is silently ignored');
|
|
506
|
+
t.equal(pkg, undefined, 'malformed package.json gives an undefined `pkg` argument');
|
|
507
|
+
});
|
|
508
|
+
|
|
509
|
+
resolve(
|
|
510
|
+
'./index.js',
|
|
511
|
+
{
|
|
512
|
+
basedir: basedir,
|
|
513
|
+
packageFilter: function (pkg, pkgfile, dir) {
|
|
514
|
+
t.fail('should not reach here');
|
|
515
|
+
}
|
|
516
|
+
},
|
|
517
|
+
function (err, res, pkg) {
|
|
518
|
+
t.error(err, 'with packageFilter: no error');
|
|
519
|
+
t.equal(res, expected, 'with packageFilter: malformed package.json is silently ignored');
|
|
520
|
+
t.equal(pkg, undefined, 'with packageFilter: malformed package.json gives an undefined `pkg` argument');
|
|
521
|
+
}
|
|
522
|
+
);
|
|
523
|
+
|
|
524
|
+
resolve(
|
|
525
|
+
'./index.js',
|
|
526
|
+
{
|
|
527
|
+
basedir: basedir,
|
|
528
|
+
readPackage: function (readFile, pkgfile, cb) {
|
|
529
|
+
t.equal(pkgfile, path.join(basedir, 'package.json'), 'readPackageSync: `pkgfile` is package.json path');
|
|
530
|
+
readFile(pkgfile, function (err, result) {
|
|
531
|
+
try {
|
|
532
|
+
cb(null, JSON.parse(result));
|
|
533
|
+
} catch (e) {
|
|
534
|
+
t.ok(e instanceof SyntaxError, 'readPackage: malformed package.json parses as a syntax error');
|
|
535
|
+
cb(null);
|
|
536
|
+
}
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
},
|
|
540
|
+
function (err, res, pkg) {
|
|
541
|
+
t.error(err, 'with readPackage: no error');
|
|
542
|
+
t.equal(res, expected, 'with readPackage: malformed package.json is silently ignored');
|
|
543
|
+
t.equal(pkg, undefined, 'with readPackage: malformed package.json gives an undefined `pkg` argument');
|
|
544
|
+
}
|
|
545
|
+
);
|
|
546
|
+
});
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
var path = require('path');
|
|
2
|
+
var fs = require('fs');
|
|
2
3
|
var test = require('tape');
|
|
4
|
+
|
|
3
5
|
var resolve = require('../');
|
|
6
|
+
var sync = require('../sync');
|
|
7
|
+
|
|
8
|
+
test('`./sync` entry point', function (t) {
|
|
9
|
+
t.equal(resolve.sync, sync, '`./sync` entry point is the same as `.sync` on `main`');
|
|
10
|
+
t.end();
|
|
11
|
+
});
|
|
4
12
|
|
|
5
13
|
test('foo', function (t) {
|
|
6
14
|
var dir = path.join(__dirname, 'resolver');
|
|
@@ -200,7 +208,6 @@ test('incorrect main', function (t) {
|
|
|
200
208
|
});
|
|
201
209
|
|
|
202
210
|
var stubStatSync = function stubStatSync(fn) {
|
|
203
|
-
var fs = require('fs');
|
|
204
211
|
var statSync = fs.statSync;
|
|
205
212
|
try {
|
|
206
213
|
fs.statSync = function () {
|
|
@@ -321,7 +328,7 @@ test('non-string "main" field in package.json', function (t) {
|
|
|
321
328
|
t.fail('should not get here');
|
|
322
329
|
} catch (err) {
|
|
323
330
|
t.ok(err, 'errors on non-string main');
|
|
324
|
-
t.equal(err.message, 'package “
|
|
331
|
+
t.equal(err.message, 'package “invalid_main” `main` must be a string');
|
|
325
332
|
t.equal(err.code, 'INVALID_PACKAGE_MAIN');
|
|
326
333
|
}
|
|
327
334
|
t.end();
|
|
@@ -335,7 +342,7 @@ test('non-string "main" field in package.json', function (t) {
|
|
|
335
342
|
t.fail('should not get here');
|
|
336
343
|
} catch (err) {
|
|
337
344
|
t.ok(err, 'errors on non-string main');
|
|
338
|
-
t.equal(err.message, 'package “
|
|
345
|
+
t.equal(err.message, 'package “invalid_main” `main` must be a string');
|
|
339
346
|
t.equal(err.code, 'INVALID_PACKAGE_MAIN');
|
|
340
347
|
}
|
|
341
348
|
t.end();
|
|
@@ -356,3 +363,81 @@ test('browser field in package.json', function (t) {
|
|
|
356
363
|
t.equal(res, path.join(dir, 'browser_field', 'b.js'));
|
|
357
364
|
t.end();
|
|
358
365
|
});
|
|
366
|
+
|
|
367
|
+
test('absolute paths', function (t) {
|
|
368
|
+
var extensionless = __filename.slice(0, -path.extname(__filename).length);
|
|
369
|
+
|
|
370
|
+
t.equal(
|
|
371
|
+
resolve.sync(__filename),
|
|
372
|
+
__filename,
|
|
373
|
+
'absolute path to this file resolves'
|
|
374
|
+
);
|
|
375
|
+
t.equal(
|
|
376
|
+
resolve.sync(extensionless),
|
|
377
|
+
__filename,
|
|
378
|
+
'extensionless absolute path to this file resolves'
|
|
379
|
+
);
|
|
380
|
+
t.equal(
|
|
381
|
+
resolve.sync(__filename, { basedir: process.cwd() }),
|
|
382
|
+
__filename,
|
|
383
|
+
'absolute path to this file with a basedir resolves'
|
|
384
|
+
);
|
|
385
|
+
t.equal(
|
|
386
|
+
resolve.sync(extensionless, { basedir: process.cwd() }),
|
|
387
|
+
__filename,
|
|
388
|
+
'extensionless absolute path to this file with a basedir resolves'
|
|
389
|
+
);
|
|
390
|
+
|
|
391
|
+
t.end();
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
test('malformed package.json', function (t) {
|
|
395
|
+
t.plan(5);
|
|
396
|
+
|
|
397
|
+
var basedir = path.join(__dirname, 'resolver/malformed_package_json');
|
|
398
|
+
var expected = path.join(basedir, 'index.js');
|
|
399
|
+
|
|
400
|
+
t.equal(
|
|
401
|
+
resolve.sync('./index.js', { basedir: basedir }),
|
|
402
|
+
expected,
|
|
403
|
+
'malformed package.json is silently ignored'
|
|
404
|
+
);
|
|
405
|
+
|
|
406
|
+
var res1 = resolve.sync(
|
|
407
|
+
'./index.js',
|
|
408
|
+
{
|
|
409
|
+
basedir: basedir,
|
|
410
|
+
packageFilter: function (pkg, pkgfile, dir) {
|
|
411
|
+
t.fail('should not reach here');
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
);
|
|
415
|
+
|
|
416
|
+
t.equal(
|
|
417
|
+
res1,
|
|
418
|
+
expected,
|
|
419
|
+
'with packageFilter: malformed package.json is silently ignored'
|
|
420
|
+
);
|
|
421
|
+
|
|
422
|
+
var res2 = resolve.sync(
|
|
423
|
+
'./index.js',
|
|
424
|
+
{
|
|
425
|
+
basedir: basedir,
|
|
426
|
+
readPackageSync: function (readFileSync, pkgfile) {
|
|
427
|
+
t.equal(pkgfile, path.join(basedir, 'package.json'), 'readPackageSync: `pkgfile` is package.json path');
|
|
428
|
+
var result = String(readFileSync(pkgfile));
|
|
429
|
+
try {
|
|
430
|
+
return JSON.parse(result);
|
|
431
|
+
} catch (e) {
|
|
432
|
+
t.ok(e instanceof SyntaxError, 'readPackageSync: malformed package.json parses as a syntax error');
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
);
|
|
437
|
+
|
|
438
|
+
t.equal(
|
|
439
|
+
res2,
|
|
440
|
+
expected,
|
|
441
|
+
'with readPackageSync: malformed package.json is silently ignored'
|
|
442
|
+
);
|
|
443
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# These are supported funding model platforms
|
|
2
|
+
|
|
3
|
+
github: [ljharb]
|
|
4
|
+
patreon: # Replace with a single Patreon username
|
|
5
|
+
open_collective: # Replace with a single Open Collective username
|
|
6
|
+
ko_fi: # Replace with a single Ko-fi username
|
|
7
|
+
tidelift: npm/supports-preserve-symlink-flag
|
|
8
|
+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
|
9
|
+
liberapay: # Replace with a single Liberapay username
|
|
10
|
+
issuehunt: # Replace with a single IssueHunt username
|
|
11
|
+
otechie: # Replace with a single Otechie username
|
|
12
|
+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## v1.0.0 - 2022-01-02
|
|
9
|
+
|
|
10
|
+
### Commits
|
|
11
|
+
|
|
12
|
+
- Tests [`e2f59ad`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/e2f59ad74e2ae0f5f4899fcde6a6f693ab7cc074)
|
|
13
|
+
- Initial commit [`dc222aa`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/dc222aad3c0b940d8d3af1ca9937d108bd2dc4b9)
|
|
14
|
+
- [meta] do not publish workflow files [`5ef77f7`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/5ef77f7cb6946d16ee38672be9ec0f1bbdf63262)
|
|
15
|
+
- npm init [`992b068`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/992b068503a461f7e8676f40ca2aab255fd8d6ff)
|
|
16
|
+
- read me [`6c9afa9`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/6c9afa9fabc8eaf0814aaed6dd01e6df0931b76d)
|
|
17
|
+
- Initial implementation [`2f98925`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/2f9892546396d4ab0ad9f1ff83e76c3f01234ae8)
|
|
18
|
+
- [meta] add `auto-changelog` [`6c476ae`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/6c476ae1ed7ce68b0480344f090ac2844f35509d)
|
|
19
|
+
- [Dev Deps] add `eslint`, `@ljharb/eslint-config` [`d0fffc8`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/d0fffc886d25fba119355520750a909d64da0087)
|
|
20
|
+
- Only apps should have lockfiles [`ab318ed`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/ab318ed7ae62f6c2c0e80a50398d40912afd8f69)
|
|
21
|
+
- [meta] add `safe-publish-latest` [`2bb23b3`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/2bb23b3ebab02dc4135c4cdf0217db82835b9fca)
|
|
22
|
+
- [meta] add `sideEffects` flag [`600223b`](https://github.com/inspect-js/node-supports-preserve-symlinks-flag/commit/600223ba24f30779f209d9097721eff35ed62741)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Inspect JS
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# node-supports-preserve-symlinks-flag <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
|
2
|
+
|
|
3
|
+
[![github actions][actions-image]][actions-url]
|
|
4
|
+
[![coverage][codecov-image]][codecov-url]
|
|
5
|
+
[![dependency status][deps-svg]][deps-url]
|
|
6
|
+
[![dev dependency status][dev-deps-svg]][dev-deps-url]
|
|
7
|
+
[![License][license-image]][license-url]
|
|
8
|
+
[![Downloads][downloads-image]][downloads-url]
|
|
9
|
+
|
|
10
|
+
[![npm badge][npm-badge-png]][package-url]
|
|
11
|
+
|
|
12
|
+
Determine if the current node version supports the `--preserve-symlinks` flag.
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
var supportsPreserveSymlinks = require('node-supports-preserve-symlinks-flag');
|
|
18
|
+
var assert = require('assert');
|
|
19
|
+
|
|
20
|
+
assert.equal(supportsPreserveSymlinks, null); // in a browser
|
|
21
|
+
assert.equal(supportsPreserveSymlinks, false); // in node < v6.2
|
|
22
|
+
assert.equal(supportsPreserveSymlinks, true); // in node v6.2+
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Tests
|
|
26
|
+
Simply clone the repo, `npm install`, and run `npm test`
|
|
27
|
+
|
|
28
|
+
[package-url]: https://npmjs.org/package/node-supports-preserve-symlinks-flag
|
|
29
|
+
[npm-version-svg]: https://versionbadg.es/inspect-js/node-supports-preserve-symlinks-flag.svg
|
|
30
|
+
[deps-svg]: https://david-dm.org/inspect-js/node-supports-preserve-symlinks-flag.svg
|
|
31
|
+
[deps-url]: https://david-dm.org/inspect-js/node-supports-preserve-symlinks-flag
|
|
32
|
+
[dev-deps-svg]: https://david-dm.org/inspect-js/node-supports-preserve-symlinks-flag/dev-status.svg
|
|
33
|
+
[dev-deps-url]: https://david-dm.org/inspect-js/node-supports-preserve-symlinks-flag#info=devDependencies
|
|
34
|
+
[npm-badge-png]: https://nodei.co/npm/node-supports-preserve-symlinks-flag.png?downloads=true&stars=true
|
|
35
|
+
[license-image]: https://img.shields.io/npm/l/node-supports-preserve-symlinks-flag.svg
|
|
36
|
+
[license-url]: LICENSE
|
|
37
|
+
[downloads-image]: https://img.shields.io/npm/dm/node-supports-preserve-symlinks-flag.svg
|
|
38
|
+
[downloads-url]: https://npm-stat.com/charts.html?package=node-supports-preserve-symlinks-flag
|
|
39
|
+
[codecov-image]: https://codecov.io/gh/inspect-js/node-supports-preserve-symlinks-flag/branch/main/graphs/badge.svg
|
|
40
|
+
[codecov-url]: https://app.codecov.io/gh/inspect-js/node-supports-preserve-symlinks-flag/
|
|
41
|
+
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/node-supports-preserve-symlinks-flag
|
|
42
|
+
[actions-url]: https://github.com/inspect-js/node-supports-preserve-symlinks-flag/actions
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = (
|
|
4
|
+
// node 12+
|
|
5
|
+
process.allowedNodeEnvironmentFlags && process.allowedNodeEnvironmentFlags.has('--preserve-symlinks')
|
|
6
|
+
) || (
|
|
7
|
+
// node v6.2 - v11
|
|
8
|
+
String(module.constructor._findPath).indexOf('preserveSymlinks') >= 0 // eslint-disable-line no-underscore-dangle
|
|
9
|
+
);
|