Last commit july 5th

This commit is contained in:
2024-07-05 13:46:23 +02:00
parent dad0d86e8c
commit b0e4dfbb76
24982 changed files with 2621219 additions and 413 deletions

37
spa/node_modules/cordova-create/CONTRIBUTING.md generated vendored Normal file
View File

@@ -0,0 +1,37 @@
<!--
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
-->
# Contributing to Apache Cordova
Anyone can contribute to Cordova. And we need your contributions.
There are multiple ways to contribute: report bugs, improve the docs, and
contribute code.
For instructions on this, start with the
[contribution overview](http://cordova.apache.org/contribute/).
The details are explained there, but the important items are:
- Check for Github issues that corresponds to your contribution and link or create them if necessary.
- Run the tests so your patch doesn't break existing functionality.
We look forward to your contributions!

202
spa/node_modules/cordova-create/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2020 Apache Cordova
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

5
spa/node_modules/cordova-create/NOTICE generated vendored Normal file
View File

@@ -0,0 +1,5 @@
Apache Cordova
Copyright 2020 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).

62
spa/node_modules/cordova-create/README.md generated vendored Normal file
View File

@@ -0,0 +1,62 @@
<!--
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
-->
# cordova-create
[![NPM](https://nodei.co/npm/cordova-create.png)](https://nodei.co/npm/cordova-create/)
[![Node CI](https://github.com/apache/cordova-create/workflows/Node%20CI/badge.svg?branch=master)](https://github.com/apache/cordova-create/actions?query=branch%3Amaster)
[![codecov.io](https://codecov.io/github/apache/cordova-create/coverage.svg?branch=master)](https://codecov.io/github/apache/cordova-create?branch=master)
This module is used for creating Cordova style projects. It also incudes support for [Cordova App Templates](http://cordova.apache.org/docs/en/latest/guide/cli/template.html). It can fetch templates from npm and git.
## Usage
```js
const create = require('cordova-create');
await create(dest, opts);
```
### Parameters
#### `dest`
_Required_. Path to the destination where the project will be created. Must be an empty dir if it exists.
#### `opts`
_Optional_. Supports following properties.
```js
{
// Attributes to be set in package.json & config.xml
id: String,
name: String,
version: String,
// The path/url/package-name to the template that should be used
template: String,
// An EventEmitter instance that will be used for logging purposes
// (actually it only needs to implement a compatible `emit` method)
events: EventEmitter
}
```

135
spa/node_modules/cordova-create/RELEASENOTES.md generated vendored Normal file
View File

@@ -0,0 +1,135 @@
<!--
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
-->
# Cordova-create Release Notes
### 5.0.0 (May 13, 2023)
* [GH-82](https://github.com/apache/cordova-create/pull/82) dep!: packages upgrade & requirements
* Bumped Packages
* `@cordova/eslint-config@latest@5.0.0`
* `cordova-common@5.0.0`
* `cordova-fetch@4.0.0`
* `fs-extra@11.1.1`
* `jasmine@4.6.0`
* `rewire@6.0.0`
* `npm-package-arg@10.1.0`
* Rebuilt `package-lock.json`
* Bumped `node` engine requirement `>=16.13.0`
### 4.1.0 (Dec 26, 2022)
* [GH-73](https://github.com/apache/cordova-create/pull/73) dep(npm): bump dependencies to latest minor/patch & rebuild package-lock
* `cordova-common@^4.1.0`
* `cordova-fetch@^3.1.0`
* `fs-extra@^10.1.0`
* `globby@^11.1.0`
* `jasmine@^3.99.0`
* [GH-74](https://github.com/apache/cordova-create/pull/74) ci(workflow): update node support & action dependencies
### 4.0.0 (Nov 30, 2021)
* [GH-68](https://github.com/apache/cordova-create/pull/68) dep!: update all dependencies
* `cordova-app-hello-world@^6.0.0`
* `cordova-common@^4.0.2`
* `cordova-fetch@^3.0.1`
* [GH-67](https://github.com/apache/cordova-create/pull/67) chore: clean up `package.json`
* [GH-66](https://github.com/apache/cordova-create/pull/66) ci: add node 14 to workflow
### 3.0.0 (May 19, 2020)
* [GH-65](https://github.com/apache/cordova-create/pull/65) chore(`npm`): bump dependencies w/ rebuilt `package-lock`
* [GH-64](https://github.com/apache/cordova-create/pull/64) refactor: small syntax changes
* [GH-63](https://github.com/apache/cordova-create/pull/63) chore: various cleanup changes
* [GH-60](https://github.com/apache/cordova-create/pull/60) chore(`eslint`): bump package
* [GH-59](https://github.com/apache/cordova-create/pull/59) breaking(`npm`): bump dependencies
* [GH-62](https://github.com/apache/cordova-create/pull/62) ci: use GitHub Actions
* [GH-58](https://github.com/apache/cordova-create/pull/58) chore(`npm`): use short notation in `package.json`
* [GH-55](https://github.com/apache/cordova-create/pull/55) chore: `eslint` config cleanup
* [GH-53](https://github.com/apache/cordova-create/pull/53) feat: support `.gitignore` files in generated app
* [GH-54](https://github.com/apache/cordova-create/pull/54) refactor: `eslint` setup
* [GH-52](https://github.com/apache/cordova-create/pull/52) Fix `isRemoteUri`
* [GH-51](https://github.com/apache/cordova-create/pull/51) Add syntax highlighting to code samples in `README`
* [GH-48](https://github.com/apache/cordova-create/pull/48) chore: update testing (`jasmine` & `nyc`)
* [GH-40](https://github.com/apache/cordova-create/pull/40) breaking: major usability & maintainability improvements
* Write `package.json` with indentation of 2
* Simplify interface of main export (§1)
* New logic for setting attributes in `package.json` & `config.xml` (§3)
* Do not copy "missing" files from default template (§5)
* Reduce number of supported template layouts (§7)
* Drop support for linking (§8)
* Use either `opts.events` or a no-op for logging (§4)
* [GH-50](https://github.com/apache/cordova-create/pull/50) chore: improve `npm` ignore list
* [GH-49](https://github.com/apache/cordova-create/pull/49) chore: bump production dependencies
* [GH-47](https://github.com/apache/cordova-create/pull/47) breaking: drop `node` 6 and 8 support
* [GH-42](https://github.com/apache/cordova-create/pull/42) chore: bump `eslint-utils` from 1.3.1 to 1.4.3
* [GH-44](https://github.com/apache/cordova-create/pull/44) chore: bump `js-yaml` from 3.12.0 to 3.13.1
* [GH-43](https://github.com/apache/cordova-create/pull/43) chore: bump `lodash` from 4.17.11 to 4.17.15
* [GH-45](https://github.com/apache/cordova-create/pull/45) chore: replace `http` URLs in `package-lock.json` w/ `https`
* [GH-41](https://github.com/apache/cordova-create/pull/41) chore: update `nyc` dev dependency
* [GH-39](https://github.com/apache/cordova-create/pull/39) chore: add Node.js 12 to CI services
* chore: remove deprecated `engineStrict` from `package.json`
### 2.0.0 (Jan 07, 2019)
* Updated Cordova Package Dependencies (#36) & (#38)
* Updated External Package Dependencies (#35) & (#38)
* Updated `package.json` bug tracker link (#37)
* Drop Q, use native promises (#33)
* Update Apache License version in test fixture (#32)
* Fix version in package-lock.json (#30)
* Commit package-lock.json (#28)
* Mark 2.0.0-dev (major update) (#27)
* Reformat & cleanup `README`
* Non-breaking cleanup & improvements (#20)
* Update nyc and ignore HTML coverage reports
* Determine code coverage during tests (#17)
* [CB-14140](https://issues.apache.org/jira/browse/CB-14140) Use fs-extra instead of shelljs (#19)
* Drop support for reading from .cordova/config.json (#18)
* Refactor tests (#16)
* Fix error messages for toExist matcher (#15)
* Major code cleanup (Remove deadcode, cleanup, refactor, update dependencies, etc.) #13
* Update node versions for CI and drop support for node 4 (#12)
### 1.1.2 (Dec 14, 2017)
* [CB-12807](https://issues.apache.org/jira/browse/CB-12807): updated error message to follow the template guide
* [CB-13674](https://issues.apache.org/jira/browse/CB-13674): updated deps
* [CB-13501](https://issues.apache.org/jira/browse/CB-13501): added support for node 8 to tests
### 1.1.1 (May 08, 2017)
* [CB-12765](https://issues.apache.org/jira/browse/CB-12765) default app `cordova-app-hello-world` is now treated like a template
### 1.1.0 (May 02, 2017)
* [CB-10681](https://issues.apache.org/jira/browse/CB-10681) templates will add `@latest` when fetching from npm when no version is specified. This will ensure an older cahced version of the template is not used
* [CB-12666](https://issues.apache.org/jira/browse/CB-12666) - Remove `node 0.x` support.
* [CB-12517](https://issues.apache.org/jira/browse/CB-12517): `package.json` `displayname` should equal `config.xml` name feild and `package.json` `name` feild should equal `config.xml` `id` feild.
### 1.0.2 (Jan 17, 2017)
* change event from `warn` to `verbose`
* Add github pull request template
### 1.0.1 (Sep 29, 2016)
* removed stripping eventlisteners
### 1.0.0 (August 23, 2016)
* [CB-11623](https://issues.apache.org/jira/browse/CB-11623) added symlinking option
* fixed jasmine custom matcher for `toExist`
* updated jasmine dep, fixed caching issue with tests
* added `travis` and `appveyor` support
* version 1.0.0 for **npm**

178
spa/node_modules/cordova-create/index.js generated vendored Normal file
View File

@@ -0,0 +1,178 @@
/**
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
const fs = require('fs-extra');
const path = require('path');
const tmp = require('tmp');
const npa = require('npm-package-arg');
const globby = require('globby');
const isObject = require('isobject');
const pathIsInside = require('path-is-inside');
const requireFresh = require('import-fresh');
const validateIdentifier = require('valid-identifier');
const fetch = require('cordova-fetch');
const { CordovaError, ConfigParser } = require('cordova-common');
module.exports = cordovaCreate;
/**
* Creates a new cordova project in the given directory.
*
* @param {string} dest directory where the project will be created.
* @param {Object} [opts={}] options to be used for creating the project.
* @returns {Promise} Resolves when project creation has finished.
*/
function cordovaCreate (dest, opts = {}) {
let emit;
// TODO this is to avoid having a huge diff. Remove later.
let dir = dest;
return Promise.resolve().then(() => {
if (!dir) {
throw new CordovaError('Directory not specified. See `cordova help`.');
}
if (!isObject(opts)) {
throw new CordovaError('Given options must be an object');
}
// Shallow copy opts
opts = Object.assign({}, opts);
emit = getEventEmitter(opts);
emit('verbose', 'Using detached cordova-create');
// Make absolute.
dir = path.resolve(dir);
if (fs.existsSync(dir) && fs.readdirSync(dir).length > 0) {
throw new CordovaError('Path already exists and is not empty: ' + dir);
}
if (opts.id && !validateIdentifier(opts.id)) {
throw new CordovaError('App id contains a reserved word, or is not a valid identifier.');
}
if (!opts.template) {
opts.template = require.resolve('cordova-app-hello-world');
}
// Ensure that the destination is outside the template location
if (pathIsInside(dir, opts.template)) {
throw new CordovaError(
`Cannot create project "${dir}" inside the template used to create it "${opts.template}".`
);
}
})
.then(() => {
// Finally, Ready to start!
emit('log', 'Creating a new cordova project.');
// Use cordova-fetch to obtain npm or git templates
if (needsToBeFetched(opts.template)) {
const target = opts.template;
emit('verbose', 'Using cordova-fetch for ' + target);
return fetch(target, getSelfDestructingTempDir(), {});
} else {
// If assets are not online, resolve as a relative path on local computer
return path.resolve(opts.template);
}
})
.then(templatePath => {
let import_from_path;
try {
import_from_path = requireFresh(templatePath).dirname;
} catch (e) {
throw new CordovaError(templatePath + ' is not a valid template');
}
if (!fs.existsSync(import_from_path)) {
throw new CordovaError('Could not find directory: ' +
import_from_path);
}
const dirAlreadyExisted = fs.existsSync(dir);
if (!dirAlreadyExisted) {
fs.mkdirSync(dir);
}
try {
// Copy files from template to project
emit('verbose', 'Copying assets.');
fs.copySync(import_from_path, dir);
} catch (e) {
if (!dirAlreadyExisted) {
fs.removeSync(dir);
}
throw e;
}
// It is impossible to deploy .gitignore files via npm packages.
// Instead, Cordova templates should include gitignore files that we
// rename to .gitignore here. For more details see
// https://github.com/apache/cordova-discuss/issues/69
globby.sync(['**/gitignore'], { cwd: dir, absolute: true })
.forEach(f =>
fs.moveSync(f, path.join(path.dirname(f), '.gitignore'))
);
// Write out id, name and version to config.xml
const configPath = path.join(dir, 'config.xml');
const conf = new ConfigParser(configPath);
conf.setPackageName(opts.id || conf.packageName() || 'com.example.cordova.app');
conf.setName(opts.name || conf.name() || 'Cordova Example App');
conf.setVersion(opts.version || conf.version() || '1.0.0');
conf.write();
// Copy values from config.xml to package.json
const pkgJsonPath = path.join(dir, 'package.json');
if (fs.existsSync(pkgJsonPath)) {
const pkgJson = requireFresh(pkgJsonPath);
Object.assign(pkgJson, {
name: conf.packageName().toLowerCase(),
displayName: conf.name(),
version: conf.version()
});
fs.writeJsonSync(pkgJsonPath, pkgJson, { spaces: 2 });
}
});
}
function getEventEmitter ({ events }) {
return events
? (...args) => events.emit(...args)
: () => {};
}
// Creates temp dir that is deleted on process exit
function getSelfDestructingTempDir () {
return tmp.dirSync({
prefix: 'cordova-create-',
unsafeCleanup: true
}).name;
}
function needsToBeFetched (uri) {
return npa(uri).type !== 'directory';
}

View File

@@ -0,0 +1,25 @@
/**
Create an array of unique values, in order, from the input arrays.
@example
```
import arrayUnion = require('array-union');
arrayUnion([1, 1, 2, 3], [2, 3]);
//=> [1, 2, 3]
arrayUnion(['foo', 'foo', 'bar']);
//=> ['foo', 'bar']
arrayUnion(['🐱', '🦄', '🐻'], ['🦄', '🌈']);
//=> ['🐱', '🦄', '🐻', '🌈']
arrayUnion(['🐱', '🦄'], ['🐻', '🦄'], ['🐶', '🌈', '🌈']);
//=> ['🐱', '🦄', '🐻', '🐶', '🌈']
```
*/
declare function arrayUnion<ArgumentsType extends readonly unknown[]>(
...arguments: readonly ArgumentsType[]
): ArgumentsType;
export = arrayUnion;

View File

@@ -0,0 +1,5 @@
'use strict';
module.exports = (...arguments_) => {
return [...new Set([].concat(...arguments_))];
};

View File

@@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,38 @@
{
"name": "array-union",
"version": "2.1.0",
"description": "Create an array of unique values, in order, from the input arrays",
"license": "MIT",
"repository": "sindresorhus/array-union",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=8"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"array",
"set",
"uniq",
"unique",
"duplicate",
"remove",
"union",
"combine",
"merge"
],
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
}
}

View File

@@ -0,0 +1,34 @@
# array-union [![Build Status](https://travis-ci.org/sindresorhus/array-union.svg?branch=master)](https://travis-ci.org/sindresorhus/array-union)
> Create an array of unique values, in order, from the input arrays
## Install
```
$ npm install array-union
```
## Usage
```js
const arrayUnion = require('array-union');
arrayUnion([1, 1, 2, 3], [2, 3]);
//=> [1, 2, 3]
arrayUnion(['foo', 'foo', 'bar']);
//=> ['foo', 'bar']
arrayUnion(['🐱', '🦄', '🐻'], ['🦄', '🌈']);
//=> ['🐱', '🦄', '🐻', '🌈']
arrayUnion(['🐱', '🦄'], ['🐻', '🦄'], ['🐶', '🌈', '🌈']);
//=> ['🐱', '🦄', '🐻', '🐶', '🌈']
```
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

View File

@@ -0,0 +1,120 @@
'use strict';
const {promisify} = require('util');
const fs = require('fs');
const path = require('path');
const fastGlob = require('fast-glob');
const gitIgnore = require('ignore');
const slash = require('slash');
const DEFAULT_IGNORE = [
'**/node_modules/**',
'**/flow-typed/**',
'**/coverage/**',
'**/.git'
];
const readFileP = promisify(fs.readFile);
const mapGitIgnorePatternTo = base => ignore => {
if (ignore.startsWith('!')) {
return '!' + path.posix.join(base, ignore.slice(1));
}
return path.posix.join(base, ignore);
};
const parseGitIgnore = (content, options) => {
const base = slash(path.relative(options.cwd, path.dirname(options.fileName)));
return content
.split(/\r?\n/)
.filter(Boolean)
.filter(line => !line.startsWith('#'))
.map(mapGitIgnorePatternTo(base));
};
const reduceIgnore = files => {
const ignores = gitIgnore();
for (const file of files) {
ignores.add(parseGitIgnore(file.content, {
cwd: file.cwd,
fileName: file.filePath
}));
}
return ignores;
};
const ensureAbsolutePathForCwd = (cwd, p) => {
cwd = slash(cwd);
if (path.isAbsolute(p)) {
if (slash(p).startsWith(cwd)) {
return p;
}
throw new Error(`Path ${p} is not in cwd ${cwd}`);
}
return path.join(cwd, p);
};
const getIsIgnoredPredecate = (ignores, cwd) => {
return p => ignores.ignores(slash(path.relative(cwd, ensureAbsolutePathForCwd(cwd, p.path || p))));
};
const getFile = async (file, cwd) => {
const filePath = path.join(cwd, file);
const content = await readFileP(filePath, 'utf8');
return {
cwd,
filePath,
content
};
};
const getFileSync = (file, cwd) => {
const filePath = path.join(cwd, file);
const content = fs.readFileSync(filePath, 'utf8');
return {
cwd,
filePath,
content
};
};
const normalizeOptions = ({
ignore = [],
cwd = slash(process.cwd())
} = {}) => {
return {ignore, cwd};
};
module.exports = async options => {
options = normalizeOptions(options);
const paths = await fastGlob('**/.gitignore', {
ignore: DEFAULT_IGNORE.concat(options.ignore),
cwd: options.cwd
});
const files = await Promise.all(paths.map(file => getFile(file, options.cwd)));
const ignores = reduceIgnore(files);
return getIsIgnoredPredecate(ignores, options.cwd);
};
module.exports.sync = options => {
options = normalizeOptions(options);
const paths = fastGlob.sync('**/.gitignore', {
ignore: DEFAULT_IGNORE.concat(options.ignore),
cwd: options.cwd
});
const files = paths.map(file => getFileSync(file, options.cwd));
const ignores = reduceIgnore(files);
return getIsIgnoredPredecate(ignores, options.cwd);
};

View File

@@ -0,0 +1,186 @@
import {Options as FastGlobOptions, Entry as FastGlobEntry} from 'fast-glob';
declare namespace globby {
type ExpandDirectoriesOption =
| boolean
| readonly string[]
| {files?: readonly string[]; extensions?: readonly string[]};
type Entry = FastGlobEntry;
interface GlobbyOptions extends FastGlobOptions {
/**
If set to `true`, `globby` will automatically glob directories for you. If you define an `Array` it will only glob files that matches the patterns inside the `Array`. You can also define an `Object` with `files` and `extensions` like in the example below.
Note that if you set this option to `false`, you won't get back matched directories unless you set `onlyFiles: false`.
@default true
@example
```
import globby = require('globby');
(async () => {
const paths = await globby('images', {
expandDirectories: {
files: ['cat', 'unicorn', '*.jpg'],
extensions: ['png']
}
});
console.log(paths);
//=> ['cat.png', 'unicorn.png', 'cow.jpg', 'rainbow.jpg']
})();
```
*/
readonly expandDirectories?: ExpandDirectoriesOption;
/**
Respect ignore patterns in `.gitignore` files that apply to the globbed files.
@default false
*/
readonly gitignore?: boolean;
}
interface GlobTask {
readonly pattern: string;
readonly options: GlobbyOptions;
}
interface GitignoreOptions {
readonly cwd?: string;
readonly ignore?: readonly string[];
}
type FilterFunction = (path: string) => boolean;
}
interface Gitignore {
/**
@returns A filter function indicating whether a given path is ignored via a `.gitignore` file.
*/
sync: (options?: globby.GitignoreOptions) => globby.FilterFunction;
/**
`.gitignore` files matched by the ignore config are not used for the resulting filter function.
@returns A filter function indicating whether a given path is ignored via a `.gitignore` file.
@example
```
import {gitignore} from 'globby';
(async () => {
const isIgnored = await gitignore();
console.log(isIgnored('some/file'));
})();
```
*/
(options?: globby.GitignoreOptions): Promise<globby.FilterFunction>;
}
declare const globby: {
/**
Find files and directories using glob patterns.
Note that glob patterns can only contain forward-slashes, not backward-slashes, so if you want to construct a glob pattern from path components, you need to use `path.posix.join()` instead of `path.join()`.
@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).
@param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3) in addition to the ones in this package.
@returns The matching paths.
*/
sync: ((
patterns: string | readonly string[],
options: globby.GlobbyOptions & {objectMode: true}
) => globby.Entry[]) & ((
patterns: string | readonly string[],
options?: globby.GlobbyOptions
) => string[]);
/**
Find files and directories using glob patterns.
Note that glob patterns can only contain forward-slashes, not backward-slashes, so if you want to construct a glob pattern from path components, you need to use `path.posix.join()` instead of `path.join()`.
@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).
@param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3) in addition to the ones in this package.
@returns The stream of matching paths.
@example
```
import globby = require('globby');
(async () => {
for await (const path of globby.stream('*.tmp')) {
console.log(path);
}
})();
```
*/
stream: (
patterns: string | readonly string[],
options?: globby.GlobbyOptions
) => NodeJS.ReadableStream;
/**
Note that you should avoid running the same tasks multiple times as they contain a file system cache. Instead, run this method each time to ensure file system changes are taken into consideration.
@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).
@param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3) in addition to the ones in this package.
@returns An object in the format `{pattern: string, options: object}`, which can be passed as arguments to [`fast-glob`](https://github.com/mrmlnc/fast-glob). This is useful for other globbing-related packages.
*/
generateGlobTasks: (
patterns: string | readonly string[],
options?: globby.GlobbyOptions
) => globby.GlobTask[];
/**
Note that the options affect the results.
This function is backed by [`fast-glob`](https://github.com/mrmlnc/fast-glob#isdynamicpatternpattern-options).
@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).
@param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3).
@returns Whether there are any special glob characters in the `patterns`.
*/
hasMagic: (
patterns: string | readonly string[],
options?: FastGlobOptions
) => boolean;
readonly gitignore: Gitignore;
(
patterns: string | readonly string[],
options: globby.GlobbyOptions & {objectMode: true}
): Promise<globby.Entry[]>;
/**
Find files and directories using glob patterns.
Note that glob patterns can only contain forward-slashes, not backward-slashes, so if you want to construct a glob pattern from path components, you need to use `path.posix.join()` instead of `path.join()`.
@param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).
@param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3) in addition to the ones in this package.
@returns The matching paths.
@example
```
import globby = require('globby');
(async () => {
const paths = await globby(['*', '!cake']);
console.log(paths);
//=> ['unicorn', 'rainbow']
})();
```
*/
(
patterns: string | readonly string[],
options?: globby.GlobbyOptions
): Promise<string[]>;
};
export = globby;

View File

@@ -0,0 +1,181 @@
'use strict';
const fs = require('fs');
const arrayUnion = require('array-union');
const merge2 = require('merge2');
const fastGlob = require('fast-glob');
const dirGlob = require('dir-glob');
const gitignore = require('./gitignore');
const {FilterStream, UniqueStream} = require('./stream-utils');
const DEFAULT_FILTER = () => false;
const isNegative = pattern => pattern[0] === '!';
const assertPatternsInput = patterns => {
if (!patterns.every(pattern => typeof pattern === 'string')) {
throw new TypeError('Patterns must be a string or an array of strings');
}
};
const checkCwdOption = (options = {}) => {
if (!options.cwd) {
return;
}
let stat;
try {
stat = fs.statSync(options.cwd);
} catch {
return;
}
if (!stat.isDirectory()) {
throw new Error('The `cwd` option must be a path to a directory');
}
};
const getPathString = p => p.stats instanceof fs.Stats ? p.path : p;
const generateGlobTasks = (patterns, taskOptions) => {
patterns = arrayUnion([].concat(patterns));
assertPatternsInput(patterns);
checkCwdOption(taskOptions);
const globTasks = [];
taskOptions = {
ignore: [],
expandDirectories: true,
...taskOptions
};
for (const [index, pattern] of patterns.entries()) {
if (isNegative(pattern)) {
continue;
}
const ignore = patterns
.slice(index)
.filter(pattern => isNegative(pattern))
.map(pattern => pattern.slice(1));
const options = {
...taskOptions,
ignore: taskOptions.ignore.concat(ignore)
};
globTasks.push({pattern, options});
}
return globTasks;
};
const globDirs = (task, fn) => {
let options = {};
if (task.options.cwd) {
options.cwd = task.options.cwd;
}
if (Array.isArray(task.options.expandDirectories)) {
options = {
...options,
files: task.options.expandDirectories
};
} else if (typeof task.options.expandDirectories === 'object') {
options = {
...options,
...task.options.expandDirectories
};
}
return fn(task.pattern, options);
};
const getPattern = (task, fn) => task.options.expandDirectories ? globDirs(task, fn) : [task.pattern];
const getFilterSync = options => {
return options && options.gitignore ?
gitignore.sync({cwd: options.cwd, ignore: options.ignore}) :
DEFAULT_FILTER;
};
const globToTask = task => glob => {
const {options} = task;
if (options.ignore && Array.isArray(options.ignore) && options.expandDirectories) {
options.ignore = dirGlob.sync(options.ignore);
}
return {
pattern: glob,
options
};
};
module.exports = async (patterns, options) => {
const globTasks = generateGlobTasks(patterns, options);
const getFilter = async () => {
return options && options.gitignore ?
gitignore({cwd: options.cwd, ignore: options.ignore}) :
DEFAULT_FILTER;
};
const getTasks = async () => {
const tasks = await Promise.all(globTasks.map(async task => {
const globs = await getPattern(task, dirGlob);
return Promise.all(globs.map(globToTask(task)));
}));
return arrayUnion(...tasks);
};
const [filter, tasks] = await Promise.all([getFilter(), getTasks()]);
const paths = await Promise.all(tasks.map(task => fastGlob(task.pattern, task.options)));
return arrayUnion(...paths).filter(path_ => !filter(getPathString(path_)));
};
module.exports.sync = (patterns, options) => {
const globTasks = generateGlobTasks(patterns, options);
const tasks = [];
for (const task of globTasks) {
const newTask = getPattern(task, dirGlob.sync).map(globToTask(task));
tasks.push(...newTask);
}
const filter = getFilterSync(options);
let matches = [];
for (const task of tasks) {
matches = arrayUnion(matches, fastGlob.sync(task.pattern, task.options));
}
return matches.filter(path_ => !filter(path_));
};
module.exports.stream = (patterns, options) => {
const globTasks = generateGlobTasks(patterns, options);
const tasks = [];
for (const task of globTasks) {
const newTask = getPattern(task, dirGlob.sync).map(globToTask(task));
tasks.push(...newTask);
}
const filter = getFilterSync(options);
const filterStream = new FilterStream(p => !filter(p));
const uniqueStream = new UniqueStream();
return merge2(tasks.map(task => fastGlob.stream(task.pattern, task.options)))
.pipe(filterStream)
.pipe(uniqueStream);
};
module.exports.generateGlobTasks = generateGlobTasks;
module.exports.hasMagic = (patterns, options) => []
.concat(patterns)
.some(pattern => fastGlob.isDynamicPattern(pattern, options));
module.exports.gitignore = gitignore;

View File

@@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,82 @@
{
"name": "globby",
"version": "11.1.0",
"description": "User-friendly glob matching",
"license": "MIT",
"repository": "sindresorhus/globby",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"email": "sindresorhus@gmail.com",
"name": "Sindre Sorhus",
"url": "https://sindresorhus.com"
},
"engines": {
"node": ">=10"
},
"scripts": {
"bench": "npm update glob-stream fast-glob && matcha bench.js",
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts",
"gitignore.js",
"stream-utils.js"
],
"keywords": [
"all",
"array",
"directories",
"expand",
"files",
"filesystem",
"filter",
"find",
"fnmatch",
"folders",
"fs",
"glob",
"globbing",
"globs",
"gulpfriendly",
"match",
"matcher",
"minimatch",
"multi",
"multiple",
"paths",
"pattern",
"patterns",
"traverse",
"util",
"utility",
"wildcard",
"wildcards",
"promise",
"gitignore",
"git"
],
"dependencies": {
"array-union": "^2.1.0",
"dir-glob": "^3.0.1",
"fast-glob": "^3.2.9",
"ignore": "^5.2.0",
"merge2": "^1.4.1",
"slash": "^3.0.0"
},
"devDependencies": {
"ava": "^3.13.0",
"get-stream": "^6.0.0",
"glob-stream": "^6.1.0",
"globby": "sindresorhus/globby#main",
"matcha": "^0.7.0",
"rimraf": "^3.0.2",
"tsd": "^0.13.1",
"xo": "^0.33.1"
},
"xo": {
"ignores": [
"fixtures"
]
}
}

View File

@@ -0,0 +1,170 @@
# globby
> User-friendly glob matching
Based on [`fast-glob`](https://github.com/mrmlnc/fast-glob) but adds a bunch of useful features.
## Features
- Promise API
- Multiple patterns
- Negated patterns: `['foo*', '!foobar']`
- Expands directories: `foo``foo/**/*`
- Supports `.gitignore`
## Install
```
$ npm install globby
```
## Usage
```
├── unicorn
├── cake
└── rainbow
```
```js
const globby = require('globby');
(async () => {
const paths = await globby(['*', '!cake']);
console.log(paths);
//=> ['unicorn', 'rainbow']
})();
```
## API
Note that glob patterns can only contain forward-slashes, not backward-slashes, so if you want to construct a glob pattern from path components, you need to use `path.posix.join()` instead of `path.join()`.
### globby(patterns, options?)
Returns a `Promise<string[]>` of matching paths.
#### patterns
Type: `string | string[]`
See supported `minimatch` [patterns](https://github.com/isaacs/minimatch#usage).
#### options
Type: `object`
See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3) in addition to the ones below.
##### expandDirectories
Type: `boolean | string[] | object`\
Default: `true`
If set to `true`, `globby` will automatically glob directories for you. If you define an `Array` it will only glob files that matches the patterns inside the `Array`. You can also define an `object` with `files` and `extensions` like below:
```js
const globby = require('globby');
(async () => {
const paths = await globby('images', {
expandDirectories: {
files: ['cat', 'unicorn', '*.jpg'],
extensions: ['png']
}
});
console.log(paths);
//=> ['cat.png', 'unicorn.png', 'cow.jpg', 'rainbow.jpg']
})();
```
Note that if you set this option to `false`, you won't get back matched directories unless you set `onlyFiles: false`.
##### gitignore
Type: `boolean`\
Default: `false`
Respect ignore patterns in `.gitignore` files that apply to the globbed files.
### globby.sync(patterns, options?)
Returns `string[]` of matching paths.
### globby.stream(patterns, options?)
Returns a [`stream.Readable`](https://nodejs.org/api/stream.html#stream_readable_streams) of matching paths.
Since Node.js 10, [readable streams are iterable](https://nodejs.org/api/stream.html#stream_readable_symbol_asynciterator), so you can loop over glob matches in a [`for await...of` loop](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of) like this:
```js
const globby = require('globby');
(async () => {
for await (const path of globby.stream('*.tmp')) {
console.log(path);
}
})();
```
### globby.generateGlobTasks(patterns, options?)
Returns an `object[]` in the format `{pattern: string, options: Object}`, which can be passed as arguments to [`fast-glob`](https://github.com/mrmlnc/fast-glob). This is useful for other globbing-related packages.
Note that you should avoid running the same tasks multiple times as they contain a file system cache. Instead, run this method each time to ensure file system changes are taken into consideration.
### globby.hasMagic(patterns, options?)
Returns a `boolean` of whether there are any special glob characters in the `patterns`.
Note that the options affect the results.
This function is backed by [`fast-glob`](https://github.com/mrmlnc/fast-glob#isdynamicpatternpattern-options).
### globby.gitignore(options?)
Returns a `Promise<(path: string) => boolean>` indicating whether a given path is ignored via a `.gitignore` file.
Takes `cwd?: string` and `ignore?: string[]` as options. `.gitignore` files matched by the ignore config are not used for the resulting filter function.
```js
const {gitignore} = require('globby');
(async () => {
const isIgnored = await gitignore();
console.log(isIgnored('some/file'));
})();
```
### globby.gitignore.sync(options?)
Returns a `(path: string) => boolean` indicating whether a given path is ignored via a `.gitignore` file.
Takes the same options as `globby.gitignore`.
## Globbing patterns
Just a quick overview.
- `*` matches any number of characters, but not `/`
- `?` matches a single character, but not `/`
- `**` matches any number of characters, including `/`, as long as it's the only thing in a path part
- `{}` allows for a comma-separated list of "or" expressions
- `!` at the beginning of a pattern will negate the match
[Various patterns and expected matches.](https://github.com/sindresorhus/multimatch/blob/main/test/test.js)
## globby for enterprise
Available as part of the Tidelift Subscription.
The maintainers of globby and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-globby?utm_source=npm-globby&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
## Related
- [multimatch](https://github.com/sindresorhus/multimatch) - Match against a list instead of the filesystem
- [matcher](https://github.com/sindresorhus/matcher) - Simple wildcard matching
- [del](https://github.com/sindresorhus/del) - Delete files and directories
- [make-dir](https://github.com/sindresorhus/make-dir) - Make a directory and its parents if needed

View File

@@ -0,0 +1,46 @@
'use strict';
const {Transform} = require('stream');
class ObjectTransform extends Transform {
constructor() {
super({
objectMode: true
});
}
}
class FilterStream extends ObjectTransform {
constructor(filter) {
super();
this._filter = filter;
}
_transform(data, encoding, callback) {
if (this._filter(data)) {
this.push(data);
}
callback();
}
}
class UniqueStream extends ObjectTransform {
constructor() {
super();
this._pushed = new Set();
}
_transform(data, encoding, callback) {
if (!this._pushed.has(data)) {
this.push(data);
this._pushed.add(data);
}
callback();
}
}
module.exports = {
FilterStream,
UniqueStream
};

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014-2017, Jon Schlinkert.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,127 @@
# isobject [![NPM version](https://img.shields.io/npm/v/isobject.svg?style=flat)](https://www.npmjs.com/package/isobject) [![NPM monthly downloads](https://img.shields.io/npm/dm/isobject.svg?style=flat)](https://npmjs.org/package/isobject) [![NPM total downloads](https://img.shields.io/npm/dt/isobject.svg?style=flat)](https://npmjs.org/package/isobject) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/isobject.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/isobject)
> Returns true if the value is an object and not an array or null.
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save isobject
```
Use [is-plain-object](https://github.com/jonschlinkert/is-plain-object) if you want only objects that are created by the `Object` constructor.
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install isobject
```
## Usage
```js
import isObject from 'isobject';
```
**True**
All of the following return `true`:
```js
isObject({});
isObject(Object.create({}));
isObject(Object.create(Object.prototype));
isObject(Object.create(null));
isObject({});
isObject(new Foo);
isObject(/foo/);
```
**False**
All of the following return `false`:
```js
isObject();
isObject(function () {});
isObject(1);
isObject([]);
isObject(undefined);
isObject(null);
```
## About
<details>
<summary><strong>Contributing</strong></summary>
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
</details>
<details>
<summary><strong>Running Tests</strong></summary>
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
```sh
$ npm install && npm test
```
</details>
<details>
<summary><strong>Building docs</strong></summary>
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
To generate the readme, run the following command:
```sh
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```
</details>
### Related projects
You might also be interested in these projects:
* [extend-shallow](https://www.npmjs.com/package/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. | [homepage](https://github.com/jonschlinkert/extend-shallow "Extend an object with the properties of additional objects. node.js/javascript util.")
* [is-plain-object](https://www.npmjs.com/package/is-plain-object): Returns true if an object was created by the `Object` constructor. | [homepage](https://github.com/jonschlinkert/is-plain-object "Returns true if an object was created by the `Object` constructor.")
* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of "Get the native type of a value.")
* [merge-deep](https://www.npmjs.com/package/merge-deep): Recursively merge values in a javascript object. | [homepage](https://github.com/jonschlinkert/merge-deep "Recursively merge values in a javascript object.")
### Contributors
| **Commits** | **Contributor** |
| --- | --- |
| 30 | [jonschlinkert](https://github.com/jonschlinkert) |
| 8 | [doowb](https://github.com/doowb) |
| 7 | [TrySound](https://github.com/TrySound) |
| 3 | [onokumus](https://github.com/onokumus) |
| 1 | [LeSuisse](https://github.com/LeSuisse) |
| 1 | [tmcw](https://github.com/tmcw) |
| 1 | [ZhouHansen](https://github.com/ZhouHansen) |
### Author
**Jon Schlinkert**
* [GitHub Profile](https://github.com/jonschlinkert)
* [Twitter Profile](https://twitter.com/jonschlinkert)
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
### License
Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).
***
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on April 28, 2019._

View File

@@ -0,0 +1,14 @@
'use strict';
/*!
* isobject <https://github.com/jonschlinkert/isobject>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
function isObject(val) {
return val != null && typeof val === 'object' && Array.isArray(val) === false;
}
module.exports = isObject;

View File

@@ -0,0 +1,3 @@
declare function isObject(val: any): boolean;
export default isObject;

View File

@@ -0,0 +1,10 @@
/*!
* isobject <https://github.com/jonschlinkert/isobject>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
export default function isObject(val) {
return val != null && typeof val === 'object' && Array.isArray(val) === false;
};

View File

@@ -0,0 +1,80 @@
{
"name": "isobject",
"description": "Returns true if the value is an object and not an array or null.",
"version": "4.0.0",
"homepage": "https://github.com/jonschlinkert/isobject",
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
"contributors": [
"(https://github.com/LeSuisse)",
"Brian Woodward (https://twitter.com/doowb)",
"Jon Schlinkert (http://twitter.com/jonschlinkert)",
"Magnús Dæhlen (https://github.com/magnudae)",
"Tom MacWright (https://macwright.org)"
],
"repository": "jonschlinkert/isobject",
"bugs": {
"url": "https://github.com/jonschlinkert/isobject/issues"
},
"license": "MIT",
"files": [
"index.d.ts",
"index.cjs.js",
"index.js"
],
"main": "index.cjs.js",
"module": "index.js",
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"build": "rollup -i index.js -o index.cjs.js -f cjs",
"test": "mocha -r esm",
"prepublish": "npm run build"
},
"dependencies": {},
"devDependencies": {
"esm": "^3.2.22",
"gulp-format-md": "^0.1.9",
"mocha": "^2.4.5",
"rollup": "^1.10.1"
},
"keywords": [
"check",
"is",
"is-object",
"isobject",
"kind",
"kind-of",
"kindof",
"native",
"object",
"type",
"typeof",
"value"
],
"types": "index.d.ts",
"verb": {
"related": {
"list": [
"extend-shallow",
"is-plain-object",
"kind-of",
"merge-deep"
]
},
"toc": false,
"layout": "default",
"tasks": [
"readme"
],
"plugins": [
"gulp-format-md"
],
"lint": {
"reflinks": true
},
"reflinks": [
"verb"
]
}
}

54
spa/node_modules/cordova-create/package.json generated vendored Normal file
View File

@@ -0,0 +1,54 @@
{
"name": "cordova-create",
"version": "5.0.0",
"description": "Apache Cordova create module. Creates new project from default or template",
"main": "index.js",
"repository": "github:apache/cordova-create",
"bugs": "https://github.com/apache/cordova-create/issues",
"keywords": [
"cordova",
"create",
"apache",
"ecosystem:cordova",
"cordova:tool"
],
"author": "Apache Software Foundation",
"license": "Apache-2.0",
"engines": {
"node": ">=16.13.0"
},
"dependencies": {
"cordova-app-hello-world": "^6.0.0",
"cordova-common": "^5.0.0",
"cordova-fetch": "^4.0.0",
"fs-extra": "^11.1.1",
"globby": "^11.1.0",
"import-fresh": "^3.3.0",
"isobject": "^4.0.0",
"npm-package-arg": "^10.1.0",
"path-is-inside": "^1.0.2",
"tmp": "^0.2.1",
"valid-identifier": "0.0.2"
},
"devDependencies": {
"@cordova/eslint-config": "^5.0.0",
"jasmine": "^4.6.0",
"nyc": "^15.1.0",
"rewire": "^6.0.0"
},
"scripts": {
"test": "npm run lint && npm run cover",
"lint": "eslint .",
"jasmine": "jasmine \"spec/**/*.spec.js\"",
"cover": "nyc npm run jasmine"
},
"nyc": {
"include": [
"index.js"
],
"reporter": [
"lcov",
"text"
]
}
}