projen 0.67.4 → 0.67.6
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 +3 -3
- package/lib/awscdk/auto-discover.js +5 -5
- package/lib/awscdk/awscdk-app-java.js +1 -1
- package/lib/awscdk/awscdk-app-py.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-py.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-extension.js +1 -1
- package/lib/awscdk/lambda-function.js +2 -2
- package/lib/build/build-workflow.js +1 -1
- package/lib/cdk/auto-discover-base.js +2 -2
- package/lib/cdk/construct-lib.js +1 -1
- package/lib/cdk/integration-test-base.js +1 -1
- package/lib/cdk/jsii-docgen.js +1 -1
- package/lib/cdk/jsii-project.js +1 -1
- package/lib/cdk8s/auto-discover.js +2 -2
- package/lib/cdk8s/cdk8s-app-py.js +1 -1
- package/lib/cdk8s/cdk8s-app-ts.js +1 -1
- package/lib/cdk8s/cdk8s-construct.js +1 -1
- package/lib/cdk8s/cdk8s-deps-py.js +1 -1
- package/lib/cdk8s/cdk8s-deps.js +1 -1
- package/lib/cdk8s/integration-test.js +1 -1
- package/lib/cdktf/cdktf-construct.js +1 -1
- package/lib/circleci/circleci.js +1 -1
- 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-credentials.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.js +1 -1
- 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-patch.js +1 -1
- 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-sample.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/renovatebot.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/extensions.js +1 -1
- package/lib/vscode/launch-config.js +1 -1
- package/lib/vscode/settings.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/glob/LICENSE +1 -7
- package/node_modules/glob/README.md +23 -2
- package/node_modules/glob/common.js +14 -8
- package/node_modules/glob/glob.js +1 -1
- package/node_modules/glob/node_modules/brace-expansion/.github/FUNDING.yml +2 -0
- package/node_modules/glob/node_modules/brace-expansion/LICENSE +21 -0
- package/node_modules/glob/node_modules/brace-expansion/README.md +135 -0
- package/node_modules/glob/node_modules/brace-expansion/index.js +203 -0
- package/node_modules/glob/node_modules/brace-expansion/package.json +46 -0
- package/node_modules/glob/node_modules/minimatch/LICENSE +15 -0
- package/node_modules/glob/node_modules/minimatch/README.md +259 -0
- package/node_modules/glob/node_modules/minimatch/lib/path.js +4 -0
- package/node_modules/glob/node_modules/minimatch/minimatch.js +944 -0
- package/node_modules/glob/node_modules/minimatch/package.json +35 -0
- package/node_modules/glob/package.json +9 -9
- package/node_modules/glob/sync.js +1 -1
- package/node_modules/shelljs/node_modules/glob/LICENSE +21 -0
- package/node_modules/shelljs/node_modules/glob/README.md +378 -0
- package/node_modules/shelljs/node_modules/glob/common.js +238 -0
- package/node_modules/shelljs/node_modules/glob/glob.js +790 -0
- package/node_modules/shelljs/node_modules/glob/package.json +55 -0
- package/node_modules/shelljs/node_modules/glob/sync.js +486 -0
- package/package.json +3 -3
|
@@ -210,10 +210,26 @@ parallel glob operations will be sped up by sharing information about
|
|
|
210
210
|
the filesystem.
|
|
211
211
|
|
|
212
212
|
* `cwd` The current working directory in which to search. Defaults
|
|
213
|
-
to `process.cwd()`.
|
|
213
|
+
to `process.cwd()`. This option is always coerced to use
|
|
214
|
+
forward-slashes as a path separator, because it is not tested
|
|
215
|
+
as a glob pattern, so there is no need to escape anything.
|
|
214
216
|
* `root` The place where patterns starting with `/` will be mounted
|
|
215
217
|
onto. Defaults to `path.resolve(options.cwd, "/")` (`/` on Unix
|
|
216
|
-
systems, and `C:\` or some such on Windows.)
|
|
218
|
+
systems, and `C:\` or some such on Windows.) This option is
|
|
219
|
+
always coerced to use forward-slashes as a path separator,
|
|
220
|
+
because it is not tested as a glob pattern, so there is no need
|
|
221
|
+
to escape anything.
|
|
222
|
+
* `windowsPathsNoEscape` Use `\\` as a path separator _only_, and
|
|
223
|
+
_never_ as an escape character. If set, all `\\` characters
|
|
224
|
+
are replaced with `/` in the pattern. Note that this makes it
|
|
225
|
+
**impossible** to match against paths containing literal glob
|
|
226
|
+
pattern characters, but allows matching with patterns constructed
|
|
227
|
+
using `path.join()` and `path.resolve()` on Windows platforms,
|
|
228
|
+
mimicking the (buggy!) behavior of Glob v7 and before on
|
|
229
|
+
Windows. Please use with caution, and be mindful of [the caveat
|
|
230
|
+
below about Windows paths](#windows). (For legacy reasons,
|
|
231
|
+
this is also set if `allowWindowsEscape` is set to the exact
|
|
232
|
+
value `false`.)
|
|
217
233
|
* `dot` Include `.dot` files in normal matches and `globstar` matches.
|
|
218
234
|
Note that an explicit dot in a portion of the pattern will always
|
|
219
235
|
match dot files.
|
|
@@ -332,6 +348,11 @@ Results from absolute patterns such as `/foo/*` are mounted onto the
|
|
|
332
348
|
root setting using `path.join`. On windows, this will by default result
|
|
333
349
|
in `/foo/*` matching `C:\foo\bar.txt`.
|
|
334
350
|
|
|
351
|
+
To automatically coerce all `\` characters to `/` in pattern
|
|
352
|
+
strings, **thus making it impossible to escape literal glob
|
|
353
|
+
characters**, you may set the `windowsPathsNoEscape` option to
|
|
354
|
+
`true`.
|
|
355
|
+
|
|
335
356
|
## Race Conditions
|
|
336
357
|
|
|
337
358
|
Glob searching, by its very nature, is susceptible to race conditions,
|
|
@@ -13,7 +13,7 @@ function ownProp (obj, field) {
|
|
|
13
13
|
var fs = require("fs")
|
|
14
14
|
var path = require("path")
|
|
15
15
|
var minimatch = require("minimatch")
|
|
16
|
-
var isAbsolute = require("path
|
|
16
|
+
var isAbsolute = require("path").isAbsolute
|
|
17
17
|
var Minimatch = minimatch.Minimatch
|
|
18
18
|
|
|
19
19
|
function alphasort (a, b) {
|
|
@@ -57,6 +57,12 @@ function setopts (self, pattern, options) {
|
|
|
57
57
|
pattern = "**/" + pattern
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
self.windowsPathsNoEscape = !!options.windowsPathsNoEscape ||
|
|
61
|
+
options.allowWindowsEscape === false
|
|
62
|
+
if (self.windowsPathsNoEscape) {
|
|
63
|
+
pattern = pattern.replace(/\\/g, '/')
|
|
64
|
+
}
|
|
65
|
+
|
|
60
66
|
self.silent = !!options.silent
|
|
61
67
|
self.pattern = pattern
|
|
62
68
|
self.strict = options.strict !== false
|
|
@@ -88,7 +94,7 @@ function setopts (self, pattern, options) {
|
|
|
88
94
|
self.changedCwd = false
|
|
89
95
|
var cwd = process.cwd()
|
|
90
96
|
if (!ownProp(options, "cwd"))
|
|
91
|
-
self.cwd = cwd
|
|
97
|
+
self.cwd = path.resolve(cwd)
|
|
92
98
|
else {
|
|
93
99
|
self.cwd = path.resolve(options.cwd)
|
|
94
100
|
self.changedCwd = self.cwd !== cwd
|
|
@@ -96,22 +102,22 @@ function setopts (self, pattern, options) {
|
|
|
96
102
|
|
|
97
103
|
self.root = options.root || path.resolve(self.cwd, "/")
|
|
98
104
|
self.root = path.resolve(self.root)
|
|
99
|
-
if (process.platform === "win32")
|
|
100
|
-
self.root = self.root.replace(/\\/g, "/")
|
|
101
105
|
|
|
102
106
|
// TODO: is an absolute `cwd` supposed to be resolved against `root`?
|
|
103
107
|
// e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test')
|
|
104
108
|
self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd)
|
|
105
|
-
if (process.platform === "win32")
|
|
106
|
-
self.cwdAbs = self.cwdAbs.replace(/\\/g, "/")
|
|
107
109
|
self.nomount = !!options.nomount
|
|
108
110
|
|
|
111
|
+
if (process.platform === "win32") {
|
|
112
|
+
self.root = self.root.replace(/\\/g, "/")
|
|
113
|
+
self.cwd = self.cwd.replace(/\\/g, "/")
|
|
114
|
+
self.cwdAbs = self.cwdAbs.replace(/\\/g, "/")
|
|
115
|
+
}
|
|
116
|
+
|
|
109
117
|
// disable comments and negation in Minimatch.
|
|
110
118
|
// Note that they are not supported in Glob itself anyway.
|
|
111
119
|
options.nonegate = true
|
|
112
120
|
options.nocomment = true
|
|
113
|
-
// always treat \ in patterns as escapes, not path separators
|
|
114
|
-
options.allowWindowsEscape = false
|
|
115
121
|
|
|
116
122
|
self.minimatch = new Minimatch(pattern, options)
|
|
117
123
|
self.options = self.minimatch.options
|
|
@@ -47,7 +47,7 @@ var inherits = require('inherits')
|
|
|
47
47
|
var EE = require('events').EventEmitter
|
|
48
48
|
var path = require('path')
|
|
49
49
|
var assert = require('assert')
|
|
50
|
-
var isAbsolute = require('path
|
|
50
|
+
var isAbsolute = require('path').isAbsolute
|
|
51
51
|
var globSync = require('./sync.js')
|
|
52
52
|
var common = require('./common.js')
|
|
53
53
|
var setopts = common.setopts
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
|
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,135 @@
|
|
|
1
|
+
# brace-expansion
|
|
2
|
+
|
|
3
|
+
[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html),
|
|
4
|
+
as known from sh/bash, in JavaScript.
|
|
5
|
+
|
|
6
|
+
[](http://travis-ci.org/juliangruber/brace-expansion)
|
|
7
|
+
[](https://www.npmjs.org/package/brace-expansion)
|
|
8
|
+
[](https://greenkeeper.io/)
|
|
9
|
+
|
|
10
|
+
[](https://ci.testling.com/juliangruber/brace-expansion)
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
var expand = require('brace-expansion');
|
|
16
|
+
|
|
17
|
+
expand('file-{a,b,c}.jpg')
|
|
18
|
+
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
|
|
19
|
+
|
|
20
|
+
expand('-v{,,}')
|
|
21
|
+
// => ['-v', '-v', '-v']
|
|
22
|
+
|
|
23
|
+
expand('file{0..2}.jpg')
|
|
24
|
+
// => ['file0.jpg', 'file1.jpg', 'file2.jpg']
|
|
25
|
+
|
|
26
|
+
expand('file-{a..c}.jpg')
|
|
27
|
+
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
|
|
28
|
+
|
|
29
|
+
expand('file{2..0}.jpg')
|
|
30
|
+
// => ['file2.jpg', 'file1.jpg', 'file0.jpg']
|
|
31
|
+
|
|
32
|
+
expand('file{0..4..2}.jpg')
|
|
33
|
+
// => ['file0.jpg', 'file2.jpg', 'file4.jpg']
|
|
34
|
+
|
|
35
|
+
expand('file-{a..e..2}.jpg')
|
|
36
|
+
// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg']
|
|
37
|
+
|
|
38
|
+
expand('file{00..10..5}.jpg')
|
|
39
|
+
// => ['file00.jpg', 'file05.jpg', 'file10.jpg']
|
|
40
|
+
|
|
41
|
+
expand('{{A..C},{a..c}}')
|
|
42
|
+
// => ['A', 'B', 'C', 'a', 'b', 'c']
|
|
43
|
+
|
|
44
|
+
expand('ppp{,config,oe{,conf}}')
|
|
45
|
+
// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf']
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## API
|
|
49
|
+
|
|
50
|
+
```js
|
|
51
|
+
var expand = require('brace-expansion');
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### var expanded = expand(str)
|
|
55
|
+
|
|
56
|
+
Return an array of all possible and valid expansions of `str`. If none are
|
|
57
|
+
found, `[str]` is returned.
|
|
58
|
+
|
|
59
|
+
Valid expansions are:
|
|
60
|
+
|
|
61
|
+
```js
|
|
62
|
+
/^(.*,)+(.+)?$/
|
|
63
|
+
// {a,b,...}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
A comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`.
|
|
67
|
+
|
|
68
|
+
```js
|
|
69
|
+
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
|
|
70
|
+
// {x..y[..incr]}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
A numeric sequence from `x` to `y` inclusive, with optional increment.
|
|
74
|
+
If `x` or `y` start with a leading `0`, all the numbers will be padded
|
|
75
|
+
to have equal length. Negative numbers and backwards iteration work too.
|
|
76
|
+
|
|
77
|
+
```js
|
|
78
|
+
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
|
|
79
|
+
// {x..y[..incr]}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
An alphabetic sequence from `x` to `y` inclusive, with optional increment.
|
|
83
|
+
`x` and `y` must be exactly one character, and if given, `incr` must be a
|
|
84
|
+
number.
|
|
85
|
+
|
|
86
|
+
For compatibility reasons, the string `${` is not eligible for brace expansion.
|
|
87
|
+
|
|
88
|
+
## Installation
|
|
89
|
+
|
|
90
|
+
With [npm](https://npmjs.org) do:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
npm install brace-expansion
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Contributors
|
|
97
|
+
|
|
98
|
+
- [Julian Gruber](https://github.com/juliangruber)
|
|
99
|
+
- [Isaac Z. Schlueter](https://github.com/isaacs)
|
|
100
|
+
|
|
101
|
+
## Sponsors
|
|
102
|
+
|
|
103
|
+
This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)!
|
|
104
|
+
|
|
105
|
+
Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)!
|
|
106
|
+
|
|
107
|
+
## Security contact information
|
|
108
|
+
|
|
109
|
+
To report a security vulnerability, please use the
|
|
110
|
+
[Tidelift security contact](https://tidelift.com/security).
|
|
111
|
+
Tidelift will coordinate the fix and disclosure.
|
|
112
|
+
|
|
113
|
+
## License
|
|
114
|
+
|
|
115
|
+
(MIT)
|
|
116
|
+
|
|
117
|
+
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
|
118
|
+
|
|
119
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
120
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
121
|
+
the Software without restriction, including without limitation the rights to
|
|
122
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
123
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
124
|
+
so, subject to the following conditions:
|
|
125
|
+
|
|
126
|
+
The above copyright notice and this permission notice shall be included in all
|
|
127
|
+
copies or substantial portions of the Software.
|
|
128
|
+
|
|
129
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
130
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
131
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
132
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
133
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
134
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
135
|
+
SOFTWARE.
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
var balanced = require('balanced-match');
|
|
2
|
+
|
|
3
|
+
module.exports = expandTop;
|
|
4
|
+
|
|
5
|
+
var escSlash = '\0SLASH'+Math.random()+'\0';
|
|
6
|
+
var escOpen = '\0OPEN'+Math.random()+'\0';
|
|
7
|
+
var escClose = '\0CLOSE'+Math.random()+'\0';
|
|
8
|
+
var escComma = '\0COMMA'+Math.random()+'\0';
|
|
9
|
+
var escPeriod = '\0PERIOD'+Math.random()+'\0';
|
|
10
|
+
|
|
11
|
+
function numeric(str) {
|
|
12
|
+
return parseInt(str, 10) == str
|
|
13
|
+
? parseInt(str, 10)
|
|
14
|
+
: str.charCodeAt(0);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function escapeBraces(str) {
|
|
18
|
+
return str.split('\\\\').join(escSlash)
|
|
19
|
+
.split('\\{').join(escOpen)
|
|
20
|
+
.split('\\}').join(escClose)
|
|
21
|
+
.split('\\,').join(escComma)
|
|
22
|
+
.split('\\.').join(escPeriod);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function unescapeBraces(str) {
|
|
26
|
+
return str.split(escSlash).join('\\')
|
|
27
|
+
.split(escOpen).join('{')
|
|
28
|
+
.split(escClose).join('}')
|
|
29
|
+
.split(escComma).join(',')
|
|
30
|
+
.split(escPeriod).join('.');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
// Basically just str.split(","), but handling cases
|
|
35
|
+
// where we have nested braced sections, which should be
|
|
36
|
+
// treated as individual members, like {a,{b,c},d}
|
|
37
|
+
function parseCommaParts(str) {
|
|
38
|
+
if (!str)
|
|
39
|
+
return [''];
|
|
40
|
+
|
|
41
|
+
var parts = [];
|
|
42
|
+
var m = balanced('{', '}', str);
|
|
43
|
+
|
|
44
|
+
if (!m)
|
|
45
|
+
return str.split(',');
|
|
46
|
+
|
|
47
|
+
var pre = m.pre;
|
|
48
|
+
var body = m.body;
|
|
49
|
+
var post = m.post;
|
|
50
|
+
var p = pre.split(',');
|
|
51
|
+
|
|
52
|
+
p[p.length-1] += '{' + body + '}';
|
|
53
|
+
var postParts = parseCommaParts(post);
|
|
54
|
+
if (post.length) {
|
|
55
|
+
p[p.length-1] += postParts.shift();
|
|
56
|
+
p.push.apply(p, postParts);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
parts.push.apply(parts, p);
|
|
60
|
+
|
|
61
|
+
return parts;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function expandTop(str) {
|
|
65
|
+
if (!str)
|
|
66
|
+
return [];
|
|
67
|
+
|
|
68
|
+
// I don't know why Bash 4.3 does this, but it does.
|
|
69
|
+
// Anything starting with {} will have the first two bytes preserved
|
|
70
|
+
// but *only* at the top level, so {},a}b will not expand to anything,
|
|
71
|
+
// but a{},b}c will be expanded to [a}c,abc].
|
|
72
|
+
// One could argue that this is a bug in Bash, but since the goal of
|
|
73
|
+
// this module is to match Bash's rules, we escape a leading {}
|
|
74
|
+
if (str.substr(0, 2) === '{}') {
|
|
75
|
+
str = '\\{\\}' + str.substr(2);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return expand(escapeBraces(str), true).map(unescapeBraces);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function embrace(str) {
|
|
82
|
+
return '{' + str + '}';
|
|
83
|
+
}
|
|
84
|
+
function isPadded(el) {
|
|
85
|
+
return /^-?0\d/.test(el);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function lte(i, y) {
|
|
89
|
+
return i <= y;
|
|
90
|
+
}
|
|
91
|
+
function gte(i, y) {
|
|
92
|
+
return i >= y;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function expand(str, isTop) {
|
|
96
|
+
var expansions = [];
|
|
97
|
+
|
|
98
|
+
var m = balanced('{', '}', str);
|
|
99
|
+
if (!m) return [str];
|
|
100
|
+
|
|
101
|
+
// no need to expand pre, since it is guaranteed to be free of brace-sets
|
|
102
|
+
var pre = m.pre;
|
|
103
|
+
var post = m.post.length
|
|
104
|
+
? expand(m.post, false)
|
|
105
|
+
: [''];
|
|
106
|
+
|
|
107
|
+
if (/\$$/.test(m.pre)) {
|
|
108
|
+
for (var k = 0; k < post.length; k++) {
|
|
109
|
+
var expansion = pre+ '{' + m.body + '}' + post[k];
|
|
110
|
+
expansions.push(expansion);
|
|
111
|
+
}
|
|
112
|
+
} else {
|
|
113
|
+
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
114
|
+
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
115
|
+
var isSequence = isNumericSequence || isAlphaSequence;
|
|
116
|
+
var isOptions = m.body.indexOf(',') >= 0;
|
|
117
|
+
if (!isSequence && !isOptions) {
|
|
118
|
+
// {a},b}
|
|
119
|
+
if (m.post.match(/,.*\}/)) {
|
|
120
|
+
str = m.pre + '{' + m.body + escClose + m.post;
|
|
121
|
+
return expand(str);
|
|
122
|
+
}
|
|
123
|
+
return [str];
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
var n;
|
|
127
|
+
if (isSequence) {
|
|
128
|
+
n = m.body.split(/\.\./);
|
|
129
|
+
} else {
|
|
130
|
+
n = parseCommaParts(m.body);
|
|
131
|
+
if (n.length === 1) {
|
|
132
|
+
// x{{a,b}}y ==> x{a}y x{b}y
|
|
133
|
+
n = expand(n[0], false).map(embrace);
|
|
134
|
+
if (n.length === 1) {
|
|
135
|
+
return post.map(function(p) {
|
|
136
|
+
return m.pre + n[0] + p;
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// at this point, n is the parts, and we know it's not a comma set
|
|
143
|
+
// with a single entry.
|
|
144
|
+
var N;
|
|
145
|
+
|
|
146
|
+
if (isSequence) {
|
|
147
|
+
var x = numeric(n[0]);
|
|
148
|
+
var y = numeric(n[1]);
|
|
149
|
+
var width = Math.max(n[0].length, n[1].length)
|
|
150
|
+
var incr = n.length == 3
|
|
151
|
+
? Math.abs(numeric(n[2]))
|
|
152
|
+
: 1;
|
|
153
|
+
var test = lte;
|
|
154
|
+
var reverse = y < x;
|
|
155
|
+
if (reverse) {
|
|
156
|
+
incr *= -1;
|
|
157
|
+
test = gte;
|
|
158
|
+
}
|
|
159
|
+
var pad = n.some(isPadded);
|
|
160
|
+
|
|
161
|
+
N = [];
|
|
162
|
+
|
|
163
|
+
for (var i = x; test(i, y); i += incr) {
|
|
164
|
+
var c;
|
|
165
|
+
if (isAlphaSequence) {
|
|
166
|
+
c = String.fromCharCode(i);
|
|
167
|
+
if (c === '\\')
|
|
168
|
+
c = '';
|
|
169
|
+
} else {
|
|
170
|
+
c = String(i);
|
|
171
|
+
if (pad) {
|
|
172
|
+
var need = width - c.length;
|
|
173
|
+
if (need > 0) {
|
|
174
|
+
var z = new Array(need + 1).join('0');
|
|
175
|
+
if (i < 0)
|
|
176
|
+
c = '-' + z + c.slice(1);
|
|
177
|
+
else
|
|
178
|
+
c = z + c;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
N.push(c);
|
|
183
|
+
}
|
|
184
|
+
} else {
|
|
185
|
+
N = [];
|
|
186
|
+
|
|
187
|
+
for (var j = 0; j < n.length; j++) {
|
|
188
|
+
N.push.apply(N, expand(n[j], false));
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
for (var j = 0; j < N.length; j++) {
|
|
193
|
+
for (var k = 0; k < post.length; k++) {
|
|
194
|
+
var expansion = pre + N[j] + post[k];
|
|
195
|
+
if (!isTop || isSequence || expansion)
|
|
196
|
+
expansions.push(expansion);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return expansions;
|
|
202
|
+
}
|
|
203
|
+
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "brace-expansion",
|
|
3
|
+
"description": "Brace expansion as known from sh/bash",
|
|
4
|
+
"version": "2.0.1",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git://github.com/juliangruber/brace-expansion.git"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/juliangruber/brace-expansion",
|
|
10
|
+
"main": "index.js",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"test": "tape test/*.js",
|
|
13
|
+
"gentest": "bash test/generate.sh",
|
|
14
|
+
"bench": "matcha test/perf/bench.js"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"balanced-match": "^1.0.0"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@c4312/matcha": "^1.3.1",
|
|
21
|
+
"tape": "^4.6.0"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [],
|
|
24
|
+
"author": {
|
|
25
|
+
"name": "Julian Gruber",
|
|
26
|
+
"email": "mail@juliangruber.com",
|
|
27
|
+
"url": "http://juliangruber.com"
|
|
28
|
+
},
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"testling": {
|
|
31
|
+
"files": "test/*.js",
|
|
32
|
+
"browsers": [
|
|
33
|
+
"ie/8..latest",
|
|
34
|
+
"firefox/20..latest",
|
|
35
|
+
"firefox/nightly",
|
|
36
|
+
"chrome/25..latest",
|
|
37
|
+
"chrome/canary",
|
|
38
|
+
"opera/12..latest",
|
|
39
|
+
"opera/next",
|
|
40
|
+
"safari/5.1..latest",
|
|
41
|
+
"ipad/6.0..latest",
|
|
42
|
+
"iphone/6.0..latest",
|
|
43
|
+
"android-browser/4.2..latest"
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
The ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2011-2023 Isaac Z. Schlueter and Contributors
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
|
15
|
+
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|