Import Debian changes 3.2.0+~cs4.2.0-ok1
node-ci-info (3.2.0+~cs4.2.0-ok1) yangtze; urgency=medium * Build for openKylin.
This commit is contained in:
parent
24739b1998
commit
b29222f7c4
|
@ -0,0 +1,5 @@
|
||||||
|
node-ci-info (3.2.0+~cs4.2.0-ok1) yangtze; urgency=medium
|
||||||
|
|
||||||
|
* Build for openKylin.
|
||||||
|
|
||||||
|
-- zhouganqing <zhouganqing@kylinos.cn> Fri, 17 Feb 2023 09:37:22 +0800
|
|
@ -0,0 +1,32 @@
|
||||||
|
Source: node-ci-info
|
||||||
|
Section: javascript
|
||||||
|
Priority: optional
|
||||||
|
Maintainer: OpenKylin Developers <packaging@lists.openkylin.top>
|
||||||
|
Build-Depends: debhelper-compat (= 13)
|
||||||
|
, nodejs
|
||||||
|
, node-resolve-from
|
||||||
|
, node-tape <!nocheck>
|
||||||
|
, dh-sequence-nodejs
|
||||||
|
Standards-Version: 4.5.1
|
||||||
|
Vcs-Browser: https://gitee.com/openkylin/node-ci-info
|
||||||
|
Vcs-Git: https://gitee.com/openkylin/node-ci-info.git
|
||||||
|
Homepage: https://github.com/watson/ci-info
|
||||||
|
Testsuite: autopkgtest-pkg-nodejs
|
||||||
|
Rules-Requires-Root: no
|
||||||
|
|
||||||
|
Package: node-ci-info
|
||||||
|
Architecture: all
|
||||||
|
Depends: ${misc:Depends}
|
||||||
|
Provides: ${nodejs:Provides}
|
||||||
|
Breaks: mocha (<< 9.1.0~)
|
||||||
|
Multi-Arch: foreign
|
||||||
|
Description: Get details about the current Continuous Integration environment
|
||||||
|
Lets you check whether you are running in a continuous integration server
|
||||||
|
and fetches the name of the CI service.
|
||||||
|
Supported CI:
|
||||||
|
Travis CI, CircleCI, Jenkins CI, Hudson,
|
||||||
|
Bamboo by Atlassian, TeamCity by JetBrains,
|
||||||
|
Team Foundation Server by Microsoft,
|
||||||
|
GitLab CI, Codeship, Drone, Magnum CI,
|
||||||
|
Semaphore, AppVeyor, Buildkite,
|
||||||
|
TaskCluster, GoCD, Bitbucket Pipelines
|
|
@ -0,0 +1,45 @@
|
||||||
|
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||||
|
Upstream-Name: ci-info
|
||||||
|
Upstream-Contact: https://github.com/watson/ci-info/issues
|
||||||
|
Source: https://github.com/watson/ci-info
|
||||||
|
https://registry.npmjs.org/@types/ci-info
|
||||||
|
https://github.com/sindresorhus/is-interactive/tags
|
||||||
|
https://github.com/sindresorhus/is-unicode-supported/tags
|
||||||
|
|
||||||
|
Files: *
|
||||||
|
Copyright: 2016-2018 Thomas Watson Steen <w@tson.dk> (https://twitter.com/wa7son)
|
||||||
|
License: Expat
|
||||||
|
|
||||||
|
Files: debian/*
|
||||||
|
Copyright: 2017 Siddhesh Rane <kingsid911@gmail.com>
|
||||||
|
2020 Xavier Guimard <yadd@debian.org>
|
||||||
|
License: Expat
|
||||||
|
|
||||||
|
Files: debian/tests/test_modules/* is-interactive/* is-unicode-supported/*
|
||||||
|
Copyright: Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||||
|
License: Expat
|
||||||
|
|
||||||
|
Files: types-ci-info/*
|
||||||
|
Copyright: Microsoft Corporation
|
||||||
|
License: Expat
|
||||||
|
|
||||||
|
License: Expat
|
||||||
|
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.
|
|
@ -0,0 +1 @@
|
||||||
|
README.md
|
|
@ -0,0 +1,6 @@
|
||||||
|
[DEFAULT]
|
||||||
|
pristine-tar=True
|
||||||
|
component=['types-ci-info', 'is-interactive', 'is-unicode-supported']
|
||||||
|
|
||||||
|
[import-orig]
|
||||||
|
filter=[ '.gitignore', '.travis.yml', '.git*' ]
|
|
@ -0,0 +1 @@
|
||||||
|
*
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/make -f
|
||||||
|
# -*- makefile -*-
|
||||||
|
|
||||||
|
# Uncomment this to turn on verbose mode.
|
||||||
|
#export DH_VERBOSE=1
|
||||||
|
|
||||||
|
%:
|
||||||
|
dh $@
|
|
@ -0,0 +1 @@
|
||||||
|
3.0 (quilt)
|
|
@ -0,0 +1 @@
|
||||||
|
tape test.js
|
|
@ -0,0 +1,18 @@
|
||||||
|
'use strict';
|
||||||
|
const callsites = require('callsites');
|
||||||
|
|
||||||
|
module.exports = () => {
|
||||||
|
const c = callsites();
|
||||||
|
let caller;
|
||||||
|
|
||||||
|
for (let i = 0; i < c.length; i++) {
|
||||||
|
const hasReceiver = c[i].getTypeName() !== null;
|
||||||
|
|
||||||
|
if (hasReceiver) {
|
||||||
|
caller = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return c[caller];
|
||||||
|
};
|
|
@ -0,0 +1,21 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
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.
|
|
@ -0,0 +1,44 @@
|
||||||
|
{
|
||||||
|
"name": "caller-callsite",
|
||||||
|
"version": "2.0.0",
|
||||||
|
"description": "Get the callsite of the caller function",
|
||||||
|
"license": "MIT",
|
||||||
|
"repository": "sindresorhus/caller-callsite",
|
||||||
|
"author": {
|
||||||
|
"name": "Sindre Sorhus",
|
||||||
|
"email": "sindresorhus@gmail.com",
|
||||||
|
"url": "sindresorhus.com"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "xo && ava"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js"
|
||||||
|
],
|
||||||
|
"keywords": [
|
||||||
|
"caller",
|
||||||
|
"calling",
|
||||||
|
"module",
|
||||||
|
"parent",
|
||||||
|
"callsites",
|
||||||
|
"callsite",
|
||||||
|
"stacktrace",
|
||||||
|
"stack",
|
||||||
|
"trace",
|
||||||
|
"function",
|
||||||
|
"file"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"callsites": "^2.0.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"ava": "*",
|
||||||
|
"xo": "*"
|
||||||
|
},
|
||||||
|
"xo": {
|
||||||
|
"esnext": true
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
# caller-callsite [![Build Status](https://travis-ci.org/sindresorhus/caller-callsite.svg?branch=master)](https://travis-ci.org/sindresorhus/caller-callsite)
|
||||||
|
|
||||||
|
> Get the [callsite](https://github.com/sindresorhus/callsites#api) of the caller function
|
||||||
|
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```
|
||||||
|
$ npm install --save caller-callsite
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
// foo.js
|
||||||
|
const callerCallsite = require('caller-callsite');
|
||||||
|
|
||||||
|
module.exports = () => {
|
||||||
|
console.log(callerCallsite().getFileName());
|
||||||
|
//=> '/Users/sindresorhus/dev/unicorn/bar.js'
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
|
// bar.js
|
||||||
|
const foo = require('./foo');
|
||||||
|
foo();
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### callerCallsite()
|
||||||
|
|
||||||
|
Returns a [`callsite`](https://github.com/sindresorhus/callsites#api) object.
|
||||||
|
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
|
@ -0,0 +1,4 @@
|
||||||
|
'use strict';
|
||||||
|
const callerCallsite = require('caller-callsite');
|
||||||
|
|
||||||
|
module.exports = () => callerCallsite().getFileName();
|
|
@ -0,0 +1,21 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
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.
|
|
@ -0,0 +1,45 @@
|
||||||
|
{
|
||||||
|
"name": "caller-path",
|
||||||
|
"version": "2.0.0",
|
||||||
|
"description": "Get the path of the caller function",
|
||||||
|
"license": "MIT",
|
||||||
|
"repository": "sindresorhus/caller-path",
|
||||||
|
"author": {
|
||||||
|
"name": "Sindre Sorhus",
|
||||||
|
"email": "sindresorhus@gmail.com",
|
||||||
|
"url": "sindresorhus.com"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "xo && ava"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js"
|
||||||
|
],
|
||||||
|
"keywords": [
|
||||||
|
"caller",
|
||||||
|
"calling",
|
||||||
|
"module",
|
||||||
|
"path",
|
||||||
|
"parent",
|
||||||
|
"callsites",
|
||||||
|
"callsite",
|
||||||
|
"stacktrace",
|
||||||
|
"stack",
|
||||||
|
"trace",
|
||||||
|
"function",
|
||||||
|
"file"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"caller-callsite": "^2.0.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"ava": "*",
|
||||||
|
"xo": "*"
|
||||||
|
},
|
||||||
|
"xo": {
|
||||||
|
"esnext": true
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
# caller-path [![Build Status](https://travis-ci.org/sindresorhus/caller-path.svg?branch=master)](https://travis-ci.org/sindresorhus/caller-path)
|
||||||
|
|
||||||
|
> Get the path of the caller function
|
||||||
|
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```
|
||||||
|
$ npm install --save caller-path
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
// foo.js
|
||||||
|
const callerPath = require('caller-path');
|
||||||
|
|
||||||
|
module.exports = () => {
|
||||||
|
console.log(callerPath());
|
||||||
|
//=> '/Users/sindresorhus/dev/unicorn/bar.js'
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
|
// bar.js
|
||||||
|
const foo = require('./foo');
|
||||||
|
foo();
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
|
@ -0,0 +1,8 @@
|
||||||
|
'use strict';
|
||||||
|
module.exports = () => {
|
||||||
|
const _ = Error.prepareStackTrace;
|
||||||
|
Error.prepareStackTrace = (_, stack) => stack;
|
||||||
|
const stack = new Error().stack.slice(1);
|
||||||
|
Error.prepareStackTrace = _;
|
||||||
|
return stack;
|
||||||
|
};
|
|
@ -0,0 +1,21 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
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.
|
|
@ -0,0 +1,40 @@
|
||||||
|
{
|
||||||
|
"name": "callsites",
|
||||||
|
"version": "2.0.0",
|
||||||
|
"description": "Get callsites from the V8 stack trace API",
|
||||||
|
"license": "MIT",
|
||||||
|
"repository": "sindresorhus/callsites",
|
||||||
|
"author": {
|
||||||
|
"name": "Sindre Sorhus",
|
||||||
|
"email": "sindresorhus@gmail.com",
|
||||||
|
"url": "sindresorhus.com"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "xo && ava"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js"
|
||||||
|
],
|
||||||
|
"keywords": [
|
||||||
|
"stacktrace",
|
||||||
|
"v8",
|
||||||
|
"callsite",
|
||||||
|
"callsites",
|
||||||
|
"stack",
|
||||||
|
"trace",
|
||||||
|
"function",
|
||||||
|
"file",
|
||||||
|
"line",
|
||||||
|
"debug"
|
||||||
|
],
|
||||||
|
"devDependencies": {
|
||||||
|
"ava": "*",
|
||||||
|
"xo": "*"
|
||||||
|
},
|
||||||
|
"xo": {
|
||||||
|
"esnext": true
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
# callsites [![Build Status](https://travis-ci.org/sindresorhus/callsites.svg?branch=master)](https://travis-ci.org/sindresorhus/callsites)
|
||||||
|
|
||||||
|
> Get callsites from the [V8 stack trace API](https://github.com/v8/v8/wiki/Stack-Trace-API)
|
||||||
|
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```
|
||||||
|
$ npm install --save callsites
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
const callsites = require('callsites');
|
||||||
|
|
||||||
|
function unicorn() {
|
||||||
|
console.log(callsites()[0].getFileName());
|
||||||
|
//=> '/Users/sindresorhus/dev/callsites/test.js'
|
||||||
|
}
|
||||||
|
|
||||||
|
unicorn();
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
Returns an array of callsite objects with the following methods:
|
||||||
|
|
||||||
|
- `getTypeName`: returns the type of this as a string. This is the name of the function stored in the constructor field of this, if available, otherwise the object's [[Class]] internal property.
|
||||||
|
- `getFunctionName`: returns the name of the current function, typically its name property. If a name property is not available an attempt will be made to try to infer a name from the function's context.
|
||||||
|
- `getMethodName`: returns the name of the property of this or one of its prototypes that holds the current function
|
||||||
|
- `getFileName`: if this function was defined in a script returns the name of the script
|
||||||
|
- `getLineNumber`: if this function was defined in a script returns the current line number
|
||||||
|
- `getColumnNumber`: if this function was defined in a script returns the current column number
|
||||||
|
- `getEvalOrigin`: if this function was created using a call to eval returns a CallSite object representing the location where eval was called
|
||||||
|
- `isToplevel`: is this a top-level invocation, that is, is this the global object?
|
||||||
|
- `isEval`: does this call take place in code defined by a call to eval?
|
||||||
|
- `isNative`: is this call in native V8 code?
|
||||||
|
- `isConstructor`: is this a constructor call?
|
||||||
|
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
|
@ -0,0 +1,52 @@
|
||||||
|
declare const clear: {
|
||||||
|
/**
|
||||||
|
Clear a module from the [cache](https://nodejs.org/api/modules.html#modules_caching).
|
||||||
|
|
||||||
|
@param moduleId - What you would use with `require()`.
|
||||||
|
|
||||||
|
@example
|
||||||
|
```
|
||||||
|
// foo.ts
|
||||||
|
let i = 0;
|
||||||
|
module.exports = () => ++i;
|
||||||
|
|
||||||
|
// test.ts
|
||||||
|
import clearModule = require('clear-module');
|
||||||
|
|
||||||
|
require('./foo')();
|
||||||
|
//=> 1
|
||||||
|
|
||||||
|
require('./foo')();
|
||||||
|
//=> 2
|
||||||
|
|
||||||
|
clearModule('./foo');
|
||||||
|
|
||||||
|
require('./foo')();
|
||||||
|
//=> 1
|
||||||
|
```
|
||||||
|
*/
|
||||||
|
(moduleId: string): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Clear all modules from the cache.
|
||||||
|
*/
|
||||||
|
all(): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Clear all matching modules from the cache.
|
||||||
|
|
||||||
|
@param regex - Regex to match against the module IDs.
|
||||||
|
*/
|
||||||
|
match(regex: RegExp): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Clear a single module from the cache non-recursively. No parent or children modules will be affected.
|
||||||
|
|
||||||
|
This is mostly only useful if you use singletons, where you would want to clear a specific module without causing any side effects.
|
||||||
|
|
||||||
|
@param moduleId - What you would use with `require()`.
|
||||||
|
*/
|
||||||
|
single(moduleId: string): void;
|
||||||
|
};
|
||||||
|
|
||||||
|
export = clear;
|
|
@ -0,0 +1,71 @@
|
||||||
|
'use strict';
|
||||||
|
const path = require('path');
|
||||||
|
const resolveFrom = require('resolve-from');
|
||||||
|
const parentModule = require('parent-module');
|
||||||
|
|
||||||
|
const resolve = moduleId => {
|
||||||
|
try {
|
||||||
|
return resolveFrom(path.dirname(parentModule(__filename)), moduleId);
|
||||||
|
} catch (_) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
const clear = moduleId => {
|
||||||
|
if (typeof moduleId !== 'string') {
|
||||||
|
throw new TypeError(`Expected a \`string\`, got \`${typeof moduleId}\``);
|
||||||
|
}
|
||||||
|
|
||||||
|
const filePath = resolve(moduleId);
|
||||||
|
|
||||||
|
if (!filePath) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete itself from module parent
|
||||||
|
if (require.cache[filePath] && require.cache[filePath].parent) {
|
||||||
|
let i = require.cache[filePath].parent.children.length;
|
||||||
|
|
||||||
|
while (i--) {
|
||||||
|
if (require.cache[filePath].parent.children[i].id === filePath) {
|
||||||
|
require.cache[filePath].parent.children.splice(i, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove all descendants from cache as well
|
||||||
|
if (require.cache[filePath]) {
|
||||||
|
const {children} = require.cache[filePath];
|
||||||
|
|
||||||
|
// Delete module from cache
|
||||||
|
delete require.cache[filePath];
|
||||||
|
|
||||||
|
for (const {id} of children) {
|
||||||
|
clear(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
clear.all = () => {
|
||||||
|
const directory = path.dirname(parentModule(__filename));
|
||||||
|
|
||||||
|
for (const moduleId of Object.keys(require.cache)) {
|
||||||
|
delete require.cache[resolveFrom(directory, moduleId)];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
clear.match = regex => {
|
||||||
|
for (const moduleId of Object.keys(require.cache)) {
|
||||||
|
if (regex.test(moduleId)) {
|
||||||
|
clear(moduleId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
clear.single = moduleId => {
|
||||||
|
if (typeof moduleId !== 'string') {
|
||||||
|
throw new TypeError(`Expected a \`string\`, got \`${typeof moduleId}\``);
|
||||||
|
}
|
||||||
|
|
||||||
|
delete require.cache[resolve(moduleId)];
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = clear;
|
|
@ -0,0 +1,9 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://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.
|
|
@ -0,0 +1,47 @@
|
||||||
|
{
|
||||||
|
"name": "clear-module",
|
||||||
|
"version": "4.1.1",
|
||||||
|
"description": "Clear a module from the cache",
|
||||||
|
"license": "MIT",
|
||||||
|
"repository": "sindresorhus/clear-module",
|
||||||
|
"funding": "https://github.com/sponsors/sindresorhus",
|
||||||
|
"author": {
|
||||||
|
"name": "Sindre Sorhus",
|
||||||
|
"email": "sindresorhus@gmail.com",
|
||||||
|
"url": "https://sindresorhus.com"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "xo && ava && tsd"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js",
|
||||||
|
"index.d.ts"
|
||||||
|
],
|
||||||
|
"keywords": [
|
||||||
|
"clear",
|
||||||
|
"module",
|
||||||
|
"require",
|
||||||
|
"import",
|
||||||
|
"cache",
|
||||||
|
"uncache",
|
||||||
|
"uncached",
|
||||||
|
"unrequire",
|
||||||
|
"derequire",
|
||||||
|
"delete",
|
||||||
|
"remove",
|
||||||
|
"rm",
|
||||||
|
"fresh"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"parent-module": "^2.0.0",
|
||||||
|
"resolve-from": "^5.0.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"ava": "^2.1.0",
|
||||||
|
"tsd": "^0.7.2",
|
||||||
|
"xo": "^0.24.0"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
# clear-module [![Build Status](https://travis-ci.org/sindresorhus/clear-module.svg?branch=master)](https://travis-ci.org/sindresorhus/clear-module)
|
||||||
|
|
||||||
|
> Clear a module from the [cache](https://nodejs.org/api/modules.html#modules_caching)
|
||||||
|
|
||||||
|
Useful for testing purposes when you need to freshly import a module.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```
|
||||||
|
$ npm install clear-module
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
// foo.js
|
||||||
|
let i = 0;
|
||||||
|
module.exports = () => ++i;
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
|
const clearModule = require('clear-module');
|
||||||
|
|
||||||
|
require('./foo')();
|
||||||
|
//=> 1
|
||||||
|
|
||||||
|
require('./foo')();
|
||||||
|
//=> 2
|
||||||
|
|
||||||
|
clearModule('./foo');
|
||||||
|
|
||||||
|
require('./foo')();
|
||||||
|
//=> 1
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### clearModule(moduleId)
|
||||||
|
|
||||||
|
#### moduleId
|
||||||
|
|
||||||
|
Type: `string`
|
||||||
|
|
||||||
|
What you would use with `require()`.
|
||||||
|
|
||||||
|
### clearModule.all()
|
||||||
|
|
||||||
|
Clear all modules from the cache.
|
||||||
|
|
||||||
|
### clearModule.match(regex)
|
||||||
|
|
||||||
|
Clear all matching modules from the cache.
|
||||||
|
|
||||||
|
#### regex
|
||||||
|
|
||||||
|
Type: `RegExp`
|
||||||
|
|
||||||
|
Regex to match against the module IDs.
|
||||||
|
|
||||||
|
### clearModule.single(moduleId)
|
||||||
|
|
||||||
|
Clear a single module from the cache non-recursively. No parent or children modules will be affected.
|
||||||
|
|
||||||
|
This is mostly only useful if you use singletons, where you would want to clear a specific module without causing any side effects.
|
||||||
|
|
||||||
|
#### moduleId
|
||||||
|
|
||||||
|
Type: `string`
|
||||||
|
|
||||||
|
What you would use with `require()`.
|
||||||
|
|
||||||
|
## Related
|
||||||
|
|
||||||
|
- [import-fresh](https://github.com/sindresorhus/import-fresh) - Import a module while bypassing the cache
|
||||||
|
- [import-from](https://github.com/sindresorhus/import-from) - Import a module from a given path
|
||||||
|
- [import-cwd](https://github.com/sindresorhus/import-cwd) - Import a module from the current working directory
|
||||||
|
- [import-lazy](https://github.com/sindresorhus/import-lazy) - Import a module lazily
|
|
@ -0,0 +1,28 @@
|
||||||
|
'use strict';
|
||||||
|
const path = require('path');
|
||||||
|
const resolveFrom = require('resolve-from');
|
||||||
|
const callerPath = require('caller-path');
|
||||||
|
|
||||||
|
const clear = moduleId => {
|
||||||
|
if (typeof moduleId !== 'string') {
|
||||||
|
throw new TypeError(`Expected a \`string\`, got \`${typeof moduleId}\``);
|
||||||
|
}
|
||||||
|
|
||||||
|
delete require.cache[resolveFrom(path.dirname(callerPath()), moduleId)];
|
||||||
|
};
|
||||||
|
|
||||||
|
clear.all = () => {
|
||||||
|
for (const moduleId of Object.keys(require.cache)) {
|
||||||
|
clear(moduleId);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
clear.match = regex => {
|
||||||
|
for (const moduleId of Object.keys(require.cache)) {
|
||||||
|
if (regex.test(moduleId)) {
|
||||||
|
clear(moduleId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = clear;
|
|
@ -0,0 +1,21 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
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.
|
|
@ -0,0 +1,43 @@
|
||||||
|
{
|
||||||
|
"name": "clear-require",
|
||||||
|
"version": "2.0.0",
|
||||||
|
"description": "Clear a module from the `require` cache",
|
||||||
|
"license": "MIT",
|
||||||
|
"repository": "sindresorhus/clear-require",
|
||||||
|
"author": {
|
||||||
|
"name": "Sindre Sorhus",
|
||||||
|
"email": "sindresorhus@gmail.com",
|
||||||
|
"url": "sindresorhus.com"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "xo && ava"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js"
|
||||||
|
],
|
||||||
|
"keywords": [
|
||||||
|
"clear",
|
||||||
|
"require",
|
||||||
|
"cache",
|
||||||
|
"uncache",
|
||||||
|
"uncached",
|
||||||
|
"module",
|
||||||
|
"unrequire",
|
||||||
|
"derequire",
|
||||||
|
"delete",
|
||||||
|
"del",
|
||||||
|
"remove",
|
||||||
|
"rm"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"caller-path": "^2.0.0",
|
||||||
|
"resolve-from": "^2.0.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"ava": "*",
|
||||||
|
"xo": "*"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,71 @@
|
||||||
|
# clear-require [![Build Status](https://travis-ci.org/sindresorhus/clear-require.svg?branch=master)](https://travis-ci.org/sindresorhus/clear-require)
|
||||||
|
|
||||||
|
> Clear a module from the [`require` cache](https://nodejs.org/api/modules.html#modules_caching)
|
||||||
|
|
||||||
|
Useful for testing purposes when you need to freshly `require` a module.
|
||||||
|
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```
|
||||||
|
$ npm install --save clear-require
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```js
|
||||||
|
// foo.js
|
||||||
|
let i = 0;
|
||||||
|
module.exports = () => ++i;
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
|
const clearRequire = require('clear-require');
|
||||||
|
|
||||||
|
require('./foo')();
|
||||||
|
//=> 1
|
||||||
|
|
||||||
|
require('./foo')();
|
||||||
|
//=> 2
|
||||||
|
|
||||||
|
clearRequire('./foo');
|
||||||
|
|
||||||
|
require('./foo')();
|
||||||
|
//=> 1
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### clearRequire(moduleId)
|
||||||
|
|
||||||
|
#### moduleId
|
||||||
|
|
||||||
|
Type: `string`
|
||||||
|
|
||||||
|
What you would use with `require()`.
|
||||||
|
|
||||||
|
### clearRequire.all()
|
||||||
|
|
||||||
|
Clear all modules from the `require` cache.
|
||||||
|
|
||||||
|
### clearRequire.match(regex)
|
||||||
|
|
||||||
|
Clear all matching modules from the `require` cache.
|
||||||
|
|
||||||
|
#### regex
|
||||||
|
|
||||||
|
Type: `RegExp`
|
||||||
|
|
||||||
|
Regex to match against the module ID's.
|
||||||
|
|
||||||
|
|
||||||
|
## Related
|
||||||
|
|
||||||
|
- [require-uncached](https://github.com/sindresorhus/require-uncached) - Require a module bypassing the cache
|
||||||
|
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
|
@ -0,0 +1,24 @@
|
||||||
|
version=4
|
||||||
|
opts=\
|
||||||
|
dversionmangle=s/\+(debian|dfsg|ds|deb)(\.\d+)?$//,\
|
||||||
|
filenamemangle=s/.*\/v?([\d\.-]+)\.tar\.gz/node-ci-info-$1.tar.gz/ \
|
||||||
|
https://github.com/watson/ci-info/tags .*/archive.*/v?([\d\.]+).tar.gz group
|
||||||
|
|
||||||
|
# It is not recommended use npmregistry. Please investigate more.
|
||||||
|
# Take a look at https://wiki.debian.org/debian/watch/
|
||||||
|
opts="searchmode=plain,component=types-ci-info,pgpmode=none" \
|
||||||
|
https://registry.npmjs.org/@types/ci-info https://registry.npmjs.org/@types/ci-info/-/ci-info-([\d\.]+)@ARCHIVE_EXT@ checksum
|
||||||
|
|
||||||
|
opts=\
|
||||||
|
component=is-interactive,\
|
||||||
|
ctype=nodejs,\
|
||||||
|
dversionmangle=auto,\
|
||||||
|
filenamemangle=s/.*\/v?([\d\.-]+)\.tar\.gz/node-is-interactive-$1.tar.gz/ \
|
||||||
|
https://github.com/sindresorhus/is-interactive/tags .*/archive.*/v?(1[\d\.]+).tar.gz checksum
|
||||||
|
|
||||||
|
opts=\
|
||||||
|
component=is-unicode-supported,\
|
||||||
|
ctype=nodejs,\
|
||||||
|
dversionmangle=auto,\
|
||||||
|
filenamemangle=s/.*\/v?([\d\.-]+)\.tar\.gz/node-is-unicode-supported-$1.tar.gz/ \
|
||||||
|
https://github.com/sindresorhus/is-unicode-supported/tags .*/archive.*/v?(0[\d\.]+).tar.gz checksum
|
Loading…
Reference in New Issue