mirror of
https://github.com/github/codeql-action.git
synced 2025-12-09 17:28:06 +08:00
Compare commits
50 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1a927e9307 | ||
|
|
bbb9c53c65 | ||
|
|
3a741b6cf5 | ||
|
|
1498bce660 | ||
|
|
c260382f36 | ||
|
|
6410c0691e | ||
|
|
c337e5f2f3 | ||
|
|
9673b562d9 | ||
|
|
bc4366e948 | ||
|
|
3b831aafd9 | ||
|
|
14b1fecf33 | ||
|
|
5e23536180 | ||
|
|
5f30e2466f | ||
|
|
05981c5829 | ||
|
|
486633d442 | ||
|
|
d6360c9075 | ||
|
|
d3a0787934 | ||
|
|
e13c8bbfb7 | ||
|
|
1c9a1f5d01 | ||
|
|
1f7dab4ba2 | ||
|
|
8a36468d11 | ||
|
|
f8c38c1af3 | ||
|
|
10249d1591 | ||
|
|
e6bcd71529 | ||
|
|
806fc12eb2 | ||
|
|
ba352d365b | ||
|
|
751af2a9e3 | ||
|
|
1a686e7d76 | ||
|
|
0479586f61 | ||
|
|
708446c6e4 | ||
|
|
392316b555 | ||
|
|
5604c0a3ad | ||
|
|
7d8ca8fa93 | ||
|
|
8b37404d56 | ||
|
|
c180f23bb1 | ||
|
|
a7adbce22c | ||
|
|
3b4e4d44dc | ||
|
|
f18151cc59 | ||
|
|
e175dea369 | ||
|
|
752ae5743f | ||
|
|
0dabead789 | ||
|
|
5e69ce82f8 | ||
|
|
fdb92bbffe | ||
|
|
14b4839253 | ||
|
|
d76304cd8e | ||
|
|
57c4e974c2 | ||
|
|
c2fb041dc1 | ||
|
|
ac9d34fbc6 | ||
|
|
c8290d07f0 | ||
|
|
51126e5cd1 |
12
CHANGELOG.md
12
CHANGELOG.md
@@ -1,5 +1,15 @@
|
||||
# CodeQL Action and CodeQL Runner Changelog
|
||||
|
||||
## 1.0.31 - 31 Jan 2022
|
||||
|
||||
- Remove `experimental` message when using custom CodeQL packages. [#888](https://github.com/github/codeql-action/pull/888)
|
||||
- Add a better warning message stating that experimental features will be disabled if the workflow has been triggered by a pull request from a fork or the `security-events: write` permission is not present. [#882](https://github.com/github/codeql-action/pull/882)
|
||||
|
||||
## 1.0.30 - 24 Jan 2022
|
||||
|
||||
- Display a better error message when encountering a workflow that runs the `codeql-action/init` action multiple times. [#876](https://github.com/github/codeql-action/pull/876)
|
||||
- Update default CodeQL bundle version to 2.7.6. [#877](https://github.com/github/codeql-action/pull/877)
|
||||
|
||||
## 1.0.29 - 21 Jan 2022
|
||||
|
||||
- The feature to wait for SARIF processing to complete after upload has been disabled by default due to a bug in its interaction with pull requests from forks.
|
||||
@@ -11,7 +21,7 @@
|
||||
|
||||
## 1.0.27 - 11 Jan 2022
|
||||
|
||||
- The `analyze` and `upload-sarif` actions will now wait up to 2 minutes for processing to complete after they have uploaded the results so they can report any processing errors that occurred. This behavior can be disabled by setting the `wait-for-processing` action input to `"false"`.
|
||||
- The `analyze` and `upload-sarif` actions will now wait up to 2 minutes for processing to complete after they have uploaded the results so they can report any processing errors that occurred. This behavior can be disabled by setting the `wait-for-processing` action input to `"false"`. [#855](https://github.com/github/codeql-action/pull/855)
|
||||
|
||||
## 1.0.26 - 10 Dec 2021
|
||||
|
||||
|
||||
5
lib/analyze-action.js
generated
5
lib/analyze-action.js
generated
@@ -74,11 +74,6 @@ async function run() {
|
||||
const memory = util.getMemoryFlag(actionsUtil.getOptionalInput("ram") || process.env["CODEQL_RAM"]);
|
||||
const repositoryNwo = (0, repository_1.parseRepositoryNwo)(util.getRequiredEnvParam("GITHUB_REPOSITORY"));
|
||||
const featureFlags = new feature_flags_1.GitHubFeatureFlags(config.gitHubVersion, apiDetails, repositoryNwo, logger);
|
||||
// We currently perform an API request in both the `init` and `analyze` Actions to determine
|
||||
// what feature flags are enabled. At the time of writing, this redundant API call is acceptable
|
||||
// to us, but if we wanted to avoid it, we could do so by serializing the feature flags as part
|
||||
// of the config file.
|
||||
void featureFlags.preloadFeatureFlags();
|
||||
await (0, analyze_1.runFinalize)(outputDir, threads, memory, config, logger);
|
||||
if (actionsUtil.getRequiredInput("skip-queries") !== "true") {
|
||||
runStats = await (0, analyze_1.runQueries)(outputDir, memory, util.getAddSnippetsFlag(actionsUtil.getRequiredInput("add-snippets")), threads, actionsUtil.getOptionalInput("category"), config, logger);
|
||||
|
||||
File diff suppressed because one or more lines are too long
5
lib/analyze.js
generated
5
lib/analyze.js
generated
@@ -132,10 +132,7 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
|
||||
}
|
||||
try {
|
||||
if (hasPackWithCustomQueries) {
|
||||
logger.info("*************");
|
||||
logger.info("Performing analysis with custom QL Packs. QL Packs are an experimental feature.");
|
||||
logger.info("And should not be used in production yet.");
|
||||
logger.info("*************");
|
||||
logger.info("Performing analysis with custom CodeQL Packs.");
|
||||
logger.startGroup(`Downloading custom packs for ${language}`);
|
||||
const codeql = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
|
||||
const results = await codeql.packDownload(packsWithVersion);
|
||||
|
||||
File diff suppressed because one or more lines are too long
9
lib/codeql.js
generated
9
lib/codeql.js
generated
@@ -512,7 +512,12 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
||||
await (0, toolrunner_error_catcher_1.toolrunnerErrorCatcher)(cmd, args, error_matcher_1.errorMatchers);
|
||||
},
|
||||
async resolveLanguages() {
|
||||
const codeqlArgs = ["resolve", "languages", "--format=json"];
|
||||
const codeqlArgs = [
|
||||
"resolve",
|
||||
"languages",
|
||||
"--format=json",
|
||||
...getExtraOptionsFromEnv(["resolve", "languages"]),
|
||||
];
|
||||
const output = await runTool(cmd, codeqlArgs);
|
||||
try {
|
||||
return JSON.parse(output);
|
||||
@@ -635,6 +640,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
||||
"cleanup",
|
||||
databasePath,
|
||||
`--mode=${cleanupLevel}`,
|
||||
...getExtraOptionsFromEnv(["database", "cleanup"]),
|
||||
];
|
||||
await runTool(cmd, codeqlArgs);
|
||||
},
|
||||
@@ -645,6 +651,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
||||
databasePath,
|
||||
`--output=${outputFilePath}`,
|
||||
`--name=${databaseName}`,
|
||||
...getExtraOptionsFromEnv(["database", "bundle"]),
|
||||
];
|
||||
await new toolrunner.ToolRunner(cmd, args).exec();
|
||||
},
|
||||
|
||||
File diff suppressed because one or more lines are too long
32
lib/database-upload.js
generated
32
lib/database-upload.js
generated
@@ -48,7 +48,6 @@ async function uploadDatabases(repositoryNwo, config, featureFlags, apiDetails,
|
||||
}
|
||||
const client = (0, api_client_1.getApiClient)(apiDetails);
|
||||
const codeql = await (0, codeql_1.getCodeQL)(config.codeQLCmd);
|
||||
const useUploadDomain = await featureFlags.getValue(feature_flags_1.FeatureFlag.UploadsDomainEnabled);
|
||||
for (const language of config.languages) {
|
||||
// Upload the database bundle.
|
||||
// Although we are uploading arbitrary file contents to the API, it's worth
|
||||
@@ -56,26 +55,17 @@ async function uploadDatabases(repositoryNwo, config, featureFlags, apiDetails,
|
||||
// This API method is available to anyone with write access to the repo.
|
||||
const payload = fs.readFileSync(await (0, util_1.bundleDb)(config, language, codeql, language));
|
||||
try {
|
||||
if (useUploadDomain) {
|
||||
await client.request(`POST https://uploads.github.com/repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name`, {
|
||||
owner: repositoryNwo.owner,
|
||||
repo: repositoryNwo.repo,
|
||||
language,
|
||||
name: `${language}-database`,
|
||||
data: payload,
|
||||
headers: {
|
||||
authorization: `token ${apiDetails.auth}`,
|
||||
},
|
||||
});
|
||||
}
|
||||
else {
|
||||
await client.request(`PUT /repos/:owner/:repo/code-scanning/codeql/databases/:language`, {
|
||||
owner: repositoryNwo.owner,
|
||||
repo: repositoryNwo.repo,
|
||||
language,
|
||||
data: payload,
|
||||
});
|
||||
}
|
||||
await client.request(`POST https://uploads.github.com/repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name`, {
|
||||
owner: repositoryNwo.owner,
|
||||
repo: repositoryNwo.repo,
|
||||
language,
|
||||
name: `${language}-database`,
|
||||
data: payload,
|
||||
headers: {
|
||||
authorization: `token ${apiDetails.auth}`,
|
||||
"Content-Type": "application/zip",
|
||||
},
|
||||
});
|
||||
logger.debug(`Successfully uploaded database for ${language}`);
|
||||
}
|
||||
catch (e) {
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"database-upload.js","sourceRoot":"","sources":["../src/database-upload.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AAEzB,4DAA8C;AAC9C,6CAA8D;AAC9D,qCAAqC;AAErC,mDAA4D;AAG5D,6CAA+B;AAC/B,iCAAkC;AAE3B,KAAK,UAAU,eAAe,CACnC,aAA4B,EAC5B,MAAc,EACd,YAA0B,EAC1B,UAA4B,EAC5B,MAAc;IAEd,IAAI,WAAW,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,KAAK,MAAM,EAAE;QAC9D,MAAM,CAAC,KAAK,CAAC,wDAAwD,CAAC,CAAC;QACvE,OAAO;KACR;IAED,iDAAiD;IACjD,IAAI,MAAM,CAAC,aAAa,CAAC,IAAI,KAAK,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;QAC3D,MAAM,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACjE,OAAO;KACR;IAED,IAAI,CAAC,CAAC,MAAM,WAAW,CAAC,wBAAwB,EAAE,CAAC,EAAE;QACnD,4EAA4E;QAC5E,MAAM,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAC;QAC/D,OAAO;KACR;IAED,IAAI,CAAC,CAAC,MAAM,YAAY,CAAC,QAAQ,CAAC,2BAAW,CAAC,sBAAsB,CAAC,CAAC,EAAE;QACtE,MAAM,CAAC,KAAK,CACV,kEAAkE,CACnE,CAAC;QACF,OAAO;KACR;IAED,MAAM,MAAM,GAAG,IAAA,yBAAY,EAAC,UAAU,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,MAAM,IAAA,kBAAS,EAAC,MAAM,CAAC,SAAS,CAAC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F,MAAM,MAAM,CAAC,OAAO,CAClB,wGAAwG,EACxG;gBACE,KAAK,EAAE,aAAa,CAAC,KAAK;gBAC1B,IAAI,EAAE,aAAa,CAAC,IAAI;gBACxB,QAAQ;gBACR,IAAI,EAAE,GAAG,QAAQ,WAAW;gBAC5B,IAAI,EAAE,OAAO;gBACb,OAAO,EAAE;oBACP,aAAa,EAAE,SAAS,UAAU,CAAC,IAAI,EAAE;oBACzC,cAAc,EAAE,iBAAiB;iBAClC;aACF,CACF,CAAC;YACF,MAAM,CAAC,KAAK,CAAC,sCAAsC,QAAQ,EAAE,CAAC,CAAC;SAChE;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACf,4CAA4C;YAC5C,MAAM,CAAC,OAAO,CAAC,iCAAiC,QAAQ,KAAK,CAAC,EAAE,CAAC,CAAC;SACnE;KACF;AACH,CAAC;AAhED,0CAgEC"}
|
||||
15
lib/database-upload.test.js
generated
15
lib/database-upload.test.js
generated
@@ -40,7 +40,6 @@ ava_1.default.beforeEach(() => {
|
||||
});
|
||||
const uploadToUploadsDomainFlags = (0, feature_flags_1.createFeatureFlags)([
|
||||
feature_flags_1.FeatureFlag.DatabaseUploadsEnabled,
|
||||
feature_flags_1.FeatureFlag.UploadsDomainEnabled,
|
||||
]);
|
||||
const testRepoName = { owner: "github", repo: "example" };
|
||||
const testApiDetails = {
|
||||
@@ -65,13 +64,11 @@ function getTestConfig(tmpDir) {
|
||||
debugDatabaseName: util_1.DEFAULT_DEBUG_DATABASE_NAME,
|
||||
};
|
||||
}
|
||||
async function mockHttpRequests(featureFlags, databaseUploadStatusCode) {
|
||||
async function mockHttpRequests(databaseUploadStatusCode) {
|
||||
// Passing an auth token is required, so we just use a dummy value
|
||||
const client = github.getOctokit("123");
|
||||
const requestSpy = sinon.stub(client, "request");
|
||||
const url = (await featureFlags.getValue(feature_flags_1.FeatureFlag.UploadsDomainEnabled))
|
||||
? "POST https://uploads.github.com/repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name"
|
||||
: "PUT /repos/:owner/:repo/code-scanning/codeql/databases/:language";
|
||||
const url = "POST https://uploads.github.com/repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name";
|
||||
const databaseUploadSpy = requestSpy.withArgs(url);
|
||||
if (databaseUploadStatusCode < 300) {
|
||||
databaseUploadSpy.resolves(undefined);
|
||||
@@ -155,7 +152,7 @@ async function mockHttpRequests(featureFlags, databaseUploadStatusCode) {
|
||||
},
|
||||
});
|
||||
const loggedMessages = [];
|
||||
await (0, database_upload_1.uploadDatabases)(testRepoName, getTestConfig(tmpDir), (0, feature_flags_1.createFeatureFlags)([feature_flags_1.FeatureFlag.UploadsDomainEnabled]), testApiDetails, (0, testing_utils_1.getRecordingLogger)(loggedMessages));
|
||||
await (0, database_upload_1.uploadDatabases)(testRepoName, getTestConfig(tmpDir), (0, feature_flags_1.createFeatureFlags)([]), testApiDetails, (0, testing_utils_1.getRecordingLogger)(loggedMessages));
|
||||
t.assert(loggedMessages.find((v) => v.type === "debug" &&
|
||||
v.message ===
|
||||
"Repository is not opted in to database uploads. Skipping upload.") !== undefined);
|
||||
@@ -172,7 +169,7 @@ async function mockHttpRequests(featureFlags, databaseUploadStatusCode) {
|
||||
const featureFlags = (0, feature_flags_1.createFeatureFlags)([
|
||||
feature_flags_1.FeatureFlag.DatabaseUploadsEnabled,
|
||||
]);
|
||||
await mockHttpRequests(featureFlags, 500);
|
||||
await mockHttpRequests(500);
|
||||
(0, codeql_1.setCodeQL)({
|
||||
async databaseBundle(_, outputFilePath) {
|
||||
fs.writeFileSync(outputFilePath, "");
|
||||
@@ -193,7 +190,7 @@ async function mockHttpRequests(featureFlags, databaseUploadStatusCode) {
|
||||
.withArgs("upload-database")
|
||||
.returns("true");
|
||||
sinon.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(true);
|
||||
await mockHttpRequests(uploadToUploadsDomainFlags, 201);
|
||||
await mockHttpRequests(201);
|
||||
(0, codeql_1.setCodeQL)({
|
||||
async databaseBundle(_, outputFilePath) {
|
||||
fs.writeFileSync(outputFilePath, "");
|
||||
@@ -213,7 +210,7 @@ async function mockHttpRequests(featureFlags, databaseUploadStatusCode) {
|
||||
.withArgs("upload-database")
|
||||
.returns("true");
|
||||
sinon.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(true);
|
||||
await mockHttpRequests(uploadToUploadsDomainFlags, 201);
|
||||
await mockHttpRequests(201);
|
||||
(0, codeql_1.setCodeQL)({
|
||||
async databaseBundle(_, outputFilePath) {
|
||||
fs.writeFileSync(outputFilePath, "");
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"bundleVersion": "codeql-bundle-20220112"
|
||||
"bundleVersion": "codeql-bundle-20220120"
|
||||
}
|
||||
|
||||
22
lib/feature-flags.js
generated
22
lib/feature-flags.js
generated
@@ -26,7 +26,6 @@ var FeatureFlag;
|
||||
(function (FeatureFlag) {
|
||||
FeatureFlag["DatabaseUploadsEnabled"] = "database_uploads_enabled";
|
||||
FeatureFlag["MlPoweredQueriesEnabled"] = "ml_powered_queries_enabled";
|
||||
FeatureFlag["UploadsDomainEnabled"] = "uploads_domain_enabled";
|
||||
})(FeatureFlag = exports.FeatureFlag || (exports.FeatureFlag = {}));
|
||||
class GitHubFeatureFlags {
|
||||
constructor(gitHubVersion, apiDetails, repositoryNwo, logger) {
|
||||
@@ -43,9 +42,6 @@ class GitHubFeatureFlags {
|
||||
}
|
||||
return response;
|
||||
}
|
||||
async preloadFeatureFlags() {
|
||||
await this.getApiResponse();
|
||||
}
|
||||
async getApiResponse() {
|
||||
const loadApiResponse = async () => {
|
||||
// Do nothing when not running against github.com
|
||||
@@ -62,11 +58,19 @@ class GitHubFeatureFlags {
|
||||
return response.data;
|
||||
}
|
||||
catch (e) {
|
||||
// Some feature flags, such as `ml_powered_queries_enabled` affect the produced alerts.
|
||||
// Considering these feature flags disabled in the event of a transient error could
|
||||
// therefore lead to alert churn. As a result, we crash if we cannot determine the value of
|
||||
// the feature flags.
|
||||
throw new Error(`Encountered an error while trying to load feature flags: ${e}`);
|
||||
if (util.isHTTPError(e) && e.status === 403) {
|
||||
this.logger.warning("This run of the CodeQL Action does not have permission to access Code Scanning API endpoints. " +
|
||||
"As a result, it will not be opted into any experimental features. " +
|
||||
"This could be because the Action is running on a pull request from a fork. If not, " +
|
||||
`please ensure the Action has the 'security-events: write' permission. Details: ${e}`);
|
||||
}
|
||||
else {
|
||||
// Some feature flags, such as `ml_powered_queries_enabled` affect the produced alerts.
|
||||
// Considering these feature flags disabled in the event of a transient error could
|
||||
// therefore lead to alert churn. As a result, we crash if we cannot determine the value of
|
||||
// the feature flags.
|
||||
throw new Error(`Encountered an error while trying to load feature flags: ${e}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
const apiResponse = this.cachedApiResponse || (await loadApiResponse());
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"feature-flags.js","sourceRoot":"","sources":["../src/feature-flags.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA8D;AAG9D,6CAA+B;AAM/B,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,kEAAmD,CAAA;IACnD,qEAAsD,CAAA;IACtD,8DAA+C,CAAA;AACjD,CAAC,EAJW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAItB;AAUD,MAAa,kBAAkB;IAG7B,YACU,aAAiC,EACjC,UAA4B,EAC5B,aAA4B,EAC5B,MAAc;QAHd,kBAAa,GAAb,aAAa,CAAoB;QACjC,eAAU,GAAV,UAAU,CAAkB;QAC5B,kBAAa,GAAb,aAAa,CAAe;QAC5B,WAAM,GAAN,MAAM,CAAQ;IACrB,CAAC;IAEJ,KAAK,CAAC,QAAQ,CAAC,IAAiB;QAC9B,MAAM,QAAQ,GAAG,CAAC,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;QACrD,IAAI,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(const featureFlag of [
|
||||
"database_uploads_enabled",
|
||||
"ml_powered_queries_enabled",
|
||||
"uploads_domain_enabled",
|
||||
]) {
|
||||
t.assert(loggedMessages.find((v) => v.type === "debug" &&
|
||||
v.message ===
|
||||
@@ -65,7 +64,7 @@ for (const variant of ALL_FEATURE_FLAGS_DISABLED_VARIANTS) {
|
||||
(0, testing_utils_1.setupActionsVars)(tmpDir, tmpDir);
|
||||
const featureFlags = new feature_flags_1.GitHubFeatureFlags({ type: util_1.GitHubVariant.DOTCOM }, testApiDetails, testRepositoryNwo, (0, logging_1.getRunnerLogger)(true));
|
||||
(0, testing_utils_1.mockFeatureFlagApiEndpoint)(500, {});
|
||||
await t.throwsAsync(async () => featureFlags.preloadFeatureFlags(), {
|
||||
await t.throwsAsync(async () => featureFlags.getValue(feature_flags_1.FeatureFlag.DatabaseUploadsEnabled), {
|
||||
message: "Encountered an error while trying to load feature flags: Error: some error message",
|
||||
});
|
||||
});
|
||||
@@ -73,7 +72,6 @@ for (const variant of ALL_FEATURE_FLAGS_DISABLED_VARIANTS) {
|
||||
const FEATURE_FLAGS = [
|
||||
"database_uploads_enabled",
|
||||
"ml_powered_queries_enabled",
|
||||
"uploads_domain_enabled",
|
||||
];
|
||||
for (const featureFlag of FEATURE_FLAGS) {
|
||||
(0, ava_1.default)(`Feature flag '${featureFlag}' is enabled if enabled in the API response`, async (t) => {
|
||||
@@ -89,7 +87,6 @@ for (const featureFlag of FEATURE_FLAGS) {
|
||||
const actualFeatureFlags = {
|
||||
database_uploads_enabled: await featureFlags.getValue(feature_flags_1.FeatureFlag.DatabaseUploadsEnabled),
|
||||
ml_powered_queries_enabled: await featureFlags.getValue(feature_flags_1.FeatureFlag.MlPoweredQueriesEnabled),
|
||||
uploads_domain_enabled: await featureFlags.getValue(feature_flags_1.FeatureFlag.UploadsDomainEnabled),
|
||||
};
|
||||
t.deepEqual(actualFeatureFlags, expectedFeatureFlags);
|
||||
});
|
||||
|
||||
@@ -1 +1 @@
|
||||
{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run() {
|
||||
(0, util_1.checkGitHubVersionInRange)(gitHubVersion, logger, util_1.Mode.actions);
|
||||
const repositoryNwo = (0, repository_1.parseRepositoryNwo)((0, util_1.getRequiredEnvParam)("GITHUB_REPOSITORY"));
|
||||
const featureFlags = new feature_flags_1.GitHubFeatureFlags(gitHubVersion, apiDetails, repositoryNwo, logger);
|
||||
void featureFlags.preloadFeatureFlags();
|
||||
try {
|
||||
const workflowErrors = await (0, actions_util_1.validateWorkflow)();
|
||||
if (!(await (0, actions_util_1.sendStatusReport)(await (0, actions_util_1.createStatusReportBase)("init", "starting", startedAt, workflowErrors)))) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
29
lib/init.js
generated
29
lib/init.js
generated
@@ -47,15 +47,30 @@ async function initConfig(languagesInput, queriesInput, packsInput, configFile,
|
||||
}
|
||||
exports.initConfig = initConfig;
|
||||
async function runInit(codeql, config, sourceRoot, processName, processLevel) {
|
||||
var _a;
|
||||
fs.mkdirSync(config.dbLocation, { recursive: true });
|
||||
if (await (0, util_1.codeQlVersionAbove)(codeql, codeql_1.CODEQL_VERSION_NEW_TRACING)) {
|
||||
// Init a database cluster
|
||||
await codeql.databaseInitCluster(config.dbLocation, config.languages, sourceRoot, processName, processLevel);
|
||||
try {
|
||||
if (await (0, util_1.codeQlVersionAbove)(codeql, codeql_1.CODEQL_VERSION_NEW_TRACING)) {
|
||||
// Init a database cluster
|
||||
await codeql.databaseInitCluster(config.dbLocation, config.languages, sourceRoot, processName, processLevel);
|
||||
}
|
||||
else {
|
||||
for (const language of config.languages) {
|
||||
// Init language database
|
||||
await codeql.databaseInit(util.getCodeQLDatabasePath(config, language), language, sourceRoot);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (const language of config.languages) {
|
||||
// Init language database
|
||||
await codeql.databaseInit(util.getCodeQLDatabasePath(config, language), language, sourceRoot);
|
||||
catch (e) {
|
||||
// Handle the situation where init is called twice
|
||||
// for the same database in the same job.
|
||||
if (e instanceof Error &&
|
||||
((_a = e.message) === null || _a === void 0 ? void 0 : _a.includes("Refusing to create databases")) &&
|
||||
e.message.includes("exists and is not an empty directory.")) {
|
||||
throw new Error(`Is the "init" action called twice in the same job? ${e.message}`);
|
||||
}
|
||||
else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
return await (0, tracer_config_1.getCombinedTracerConfig)(config, codeql);
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,yEAA2D;AAC3D,kEAAoD;AAEpD,gEAAkD;AAElD,qCAA2E;AAC3E,4DAA8C;AAI9C,mDAAwE;AACxE,6CAA+B;AAC/B,iCAA4C;AAErC,KAAK,UAAU,UAAU,CAC9B,SAA6B,EAC7B,UAA4B,EAC5B,OAAe,EACf,YAAoB,EACpB,OAA2B,EAC3B,MAAc;IAEd,MAAM,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACxC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,IAAA,oBAAW,EAChD,SAAS,EACT,UAAU,EACV,OAAO,EACP,YAAY,EACZ,OAAO,EACP,MAAM,EACN,IAAI,CACL,CAAC;IACF,MAAM,MAAM,CAAC,YAAY,EAAE,CAAC;IAC5B,MAAM,CAAC,QAAQ,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;AAClC,CAAC;AArBD,gCAqBC;AAEM,KAAK,UAAU,UAAU,CAC9B,cAAkC,EAClC,YAAgC,EAChC,UAA8B,EAC9B,UAA8B,EAC9B,UAA8B,EAC9B,SAAkB,EAClB,iBAAyB,EACzB,iBAAyB,EACzB,UAAyB,EACzB,OAAe,EACf,YAAoB,EACpB,MAAc,EACd,aAAqB,EACrB,aAAiC,EACjC,UAAoC,EACpC,YAA0B,EAC1B,MAAc;IAEd,MAAM,CAAC,UAAU,C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json
generated
vendored
62
node_modules/.package-lock.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "codeql",
|
||||
"version": "1.0.29",
|
||||
"version": "1.0.31",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
@@ -471,9 +471,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@sinonjs/samsam": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-6.0.2.tgz",
|
||||
"integrity": "sha512-jxPRPp9n93ci7b8hMfJOFDPRLFYadN6FSpeROFTR4UNF4i5b+EK6m4QXPO46BDhFgRy1JuS87zAnFOzCUwMJcQ==",
|
||||
"version": "6.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-6.1.1.tgz",
|
||||
"integrity": "sha512-cZ7rKJTLiE7u7Wi/v9Hc2fs3Ucc3jrWeMgPHbbTCeVAB2S0wOBbYlkJVeNSL04i7fdhT8wIbDq1zhC/PXTD2SA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@sinonjs/commons": "^1.6.0",
|
||||
@@ -4322,10 +4322,22 @@
|
||||
}
|
||||
},
|
||||
"node_modules/node-fetch": {
|
||||
"version": "2.6.1",
|
||||
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==",
|
||||
"version": "2.6.7",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
|
||||
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
|
||||
"dependencies": {
|
||||
"whatwg-url": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "4.x || >=6.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"encoding": "^0.1.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"encoding": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/normalize-package-data": {
|
||||
@@ -5544,14 +5556,14 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/sinon": {
|
||||
"version": "11.1.2",
|
||||
"resolved": "https://registry.npmjs.org/sinon/-/sinon-11.1.2.tgz",
|
||||
"integrity": "sha512-59237HChms4kg7/sXhiRcUzdSkKuydDeTiamT/jesUVHshBgL8XAmhgFo0GfK6RruMDM/iRSij1EybmMog9cJw==",
|
||||
"version": "13.0.0",
|
||||
"resolved": "https://registry.npmjs.org/sinon/-/sinon-13.0.0.tgz",
|
||||
"integrity": "sha512-3tjMDB/tY04b06Bnb4aMKQfNrau2C9HET+R4HVWfv2KegDVLGg4wnBqjVepvxR7S7R1GTwDZzEv52tpFipt6yA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@sinonjs/commons": "^1.8.3",
|
||||
"@sinonjs/fake-timers": "^7.1.2",
|
||||
"@sinonjs/samsam": "^6.0.2",
|
||||
"@sinonjs/fake-timers": "^9.0.0",
|
||||
"@sinonjs/samsam": "^6.1.1",
|
||||
"diff": "^5.0.0",
|
||||
"nise": "^5.1.0",
|
||||
"supports-color": "^7.2.0"
|
||||
@@ -5561,6 +5573,15 @@
|
||||
"url": "https://opencollective.com/sinon"
|
||||
}
|
||||
},
|
||||
"node_modules/sinon/node_modules/@sinonjs/fake-timers": {
|
||||
"version": "9.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-9.0.0.tgz",
|
||||
"integrity": "sha512-+shXA2X7KNP7H7qNbQTJ3SA+NQc0pZDSBrdvFSRwF8sAo/ohw+ZQFD8Moc+gnz51+1eRXtEQBpKWPiQ4jsRC/w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@sinonjs/commons": "^1.7.0"
|
||||
}
|
||||
},
|
||||
"node_modules/sinon/node_modules/has-flag": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||
@@ -6018,6 +6039,11 @@
|
||||
"node": ">=8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/tr46": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
||||
"integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o="
|
||||
},
|
||||
"node_modules/trim-off-newlines": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/trim-off-newlines/-/trim-off-newlines-1.0.2.tgz",
|
||||
@@ -6313,6 +6339,11 @@
|
||||
"defaults": "^1.0.3"
|
||||
}
|
||||
},
|
||||
"node_modules/webidl-conversions": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
||||
"integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE="
|
||||
},
|
||||
"node_modules/well-known-symbols": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/well-known-symbols/-/well-known-symbols-2.0.0.tgz",
|
||||
@@ -6322,6 +6353,15 @@
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/whatwg-url": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
|
||||
"integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=",
|
||||
"dependencies": {
|
||||
"tr46": "~0.0.3",
|
||||
"webidl-conversions": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/which": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||
|
||||
226
node_modules/@sinonjs/samsam/CHANGES.md
generated
vendored
226
node_modules/@sinonjs/samsam/CHANGES.md
generated
vendored
@@ -1,226 +0,0 @@
|
||||
# Changes
|
||||
|
||||
## 6.0.2
|
||||
|
||||
- [`144204d`](https://github.com/sinonjs/samsam/commit/144204d505526d5c382cb2f3dc2c2dd1378fe12d)
|
||||
Fix deep equal comparison between promises (#217) (David G. Miguel)
|
||||
|
||||
_Released on 2021-05-24._
|
||||
|
||||
## 6.0.1
|
||||
|
||||
- [`decfafe`](https://github.com/sinonjs/samsam/commit/decfafe72d8b2d159cfc49440a8f4af6d3e9c574)
|
||||
Bump y18n from 4.0.0 to 4.0.1 (dependabot[bot])
|
||||
>
|
||||
> Bumps [y18n](https://github.com/yargs/y18n) from 4.0.0 to 4.0.1.
|
||||
> - [Release notes](https://github.com/yargs/y18n/releases)
|
||||
> - [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md)
|
||||
> - [Commits](https://github.com/yargs/y18n/commits)
|
||||
>
|
||||
> Signed-off-by: dependabot[bot] <support@github.com>
|
||||
|
||||
_Released on 2021-04-08._
|
||||
|
||||
## 6.0.0
|
||||
|
||||
- [`95d1dce`](https://github.com/sinonjs/samsam/commit/95d1dce07f47b7bbb84111c42f44ecd9466dc2c8)
|
||||
Use @sinonjs/eslint-config (Morgan Roderick)
|
||||
>
|
||||
> This drops support for legacy runtimes like IE11, legacy Edge, Safari 9 and the like
|
||||
|
||||
_Released on 2021-03-30._
|
||||
|
||||
## 5.3.1
|
||||
|
||||
- [`04e0faa`](https://github.com/sinonjs/samsam/commit/04e0faa88d8a08325c6d70febed9dad4e7eeabfe)
|
||||
Distribute package as source (Morgan Roderick)
|
||||
>
|
||||
> This library is not meant for writing end user applications or even for
|
||||
> being used directly when writing tests. It is not meant to be loaded
|
||||
> directly by browsers.
|
||||
>
|
||||
> Consumers of this package are assumed to use their own bundlers, should
|
||||
> they need to bundle code for use in browsers or workers.
|
||||
>
|
||||
> Therefore, it is safe to distribute the package as source files and not
|
||||
> bundle them up.
|
||||
>
|
||||
> This allows us to remove the bundler and its transitive dependencies,
|
||||
> which reduces the maintenance burden of managing the library.
|
||||
>
|
||||
|
||||
_Released on 2021-01-13._
|
||||
|
||||
## 5.3.0
|
||||
|
||||
- [`fd8aabd`](https://github.com/sinonjs/samsam/commit/fd8aabd3768c199abc717dc6d793ef136419be72)
|
||||
Generate .d.ts from JSDoc (Morgan Roderick)
|
||||
>
|
||||
> See https://humanwhocodes.com/snippets/2020/10/create-typescript-declarations-from-javascript-jsdoc/
|
||||
>
|
||||
|
||||
_Released on 2020-11-16._
|
||||
|
||||
## 5.2.0
|
||||
|
||||
- [`f27b87c`](https://github.com/sinonjs/samsam/commit/f27b87cbd493a09e4a3181cf36f503facbbb23fb)
|
||||
Add match.json (Maximilian Antoni)
|
||||
|
||||
_Released by [Maximilian Antoni](https://github.com/mantoni) on 2020-10-06._
|
||||
|
||||
## 5.1.0
|
||||
|
||||
- [`820c296`](https://github.com/sinonjs/samsam/commit/820c2961f70208367e1c072ae9a581eefd0d8d18)
|
||||
Evaluate symbol keys for object matchers (#206) (Joel Bradshaw)
|
||||
>
|
||||
> * Make match() work for objects with symbol keys
|
||||
|
||||
_Released on 2020-08-11._
|
||||
|
||||
## 5.0.3
|
||||
|
||||
- [`9d2add0`](https://github.com/sinonjs/samsam/commit/9d2add01eba85eb17ddb91ac22404fb6c23e8d39)
|
||||
Remove unused @sinonjs/formatio (Morgan Roderick)
|
||||
>
|
||||
> As can be seen with searching the codebase, @sinonjs/formatio is never
|
||||
> imported, and is thus not a direct dependency of @sinonjs/samsam.
|
||||
>
|
||||
|
||||
_Released on 2020-02-28._
|
||||
|
||||
## 5.0.2
|
||||
|
||||
- [`f9e845a`](https://github.com/sinonjs/samsam/commit/f9e845a52ba50916df91335d2003a81a808a4ade)
|
||||
Bump formatio to latest major (Morgan Roderick)
|
||||
>
|
||||
> This will remove some duplication in Sinon, see https://github.com/sinonjs/sinon/issues/2224
|
||||
>
|
||||
|
||||
_Released on 2020-02-20._
|
||||
|
||||
## 5.0.1
|
||||
|
||||
- [`fe5d035`](https://github.com/sinonjs/samsam/commit/fe5d03532ea6cdbec857c49d18392d668cca8ef2)
|
||||
Bump jsdom from 15.2.1 to 16.2.0 (dependabot-preview[bot])
|
||||
>
|
||||
> Bumps [jsdom](https://github.com/jsdom/jsdom) from 15.2.1 to 16.2.0.
|
||||
> - [Release notes](https://github.com/jsdom/jsdom/releases)
|
||||
> - [Changelog](https://github.com/jsdom/jsdom/blob/master/Changelog.md)
|
||||
> - [Commits](https://github.com/jsdom/jsdom/compare/15.2.1...16.2.0)
|
||||
>
|
||||
> Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
|
||||
- [`910af18`](https://github.com/sinonjs/samsam/commit/910af18be1bd57c6237399ca04cbef91d994a38a)
|
||||
Remove maintenance junk from CHANGES.md (Morgan Roderick)
|
||||
|
||||
_Released on 2020-02-18._
|
||||
|
||||
## 5.0.0
|
||||
|
||||
- [`f288430`](https://github.com/sinonjs/samsam/commit/f2884309c9bf68b02ecfda3bd1df8d7a7a31686b)
|
||||
Drop support for Node 8 (Morgan Roderick)
|
||||
>
|
||||
> As can be seen at https://github.com/nodejs/Release, Node 8 reached
|
||||
> "end" of life on 2019-12-31, and is no longer actively supported.
|
||||
>
|
||||
> We will stop testing in Node 8 and start testing in Node 13, which will
|
||||
> become the next LTS release from April 2020.
|
||||
>
|
||||
|
||||
_Released on 2020-02-18._
|
||||
|
||||
## 4.2.2
|
||||
|
||||
- [`c600d6c`](https://github.com/sinonjs/samsam/commit/c600d6cb6c1bec8d65bc718bd9268311204597bc)
|
||||
Fix issue with nested array matching (Jay Merrifield)
|
||||
- [`8b37566`](https://github.com/sinonjs/samsam/commit/8b37566ea73bee512fbc4203c07678288f906bda)
|
||||
Bump eslint from 6.7.2 to 6.8.0 (dependabot-preview[bot])
|
||||
>
|
||||
> Bumps [eslint](https://github.com/eslint/eslint) from 6.7.2 to 6.8.0.
|
||||
> - [Release notes](https://github.com/eslint/eslint/releases)
|
||||
> - [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
|
||||
> - [Commits](https://github.com/eslint/eslint/compare/v6.7.2...v6.8.0)
|
||||
>
|
||||
> Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
|
||||
- [`b7c5db9`](https://github.com/sinonjs/samsam/commit/b7c5db9e7847204188c112843bb193248d0b5156)
|
||||
Bump eslint-plugin-prettier from 3.1.1 to 3.1.2 (dependabot-preview[bot])
|
||||
>
|
||||
> Bumps [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) from 3.1.1 to 3.1.2.
|
||||
> - [Release notes](https://github.com/prettier/eslint-plugin-prettier/releases)
|
||||
> - [Changelog](https://github.com/prettier/eslint-plugin-prettier/blob/master/CHANGELOG.md)
|
||||
> - [Commits](https://github.com/prettier/eslint-plugin-prettier/compare/v3.1.1...v3.1.2)
|
||||
>
|
||||
> Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
|
||||
- [`8965384`](https://github.com/sinonjs/samsam/commit/8965384818697b7b36537619922b3c378bfd0b42)
|
||||
Bump eslint-plugin-mocha from 6.1.1 to 6.2.2 (dependabot-preview[bot])
|
||||
>
|
||||
> Bumps [eslint-plugin-mocha](https://github.com/lo1tuma/eslint-plugin-mocha) from 6.1.1 to 6.2.2.
|
||||
> - [Release notes](https://github.com/lo1tuma/eslint-plugin-mocha/releases)
|
||||
> - [Changelog](https://github.com/lo1tuma/eslint-plugin-mocha/blob/master/CHANGELOG.md)
|
||||
> - [Commits](https://github.com/lo1tuma/eslint-plugin-mocha/compare/6.1.1...6.2.2)
|
||||
>
|
||||
> Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
|
||||
- [`8661610`](https://github.com/sinonjs/samsam/commit/866161044e212b4df56a207e55ab3e449346abf5)
|
||||
Bump eslint-config-prettier from 6.7.0 to 6.9.0 (dependabot-preview[bot])
|
||||
>
|
||||
> Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 6.7.0 to 6.9.0.
|
||||
> - [Release notes](https://github.com/prettier/eslint-config-prettier/releases)
|
||||
> - [Changelog](https://github.com/prettier/eslint-config-prettier/blob/master/CHANGELOG.md)
|
||||
> - [Commits](https://github.com/prettier/eslint-config-prettier/commits/v6.9.0)
|
||||
>
|
||||
> Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
|
||||
- [`7d91124`](https://github.com/sinonjs/samsam/commit/7d91124a9fa95c462c1e714d86405d6cb99e3363)
|
||||
Bump rollup from 1.23.0 to 1.27.14 (dependabot-preview[bot])
|
||||
>
|
||||
> Bumps [rollup](https://github.com/rollup/rollup) from 1.23.0 to 1.27.14.
|
||||
> - [Release notes](https://github.com/rollup/rollup/releases)
|
||||
> - [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
|
||||
> - [Commits](https://github.com/rollup/rollup/compare/v1.23.0...v1.27.14)
|
||||
>
|
||||
> Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
|
||||
- [`31c616a`](https://github.com/sinonjs/samsam/commit/31c616ab278e05071138e18d6e5aea8f2c250c2a)
|
||||
Bump nyc from 14.1.1 to 15.0.0 (dependabot-preview[bot])
|
||||
>
|
||||
> Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0.
|
||||
> - [Release notes](https://github.com/istanbuljs/nyc/releases)
|
||||
> - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md)
|
||||
> - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0)
|
||||
>
|
||||
> Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
|
||||
- [`e82dbcf`](https://github.com/sinonjs/samsam/commit/e82dbcf9af6a052b1d466e476a7315e047324256)
|
||||
Bump @sinonjs/referee from 3.2.0 to 4.0.0 (dependabot-preview[bot])
|
||||
>
|
||||
> Bumps [@sinonjs/referee](https://github.com/sinonjs/referee) from 3.2.0 to 4.0.0.
|
||||
> - [Release notes](https://github.com/sinonjs/referee/releases)
|
||||
> - [Changelog](https://github.com/sinonjs/referee/blob/master/CHANGES.md)
|
||||
> - [Commits](https://github.com/sinonjs/referee/compare/v3.2.0...v4.0.0)
|
||||
>
|
||||
> Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
|
||||
- [`b089354`](https://github.com/sinonjs/samsam/commit/b089354118a6f64139ca64906d8b8a9f282bc376)
|
||||
Bump eslint-plugin-jsdoc from 18.4.3 to 19.2.0 (dependabot-preview[bot])
|
||||
>
|
||||
> Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 18.4.3 to 19.2.0.
|
||||
> - [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
|
||||
> - [Commits](https://github.com/gajus/eslint-plugin-jsdoc/compare/v18.4.3...v19.2.0)
|
||||
>
|
||||
> Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
|
||||
- [`bba8c44`](https://github.com/sinonjs/samsam/commit/bba8c441914cd3b07b505b4d917a042d16412c9e)
|
||||
Bump @sinonjs/commons from 1.6.0 to 1.7.0 (dependabot-preview[bot])
|
||||
>
|
||||
> Bumps [@sinonjs/commons](https://github.com/sinonjs/commons) from 1.6.0 to 1.7.0.
|
||||
> - [Release notes](https://github.com/sinonjs/commons/releases)
|
||||
> - [Commits](https://github.com/sinonjs/commons/compare/v1.6.0...v1.7.0)
|
||||
>
|
||||
> Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
|
||||
- [`5915960`](https://github.com/sinonjs/samsam/commit/5915960fab257e27564c544da45b419c360bc8fb)
|
||||
Publish using public access (Morgan Roderick)
|
||||
- [`28ffc83`](https://github.com/sinonjs/samsam/commit/28ffc83556274b025d1fc62b52d2ff8ea25743a4)
|
||||
4.2.1 (Morgan Roderick)
|
||||
|
||||
_Released by [Maximilian Antoni](https://github.com/mantoni) on 2020-01-09._
|
||||
|
||||
## 4.2.1
|
||||
|
||||
- [`8987966`](https://github.com/sinonjs/samsam/commit/898796645000b88f1a4045213355bed29085f46c)
|
||||
re-introduce bound deepEqual (#160) (James Garbutt)
|
||||
|
||||
_Released on 2019-12-30._
|
||||
27
node_modules/@sinonjs/samsam/lib/deep-equal.js
generated
vendored
27
node_modules/@sinonjs/samsam/lib/deep-equal.js
generated
vendored
@@ -10,8 +10,10 @@ var mapForEach = require("@sinonjs/commons").prototypes.map.forEach;
|
||||
var getClass = require("./get-class");
|
||||
var identical = require("./identical");
|
||||
var isArguments = require("./is-arguments");
|
||||
var isArrayType = require("./is-array-type");
|
||||
var isDate = require("./is-date");
|
||||
var isElement = require("./is-element");
|
||||
var isIterable = require("./is-iterable");
|
||||
var isMap = require("./is-map");
|
||||
var isNaN = require("./is-nan");
|
||||
var isObject = require("./is-object");
|
||||
@@ -189,6 +191,31 @@ function deepEqualCyclic(actual, expectation, match) {
|
||||
return mapsDeeplyEqual;
|
||||
}
|
||||
|
||||
var isActualNonArrayIterable =
|
||||
isIterable(actualObj) &&
|
||||
!isArrayType(actualObj) &&
|
||||
!isArguments(actualObj);
|
||||
var isExpectationNonArrayIterable =
|
||||
isIterable(expectation) &&
|
||||
!isArrayType(expectation) &&
|
||||
!isArguments(expectation);
|
||||
if (isActualNonArrayIterable || isExpectationNonArrayIterable) {
|
||||
var actualArray = Array.from(actualObj);
|
||||
var expectationArray = Array.from(expectation);
|
||||
if (actualArray.length !== expectationArray.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var arrayDeeplyEquals = true;
|
||||
every(actualArray, function (key) {
|
||||
arrayDeeplyEquals =
|
||||
arrayDeeplyEquals &&
|
||||
deepEqualCyclic(actualArray[key], expectationArray[key]);
|
||||
});
|
||||
|
||||
return arrayDeeplyEquals;
|
||||
}
|
||||
|
||||
return every(expectationKeysAndSymbols, function (key) {
|
||||
if (!hasOwnProperty(actualObj, key)) {
|
||||
return false;
|
||||
|
||||
18
node_modules/@sinonjs/samsam/lib/is-iterable.js
generated
vendored
Normal file
18
node_modules/@sinonjs/samsam/lib/is-iterable.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Returns `true` when the argument is an iterable, `false` otherwise
|
||||
*
|
||||
* @alias module:samsam.isIterable
|
||||
* @param {*} val - A value to examine
|
||||
* @returns {boolean} Returns `true` when the argument is an iterable, `false` otherwise
|
||||
*/
|
||||
function isIterable(val) {
|
||||
// checks for null and undefined
|
||||
if (typeof val !== "object") {
|
||||
return false;
|
||||
}
|
||||
return typeof val[Symbol.iterator] === "function";
|
||||
}
|
||||
|
||||
module.exports = isIterable;
|
||||
4
node_modules/@sinonjs/samsam/package.json
generated
vendored
4
node_modules/@sinonjs/samsam/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@sinonjs/samsam",
|
||||
"version": "6.0.2",
|
||||
"version": "6.1.1",
|
||||
"description": "Value identification and comparison functions",
|
||||
"homepage": "http://sinonjs.github.io/samsam/",
|
||||
"author": "Christian Johansen",
|
||||
@@ -28,7 +28,7 @@
|
||||
"test-headless": "mochify --no-detect-globals --recursive -R dot --plugin [ proxyquire-universal ] \"./lib/*.test.js\"",
|
||||
"prettier:check": "prettier --check '**/*.{js,css,md}'",
|
||||
"prettier:write": "prettier --write '**/*.{js,css,md}'",
|
||||
"preversion": "npm run test-check-coverage",
|
||||
"preversion": "./check-external-dependencies.sh && npm run test-check-coverage",
|
||||
"version": "changes --commits --footer",
|
||||
"postversion": "git push --follow-tags && npm publish --access public"
|
||||
},
|
||||
|
||||
9
node_modules/@sinonjs/samsam/types/is-iterable.d.ts
generated
vendored
Normal file
9
node_modules/@sinonjs/samsam/types/is-iterable.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
export = isIterable;
|
||||
/**
|
||||
* Returns `true` when the argument is an iterable, `false` otherwise
|
||||
*
|
||||
* @alias module:samsam.isIterable
|
||||
* @param {*} val - A value to examine
|
||||
* @returns {boolean} Returns `true` when the argument is an iterable, `false` otherwise
|
||||
*/
|
||||
declare function isIterable(val: any): boolean;
|
||||
272
node_modules/node-fetch/CHANGELOG.md
generated
vendored
272
node_modules/node-fetch/CHANGELOG.md
generated
vendored
@@ -1,272 +0,0 @@
|
||||
|
||||
Changelog
|
||||
=========
|
||||
|
||||
|
||||
# 2.x release
|
||||
|
||||
## v2.6.1
|
||||
|
||||
**This is an important security release. It is strongly recommended to update as soon as possible.**
|
||||
|
||||
- Fix: honor the `size` option after following a redirect.
|
||||
|
||||
## v2.6.0
|
||||
|
||||
- Enhance: `options.agent`, it now accepts a function that returns custom http(s).Agent instance based on current URL, see readme for more information.
|
||||
- Fix: incorrect `Content-Length` was returned for stream body in 2.5.0 release; note that `node-fetch` doesn't calculate content length for stream body.
|
||||
- Fix: `Response.url` should return empty string instead of `null` by default.
|
||||
|
||||
## v2.5.0
|
||||
|
||||
- Enhance: `Response` object now includes `redirected` property.
|
||||
- Enhance: `fetch()` now accepts third-party `Blob` implementation as body.
|
||||
- Other: disable `package-lock.json` generation as we never commit them.
|
||||
- Other: dev dependency update.
|
||||
- Other: readme update.
|
||||
|
||||
## v2.4.1
|
||||
|
||||
- Fix: `Blob` import rule for node < 10, as `Readable` isn't a named export.
|
||||
|
||||
## v2.4.0
|
||||
|
||||
- Enhance: added `Brotli` compression support (using node's zlib).
|
||||
- Enhance: updated `Blob` implementation per spec.
|
||||
- Fix: set content type automatically for `URLSearchParams`.
|
||||
- Fix: `Headers` now reject empty header names.
|
||||
- Fix: test cases, as node 12+ no longer accepts invalid header response.
|
||||
|
||||
## v2.3.0
|
||||
|
||||
- Enhance: added `AbortSignal` support, with README example.
|
||||
- Enhance: handle invalid `Location` header during redirect by rejecting them explicitly with `FetchError`.
|
||||
- Fix: update `browser.js` to support react-native environment, where `self` isn't available globally.
|
||||
|
||||
## v2.2.1
|
||||
|
||||
- Fix: `compress` flag shouldn't overwrite existing `Accept-Encoding` header.
|
||||
- Fix: multiple `import` rules, where `PassThrough` etc. doesn't have a named export when using node <10 and `--exerimental-modules` flag.
|
||||
- Other: Better README.
|
||||
|
||||
## v2.2.0
|
||||
|
||||
- Enhance: Support all `ArrayBuffer` view types
|
||||
- Enhance: Support Web Workers
|
||||
- Enhance: Support Node.js' `--experimental-modules` mode; deprecate `.es.js` file
|
||||
- Fix: Add `__esModule` property to the exports object
|
||||
- Other: Better example in README for writing response to a file
|
||||
- Other: More tests for Agent
|
||||
|
||||
## v2.1.2
|
||||
|
||||
- Fix: allow `Body` methods to work on `ArrayBuffer`-backed `Body` objects
|
||||
- Fix: reject promise returned by `Body` methods when the accumulated `Buffer` exceeds the maximum size
|
||||
- Fix: support custom `Host` headers with any casing
|
||||
- Fix: support importing `fetch()` from TypeScript in `browser.js`
|
||||
- Fix: handle the redirect response body properly
|
||||
|
||||
## v2.1.1
|
||||
|
||||
Fix packaging errors in v2.1.0.
|
||||
|
||||
## v2.1.0
|
||||
|
||||
- Enhance: allow using ArrayBuffer as the `body` of a `fetch()` or `Request`
|
||||
- Fix: store HTTP headers of a `Headers` object internally with the given case, for compatibility with older servers that incorrectly treated header names in a case-sensitive manner
|
||||
- Fix: silently ignore invalid HTTP headers
|
||||
- Fix: handle HTTP redirect responses without a `Location` header just like non-redirect responses
|
||||
- Fix: include bodies when following a redirection when appropriate
|
||||
|
||||
## v2.0.0
|
||||
|
||||
This is a major release. Check [our upgrade guide](https://github.com/bitinn/node-fetch/blob/master/UPGRADE-GUIDE.md) for an overview on some key differences between v1 and v2.
|
||||
|
||||
### General changes
|
||||
|
||||
- Major: Node.js 0.10.x and 0.12.x support is dropped
|
||||
- Major: `require('node-fetch/lib/response')` etc. is now unsupported; use `require('node-fetch').Response` or ES6 module imports
|
||||
- Enhance: start testing on Node.js v4.x, v6.x, v8.x LTS, as well as v9.x stable
|
||||
- Enhance: use Rollup to produce a distributed bundle (less memory overhead and faster startup)
|
||||
- Enhance: make `Object.prototype.toString()` on Headers, Requests, and Responses return correct class strings
|
||||
- Other: rewrite in ES2015 using Babel
|
||||
- Other: use Codecov for code coverage tracking
|
||||
- Other: update package.json script for npm 5
|
||||
- Other: `encoding` module is now optional (alpha.7)
|
||||
- Other: expose browser.js through package.json, avoid bundling mishaps (alpha.9)
|
||||
- Other: allow TypeScript to `import` node-fetch by exposing default (alpha.9)
|
||||
|
||||
### HTTP requests
|
||||
|
||||
- Major: overwrite user's `Content-Length` if we can be sure our information is correct (per spec)
|
||||
- Fix: errors in a response are caught before the body is accessed
|
||||
- Fix: support WHATWG URL objects, created by `whatwg-url` package or `require('url').URL` in Node.js 7+
|
||||
|
||||
### Response and Request classes
|
||||
|
||||
- Major: `response.text()` no longer attempts to detect encoding, instead always opting for UTF-8 (per spec); use `response.textConverted()` for the v1 behavior
|
||||
- Major: make `response.json()` throw error instead of returning an empty object on 204 no-content respose (per spec; reverts behavior changed in v1.6.2)
|
||||
- Major: internal methods are no longer exposed
|
||||
- Major: throw error when a `GET` or `HEAD` Request is constructed with a non-null body (per spec)
|
||||
- Enhance: add `response.arrayBuffer()` (also applies to Requests)
|
||||
- Enhance: add experimental `response.blob()` (also applies to Requests)
|
||||
- Enhance: `URLSearchParams` is now accepted as a body
|
||||
- Enhance: wrap `response.json()` json parsing error as `FetchError`
|
||||
- Fix: fix Request and Response with `null` body
|
||||
|
||||
### Headers class
|
||||
|
||||
- Major: remove `headers.getAll()`; make `get()` return all headers delimited by commas (per spec)
|
||||
- Enhance: make Headers iterable
|
||||
- Enhance: make Headers constructor accept an array of tuples
|
||||
- Enhance: make sure header names and values are valid in HTTP
|
||||
- Fix: coerce Headers prototype function parameters to strings, where applicable
|
||||
|
||||
### Documentation
|
||||
|
||||
- Enhance: more comprehensive API docs
|
||||
- Enhance: add a list of default headers in README
|
||||
|
||||
|
||||
# 1.x release
|
||||
|
||||
## backport releases (v1.7.0 and beyond)
|
||||
|
||||
See [changelog on 1.x branch](https://github.com/bitinn/node-fetch/blob/1.x/CHANGELOG.md) for details.
|
||||
|
||||
## v1.6.3
|
||||
|
||||
- Enhance: error handling document to explain `FetchError` design
|
||||
- Fix: support `form-data` 2.x releases (requires `form-data` >= 2.1.0)
|
||||
|
||||
## v1.6.2
|
||||
|
||||
- Enhance: minor document update
|
||||
- Fix: response.json() returns empty object on 204 no-content response instead of throwing a syntax error
|
||||
|
||||
## v1.6.1
|
||||
|
||||
- Fix: if `res.body` is a non-stream non-formdata object, we will call `body.toString` and send it as a string
|
||||
- Fix: `counter` value is incorrectly set to `follow` value when wrapping Request instance
|
||||
- Fix: documentation update
|
||||
|
||||
## v1.6.0
|
||||
|
||||
- Enhance: added `res.buffer()` api for convenience, it returns body as a Node.js buffer
|
||||
- Enhance: better old server support by handling raw deflate response
|
||||
- Enhance: skip encoding detection for non-HTML/XML response
|
||||
- Enhance: minor document update
|
||||
- Fix: HEAD request doesn't need decompression, as body is empty
|
||||
- Fix: `req.body` now accepts a Node.js buffer
|
||||
|
||||
## v1.5.3
|
||||
|
||||
- Fix: handle 204 and 304 responses when body is empty but content-encoding is gzip/deflate
|
||||
- Fix: allow resolving response and cloned response in any order
|
||||
- Fix: avoid setting `content-length` when `form-data` body use streams
|
||||
- Fix: send DELETE request with content-length when body is present
|
||||
- Fix: allow any url when calling new Request, but still reject non-http(s) url in fetch
|
||||
|
||||
## v1.5.2
|
||||
|
||||
- Fix: allow node.js core to handle keep-alive connection pool when passing a custom agent
|
||||
|
||||
## v1.5.1
|
||||
|
||||
- Fix: redirect mode `manual` should work even when there is no redirection or broken redirection
|
||||
|
||||
## v1.5.0
|
||||
|
||||
- Enhance: rejected promise now use custom `Error` (thx to @pekeler)
|
||||
- Enhance: `FetchError` contains `err.type` and `err.code`, allows for better error handling (thx to @pekeler)
|
||||
- Enhance: basic support for redirect mode `manual` and `error`, allows for location header extraction (thx to @jimmywarting for the initial PR)
|
||||
|
||||
## v1.4.1
|
||||
|
||||
- Fix: wrapping Request instance with FormData body again should preserve the body as-is
|
||||
|
||||
## v1.4.0
|
||||
|
||||
- Enhance: Request and Response now have `clone` method (thx to @kirill-konshin for the initial PR)
|
||||
- Enhance: Request and Response now have proper string and buffer body support (thx to @kirill-konshin)
|
||||
- Enhance: Body constructor has been refactored out (thx to @kirill-konshin)
|
||||
- Enhance: Headers now has `forEach` method (thx to @tricoder42)
|
||||
- Enhance: back to 100% code coverage
|
||||
- Fix: better form-data support (thx to @item4)
|
||||
- Fix: better character encoding detection under chunked encoding (thx to @dsuket for the initial PR)
|
||||
|
||||
## v1.3.3
|
||||
|
||||
- Fix: make sure `Content-Length` header is set when body is string for POST/PUT/PATCH requests
|
||||
- Fix: handle body stream error, for cases such as incorrect `Content-Encoding` header
|
||||
- Fix: when following certain redirects, use `GET` on subsequent request per Fetch Spec
|
||||
- Fix: `Request` and `Response` constructors now parse headers input using `Headers`
|
||||
|
||||
## v1.3.2
|
||||
|
||||
- Enhance: allow auto detect of form-data input (no `FormData` spec on node.js, this is form-data specific feature)
|
||||
|
||||
## v1.3.1
|
||||
|
||||
- Enhance: allow custom host header to be set (server-side only feature, as it's a forbidden header on client-side)
|
||||
|
||||
## v1.3.0
|
||||
|
||||
- Enhance: now `fetch.Request` is exposed as well
|
||||
|
||||
## v1.2.1
|
||||
|
||||
- Enhance: `Headers` now normalized `Number` value to `String`, prevent common mistakes
|
||||
|
||||
## v1.2.0
|
||||
|
||||
- Enhance: now fetch.Headers and fetch.Response are exposed, making testing easier
|
||||
|
||||
## v1.1.2
|
||||
|
||||
- Fix: `Headers` should only support `String` and `Array` properties, and ignore others
|
||||
|
||||
## v1.1.1
|
||||
|
||||
- Enhance: now req.headers accept both plain object and `Headers` instance
|
||||
|
||||
## v1.1.0
|
||||
|
||||
- Enhance: timeout now also applies to response body (in case of slow response)
|
||||
- Fix: timeout is now cleared properly when fetch is done/has failed
|
||||
|
||||
## v1.0.6
|
||||
|
||||
- Fix: less greedy content-type charset matching
|
||||
|
||||
## v1.0.5
|
||||
|
||||
- Fix: when `follow = 0`, fetch should not follow redirect
|
||||
- Enhance: update tests for better coverage
|
||||
- Enhance: code formatting
|
||||
- Enhance: clean up doc
|
||||
|
||||
## v1.0.4
|
||||
|
||||
- Enhance: test iojs support
|
||||
- Enhance: timeout attached to socket event only fire once per redirect
|
||||
|
||||
## v1.0.3
|
||||
|
||||
- Fix: response size limit should reject large chunk
|
||||
- Enhance: added character encoding detection for xml, such as rss/atom feed (encoding in DTD)
|
||||
|
||||
## v1.0.2
|
||||
|
||||
- Fix: added res.ok per spec change
|
||||
|
||||
## v1.0.0
|
||||
|
||||
- Enhance: better test coverage and doc
|
||||
|
||||
|
||||
# 0.x release
|
||||
|
||||
## v0.1
|
||||
|
||||
- Major: initial public release
|
||||
58
node_modules/node-fetch/lib/index.es.js
generated
vendored
58
node_modules/node-fetch/lib/index.es.js
generated
vendored
@@ -3,6 +3,7 @@ process.emitWarning("The .es.js file is deprecated. Use .mjs instead.");
|
||||
import Stream from 'stream';
|
||||
import http from 'http';
|
||||
import Url from 'url';
|
||||
import whatwgUrl from 'whatwg-url';
|
||||
import https from 'https';
|
||||
import zlib from 'zlib';
|
||||
|
||||
@@ -1137,11 +1138,32 @@ Object.defineProperty(Response.prototype, Symbol.toStringTag, {
|
||||
});
|
||||
|
||||
const INTERNALS$2 = Symbol('Request internals');
|
||||
const URL = Url.URL || whatwgUrl.URL;
|
||||
|
||||
// fix an issue where "format", "parse" aren't a named export for node <10
|
||||
const parse_url = Url.parse;
|
||||
const format_url = Url.format;
|
||||
|
||||
/**
|
||||
* Wrapper around `new URL` to handle arbitrary URLs
|
||||
*
|
||||
* @param {string} urlStr
|
||||
* @return {void}
|
||||
*/
|
||||
function parseURL(urlStr) {
|
||||
/*
|
||||
Check whether the URL is absolute or not
|
||||
Scheme: https://tools.ietf.org/html/rfc3986#section-3.1
|
||||
Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3
|
||||
*/
|
||||
if (/^[a-zA-Z][a-zA-Z\d+\-.]*:/.exec(urlStr)) {
|
||||
urlStr = new URL(urlStr).toString();
|
||||
}
|
||||
|
||||
// Fallback to old implementation for arbitrary URLs
|
||||
return parse_url(urlStr);
|
||||
}
|
||||
|
||||
const streamDestructionSupported = 'destroy' in Stream.Readable.prototype;
|
||||
|
||||
/**
|
||||
@@ -1178,14 +1200,14 @@ class Request {
|
||||
// in order to support Node.js' Url objects; though WHATWG's URL objects
|
||||
// will fall into this branch also (since their `toString()` will return
|
||||
// `href` property anyway)
|
||||
parsedURL = parse_url(input.href);
|
||||
parsedURL = parseURL(input.href);
|
||||
} else {
|
||||
// coerce input to a string before attempting to parse
|
||||
parsedURL = parse_url(`${input}`);
|
||||
parsedURL = parseURL(`${input}`);
|
||||
}
|
||||
input = {};
|
||||
} else {
|
||||
parsedURL = parse_url(input.url);
|
||||
parsedURL = parseURL(input.url);
|
||||
}
|
||||
|
||||
let method = init.method || input.method || 'GET';
|
||||
@@ -1379,9 +1401,17 @@ AbortError.prototype = Object.create(Error.prototype);
|
||||
AbortError.prototype.constructor = AbortError;
|
||||
AbortError.prototype.name = 'AbortError';
|
||||
|
||||
const URL$1 = Url.URL || whatwgUrl.URL;
|
||||
|
||||
// fix an issue where "PassThrough", "resolve" aren't a named export for node <10
|
||||
const PassThrough$1 = Stream.PassThrough;
|
||||
const resolve_url = Url.resolve;
|
||||
|
||||
const isDomainOrSubdomain = function isDomainOrSubdomain(destination, original) {
|
||||
const orig = new URL$1(original).hostname;
|
||||
const dest = new URL$1(destination).hostname;
|
||||
|
||||
return orig === dest || orig[orig.length - dest.length - 1] === '.' && orig.endsWith(dest);
|
||||
};
|
||||
|
||||
/**
|
||||
* Fetch function
|
||||
@@ -1469,7 +1499,19 @@ function fetch(url, opts) {
|
||||
const location = headers.get('Location');
|
||||
|
||||
// HTTP fetch step 5.3
|
||||
const locationURL = location === null ? null : resolve_url(request.url, location);
|
||||
let locationURL = null;
|
||||
try {
|
||||
locationURL = location === null ? null : new URL$1(location, request.url).toString();
|
||||
} catch (err) {
|
||||
// error here can only be invalid URL in Location: header
|
||||
// do not throw when options.redirect == manual
|
||||
// let the user extract the errorneous redirect URL
|
||||
if (request.redirect !== 'manual') {
|
||||
reject(new FetchError(`uri requested responds with an invalid redirect URL: ${location}`, 'invalid-redirect'));
|
||||
finalize();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// HTTP fetch step 5.5
|
||||
switch (request.redirect) {
|
||||
@@ -1517,6 +1559,12 @@ function fetch(url, opts) {
|
||||
size: request.size
|
||||
};
|
||||
|
||||
if (!isDomainOrSubdomain(request.url, locationURL)) {
|
||||
for (const name of ['authorization', 'www-authenticate', 'cookie', 'cookie2']) {
|
||||
requestOpts.headers.delete(name);
|
||||
}
|
||||
}
|
||||
|
||||
// HTTP-redirect fetch step 9
|
||||
if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) {
|
||||
reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect'));
|
||||
|
||||
58
node_modules/node-fetch/lib/index.js
generated
vendored
58
node_modules/node-fetch/lib/index.js
generated
vendored
@@ -7,6 +7,7 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
||||
var Stream = _interopDefault(require('stream'));
|
||||
var http = _interopDefault(require('http'));
|
||||
var Url = _interopDefault(require('url'));
|
||||
var whatwgUrl = _interopDefault(require('whatwg-url'));
|
||||
var https = _interopDefault(require('https'));
|
||||
var zlib = _interopDefault(require('zlib'));
|
||||
|
||||
@@ -1141,11 +1142,32 @@ Object.defineProperty(Response.prototype, Symbol.toStringTag, {
|
||||
});
|
||||
|
||||
const INTERNALS$2 = Symbol('Request internals');
|
||||
const URL = Url.URL || whatwgUrl.URL;
|
||||
|
||||
// fix an issue where "format", "parse" aren't a named export for node <10
|
||||
const parse_url = Url.parse;
|
||||
const format_url = Url.format;
|
||||
|
||||
/**
|
||||
* Wrapper around `new URL` to handle arbitrary URLs
|
||||
*
|
||||
* @param {string} urlStr
|
||||
* @return {void}
|
||||
*/
|
||||
function parseURL(urlStr) {
|
||||
/*
|
||||
Check whether the URL is absolute or not
|
||||
Scheme: https://tools.ietf.org/html/rfc3986#section-3.1
|
||||
Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3
|
||||
*/
|
||||
if (/^[a-zA-Z][a-zA-Z\d+\-.]*:/.exec(urlStr)) {
|
||||
urlStr = new URL(urlStr).toString();
|
||||
}
|
||||
|
||||
// Fallback to old implementation for arbitrary URLs
|
||||
return parse_url(urlStr);
|
||||
}
|
||||
|
||||
const streamDestructionSupported = 'destroy' in Stream.Readable.prototype;
|
||||
|
||||
/**
|
||||
@@ -1182,14 +1204,14 @@ class Request {
|
||||
// in order to support Node.js' Url objects; though WHATWG's URL objects
|
||||
// will fall into this branch also (since their `toString()` will return
|
||||
// `href` property anyway)
|
||||
parsedURL = parse_url(input.href);
|
||||
parsedURL = parseURL(input.href);
|
||||
} else {
|
||||
// coerce input to a string before attempting to parse
|
||||
parsedURL = parse_url(`${input}`);
|
||||
parsedURL = parseURL(`${input}`);
|
||||
}
|
||||
input = {};
|
||||
} else {
|
||||
parsedURL = parse_url(input.url);
|
||||
parsedURL = parseURL(input.url);
|
||||
}
|
||||
|
||||
let method = init.method || input.method || 'GET';
|
||||
@@ -1383,9 +1405,17 @@ AbortError.prototype = Object.create(Error.prototype);
|
||||
AbortError.prototype.constructor = AbortError;
|
||||
AbortError.prototype.name = 'AbortError';
|
||||
|
||||
const URL$1 = Url.URL || whatwgUrl.URL;
|
||||
|
||||
// fix an issue where "PassThrough", "resolve" aren't a named export for node <10
|
||||
const PassThrough$1 = Stream.PassThrough;
|
||||
const resolve_url = Url.resolve;
|
||||
|
||||
const isDomainOrSubdomain = function isDomainOrSubdomain(destination, original) {
|
||||
const orig = new URL$1(original).hostname;
|
||||
const dest = new URL$1(destination).hostname;
|
||||
|
||||
return orig === dest || orig[orig.length - dest.length - 1] === '.' && orig.endsWith(dest);
|
||||
};
|
||||
|
||||
/**
|
||||
* Fetch function
|
||||
@@ -1473,7 +1503,19 @@ function fetch(url, opts) {
|
||||
const location = headers.get('Location');
|
||||
|
||||
// HTTP fetch step 5.3
|
||||
const locationURL = location === null ? null : resolve_url(request.url, location);
|
||||
let locationURL = null;
|
||||
try {
|
||||
locationURL = location === null ? null : new URL$1(location, request.url).toString();
|
||||
} catch (err) {
|
||||
// error here can only be invalid URL in Location: header
|
||||
// do not throw when options.redirect == manual
|
||||
// let the user extract the errorneous redirect URL
|
||||
if (request.redirect !== 'manual') {
|
||||
reject(new FetchError(`uri requested responds with an invalid redirect URL: ${location}`, 'invalid-redirect'));
|
||||
finalize();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// HTTP fetch step 5.5
|
||||
switch (request.redirect) {
|
||||
@@ -1521,6 +1563,12 @@ function fetch(url, opts) {
|
||||
size: request.size
|
||||
};
|
||||
|
||||
if (!isDomainOrSubdomain(request.url, locationURL)) {
|
||||
for (const name of ['authorization', 'www-authenticate', 'cookie', 'cookie2']) {
|
||||
requestOpts.headers.delete(name);
|
||||
}
|
||||
}
|
||||
|
||||
// HTTP-redirect fetch step 9
|
||||
if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) {
|
||||
reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect'));
|
||||
|
||||
58
node_modules/node-fetch/lib/index.mjs
generated
vendored
58
node_modules/node-fetch/lib/index.mjs
generated
vendored
@@ -1,6 +1,7 @@
|
||||
import Stream from 'stream';
|
||||
import http from 'http';
|
||||
import Url from 'url';
|
||||
import whatwgUrl from 'whatwg-url';
|
||||
import https from 'https';
|
||||
import zlib from 'zlib';
|
||||
|
||||
@@ -1135,11 +1136,32 @@ Object.defineProperty(Response.prototype, Symbol.toStringTag, {
|
||||
});
|
||||
|
||||
const INTERNALS$2 = Symbol('Request internals');
|
||||
const URL = Url.URL || whatwgUrl.URL;
|
||||
|
||||
// fix an issue where "format", "parse" aren't a named export for node <10
|
||||
const parse_url = Url.parse;
|
||||
const format_url = Url.format;
|
||||
|
||||
/**
|
||||
* Wrapper around `new URL` to handle arbitrary URLs
|
||||
*
|
||||
* @param {string} urlStr
|
||||
* @return {void}
|
||||
*/
|
||||
function parseURL(urlStr) {
|
||||
/*
|
||||
Check whether the URL is absolute or not
|
||||
Scheme: https://tools.ietf.org/html/rfc3986#section-3.1
|
||||
Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3
|
||||
*/
|
||||
if (/^[a-zA-Z][a-zA-Z\d+\-.]*:/.exec(urlStr)) {
|
||||
urlStr = new URL(urlStr).toString();
|
||||
}
|
||||
|
||||
// Fallback to old implementation for arbitrary URLs
|
||||
return parse_url(urlStr);
|
||||
}
|
||||
|
||||
const streamDestructionSupported = 'destroy' in Stream.Readable.prototype;
|
||||
|
||||
/**
|
||||
@@ -1176,14 +1198,14 @@ class Request {
|
||||
// in order to support Node.js' Url objects; though WHATWG's URL objects
|
||||
// will fall into this branch also (since their `toString()` will return
|
||||
// `href` property anyway)
|
||||
parsedURL = parse_url(input.href);
|
||||
parsedURL = parseURL(input.href);
|
||||
} else {
|
||||
// coerce input to a string before attempting to parse
|
||||
parsedURL = parse_url(`${input}`);
|
||||
parsedURL = parseURL(`${input}`);
|
||||
}
|
||||
input = {};
|
||||
} else {
|
||||
parsedURL = parse_url(input.url);
|
||||
parsedURL = parseURL(input.url);
|
||||
}
|
||||
|
||||
let method = init.method || input.method || 'GET';
|
||||
@@ -1377,9 +1399,17 @@ AbortError.prototype = Object.create(Error.prototype);
|
||||
AbortError.prototype.constructor = AbortError;
|
||||
AbortError.prototype.name = 'AbortError';
|
||||
|
||||
const URL$1 = Url.URL || whatwgUrl.URL;
|
||||
|
||||
// fix an issue where "PassThrough", "resolve" aren't a named export for node <10
|
||||
const PassThrough$1 = Stream.PassThrough;
|
||||
const resolve_url = Url.resolve;
|
||||
|
||||
const isDomainOrSubdomain = function isDomainOrSubdomain(destination, original) {
|
||||
const orig = new URL$1(original).hostname;
|
||||
const dest = new URL$1(destination).hostname;
|
||||
|
||||
return orig === dest || orig[orig.length - dest.length - 1] === '.' && orig.endsWith(dest);
|
||||
};
|
||||
|
||||
/**
|
||||
* Fetch function
|
||||
@@ -1467,7 +1497,19 @@ function fetch(url, opts) {
|
||||
const location = headers.get('Location');
|
||||
|
||||
// HTTP fetch step 5.3
|
||||
const locationURL = location === null ? null : resolve_url(request.url, location);
|
||||
let locationURL = null;
|
||||
try {
|
||||
locationURL = location === null ? null : new URL$1(location, request.url).toString();
|
||||
} catch (err) {
|
||||
// error here can only be invalid URL in Location: header
|
||||
// do not throw when options.redirect == manual
|
||||
// let the user extract the errorneous redirect URL
|
||||
if (request.redirect !== 'manual') {
|
||||
reject(new FetchError(`uri requested responds with an invalid redirect URL: ${location}`, 'invalid-redirect'));
|
||||
finalize();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// HTTP fetch step 5.5
|
||||
switch (request.redirect) {
|
||||
@@ -1515,6 +1557,12 @@ function fetch(url, opts) {
|
||||
size: request.size
|
||||
};
|
||||
|
||||
if (!isDomainOrSubdomain(request.url, locationURL)) {
|
||||
for (const name of ['authorization', 'www-authenticate', 'cookie', 'cookie2']) {
|
||||
requestOpts.headers.delete(name);
|
||||
}
|
||||
}
|
||||
|
||||
// HTTP-redirect fetch step 9
|
||||
if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) {
|
||||
reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect'));
|
||||
|
||||
22
node_modules/node-fetch/package.json
generated
vendored
22
node_modules/node-fetch/package.json
generated
vendored
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "node-fetch",
|
||||
"version": "2.6.1",
|
||||
"version": "2.6.7",
|
||||
"description": "A light-weight module that brings window.fetch to node.js",
|
||||
"main": "lib/index",
|
||||
"main": "lib/index.js",
|
||||
"browser": "./browser.js",
|
||||
"module": "lib/index.mjs",
|
||||
"files": [
|
||||
@@ -36,6 +36,17 @@
|
||||
"url": "https://github.com/bitinn/node-fetch/issues"
|
||||
},
|
||||
"homepage": "https://github.com/bitinn/node-fetch",
|
||||
"dependencies": {
|
||||
"whatwg-url": "^5.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"encoding": "^0.1.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"encoding": {
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ungap/url-search-params": "^0.1.2",
|
||||
"abort-controller": "^1.1.0",
|
||||
@@ -48,7 +59,7 @@
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"chai-iterator": "^1.1.1",
|
||||
"chai-string": "~1.3.0",
|
||||
"codecov": "^3.3.0",
|
||||
"codecov": "3.3.0",
|
||||
"cross-env": "^5.2.0",
|
||||
"form-data": "^2.3.3",
|
||||
"is-builtin-module": "^1.0.0",
|
||||
@@ -60,7 +71,6 @@
|
||||
"rollup": "^0.63.4",
|
||||
"rollup-plugin-babel": "^3.0.7",
|
||||
"string-to-arraybuffer": "^1.0.2",
|
||||
"whatwg-url": "^5.0.0"
|
||||
},
|
||||
"dependencies": {}
|
||||
"teeny-request": "3.7.0"
|
||||
}
|
||||
}
|
||||
370
node_modules/sinon/AUTHORS
generated
vendored
370
node_modules/sinon/AUTHORS
generated
vendored
@@ -1,370 +0,0 @@
|
||||
Morgan Roderick <morgan@roderick.dk>
|
||||
Christian Johansen <christian@cjohansen.no>
|
||||
Carl-Erik Kopseng <carlerik@gmail.com>
|
||||
Maximilian Antoni <mail@maxantoni.de>
|
||||
Phred <fearphage@gmail.com>
|
||||
Jonny Reeves <github@jonnyreeves.co.uk>
|
||||
lucasfcosta <fernandesdacostalucas@gmail.com>
|
||||
dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
|
||||
ben hockey <neonstalwart@gmail.com>
|
||||
dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
|
||||
Tim Fischbach <mail@timfischbach.de>
|
||||
takasmiley <takasmiley@live.jp>
|
||||
Håvard Wormdal Høiby <havardwhoiby@gmail.com>
|
||||
Tim Ruffles <timruffles@googlemail.com>
|
||||
Piotr Jamroz <piotr.jamroz@ig.com>
|
||||
Jonathan Sokolowski <jonathan.sokolowski@gmail.com>
|
||||
Andreas Lind <andreas@one.com>
|
||||
Domenic Denicola <domenic@domenicdenicola.com>
|
||||
William Sears <MrBigDog2U@gmail.com>
|
||||
Tim Perry <pimterry@gmail.com>
|
||||
Mikhail Gusarov <mikhail@hola.org>
|
||||
Marc Redemske <marc.redemske@gmail.com>
|
||||
Dominykas Blyžė <hello@dominykas.com>
|
||||
Bryan Donovan <bdondo@gmail.com>
|
||||
Felix Geisendörfer <felix@debuggable.com>
|
||||
kpdecker <kpdecker@gmail.com>
|
||||
Flarna <deb2001-github@yahoo.de>
|
||||
Tobias Ebnöther <ebi@gorn.ch>
|
||||
Tristan Koch <tristan.koch@1und1.de>
|
||||
Doug Orleans <dougorleans@gmail.com>
|
||||
Keith Cirkel <github@keithcirkel.co.uk>
|
||||
Martin Sander <forke@uni-bonn.de>
|
||||
Andrew Gurinovich <altmind@gmail.com>
|
||||
Adam Hull <adam@hmlad.com>
|
||||
Cory <seeflanigan@gmail.com>
|
||||
Aleck Greenham <greenhama13@gmail.com>
|
||||
Luis Cardoso <luis.cardoso@feedzai.com>
|
||||
GCHQDeveloper500 <32099399+GCHQDeveloper500@users.noreply.github.com>
|
||||
Dustin Farris <dustin@farris.io>
|
||||
Konrad Holowinski <konrad.holowinski@gmail.com>
|
||||
Gavin Huang <gravof@gmail.com>
|
||||
ben fleis <ben.fleis@gmail.com>
|
||||
Krzysztof Kaczor <chris@kaczor.io>
|
||||
Jay Sherby <jaysherby@gmail.com>
|
||||
Marten Lienen <marten.lienen@gmail.com>
|
||||
Carolyn Stransky <carolynstransky@gmail.com>
|
||||
Viktor Zozulyak <zozulyakviktor@gmail.com>
|
||||
zcicala <zcicala@fitbit.com>
|
||||
Mahmoud Gamal <mgamal@babbel.com>
|
||||
Eyal Arubas <eyalarubas@gmail.com>
|
||||
Benjamin Coe <ben@yesware.com>
|
||||
Travis Kaufman <travis.kaufman@gmail.com>
|
||||
Garrick Cheung <garrick@garrickcheung.com>
|
||||
Florent Jaby <florent.jaby@gmail.com>
|
||||
Craig Davis <craig-davis@users.noreply.github.com>
|
||||
Dmitriy Kubyshkin <grassator@gmail.com>
|
||||
Rens Groothuijsen <l.groothuijsen@alumni.maastrichtuniversity.nl>
|
||||
Adhya Pranata <adhyapranata@gmail.com>
|
||||
Thomas Meyer <meyertee@gmail.com>
|
||||
Cormac Flynn <cormac.flynn@viadeoteam.com>
|
||||
geries <geries.handal@videoplaza.com>
|
||||
Márton Salomváry <salomvary@gmail.com>
|
||||
Roman Potashow <justgook@gmail.com>
|
||||
Islam Sharabash <islam.sharabash@gmail.com>
|
||||
Kir Chou <note351@hotmail.com>
|
||||
Rae Liu <happyaray@gmail.com>
|
||||
Glen Mailer <glen.mailer@bskyb.com>
|
||||
Garrick <gcheung@fitbit.com>
|
||||
Soutaro Matsumoto <matsumoto@soutaro.com>
|
||||
August Lilleaas <august.lilleaas@gmail.com>
|
||||
Robin Pedersen <robinp@snap.tv>
|
||||
Scott Andrews <scothis@gmail.com>
|
||||
George Schneeloch <gschneel@mit.edu>
|
||||
Tamas Szebeni <tamas_szebeni@epam.com>
|
||||
Jmeas <jellyes2@gmail.com>
|
||||
Tim Costa <tcosta@2u.com>
|
||||
sjoseph7 <17250762+sjoseph7@users.noreply.github.com>
|
||||
Ming Liu <vmliu1@gmail.com>
|
||||
Duncan Beevers <duncan@dweebd.com>
|
||||
なつき <i@ntk.me>
|
||||
Nathan Mahdavi <mail@nathanmahdavi.com>
|
||||
Nathan Perry <nateperry333@gmail.com>
|
||||
Nicholas Hinds <hindsn@gmail.com>
|
||||
Brandon Heyer <brandonheyer@gmail.com>
|
||||
Nico Jansen <jansennico@gmail.com>
|
||||
Jason Karns <jason.karns@gmail.com>
|
||||
Jeffrey Falgout <jeffrey.falgout@gmail.com>
|
||||
Jimmy Shimizu <jimmy.shimizu@springworks.se>
|
||||
Elad Nachmias <theman@elad.im>
|
||||
John-David Dalton <john.david.dalton@gmail.com>
|
||||
Piotr Jamróz <pm.jamroz@gmail.com>
|
||||
Jonathan Freeman <freethejazz@gmail.com>
|
||||
Alexander Schmidt <alexanderschmidt1@gmail.com>
|
||||
Emma Bukacek <emma.bukacek@gmail.com>
|
||||
RealZogger <49367953+RealZogger@users.noreply.github.com>
|
||||
Evan Lloyd <evan.u.lloyd@gmail.com>
|
||||
Farid Neshat <FaridN_SOAD@yahoo.com>
|
||||
Josh Graham <josh@canva.com>
|
||||
Josh Greenberger <jdgreenb@usc.edu>
|
||||
43081j <43081j@users.noreply.github.com>
|
||||
Satoshi Nakamura <snakamura@infoteria.com>
|
||||
Chris Breiding <chrisbreiding@gmail.com>
|
||||
Sebastian Van Sande <sebastian@vansande.org>
|
||||
G.Serebryanskyi <x5x3x5x@gmail.com>
|
||||
Simen Bekkhus <sbekkhus91@gmail.com>
|
||||
Spencer Elliott <me@elliottsj.com>
|
||||
Christoph Guttandin <chrisguttandin@media-codings.com>
|
||||
Szymon Przybylski <szymon.przybylski@gmail.com>
|
||||
Louis Brunner <louis.brunner.fr@gmail.com>
|
||||
Tarjei Huse <tarjei.huse@gmail.com>
|
||||
Gyandeep Singh <gyandeeps@gmail.com>
|
||||
Afnizar Nur Ghifari <afnizarnur@users.noreply.github.com>
|
||||
Henry Tung <henryptung@gmail.com>
|
||||
Marcus Hüsgen <marcus.huesgen@lusini.com>
|
||||
Victor Costan <costan@gmail.com>
|
||||
Hugo Muller <hugo.muller@free.fr>
|
||||
Mark Stacey <mark.stacey@amecfw.com>
|
||||
Daniel Rey Lopez <daniel.rey.lopez@automattic.com>
|
||||
Alex Puchades <alex94puchades@gmail.com>
|
||||
Igor Savin <kibertoad@gmail.com>
|
||||
Zach Bloomquist <github@chary.us>
|
||||
Martin Hansen <martin@martinhansen.no>
|
||||
Irina Dumitrascu <me@dira.ro>
|
||||
blacksun1 <simon@blacksun.cx>
|
||||
Matt Kern <matt@bloomcrush.com>
|
||||
Max Calabrese <max.calabrese@ymail.com>
|
||||
Aaron <aaron.todd@gmail.com>
|
||||
gtothesquare <me@gerieshandal.com>
|
||||
Alex Urbano <asgaroth.belem@gmail.com>
|
||||
Jacob Page <jpage@godaddy.com>
|
||||
Michael Herman <hermanmu@gmail.com>
|
||||
David Mott <dpmott@sep.com>
|
||||
Andrzej Porebski <fkuciapa@yahoo.com>
|
||||
Jakob Jónasson <jakob.jonasson@gmail.com>
|
||||
James Barwell <jb@jamesbarwell.co.uk>
|
||||
mohayonao <mohayonao@gmail.com>
|
||||
Devin Weaver <suki@tritarget.org>
|
||||
nivsherf <nivsherf@gmail.com>
|
||||
romanbalayan <roman.balayan@gmail.com>
|
||||
vitalets <vitalets@yandex-team.ru>
|
||||
yoshimura-toshihide <toshihide0105yoshimura@gmail.com>
|
||||
Nathan Friedly <nathan@nfriedly.com>
|
||||
Rajeesh C V <cvrajeesh@gmail.com>
|
||||
Raul Matei <raul.matei@8x8.com>
|
||||
Raynos <raynos2@gmail.com>
|
||||
ReadmeCritic <frankensteinbot@gmail.com>
|
||||
Revath S Kumar <revathskumar@users.noreply.github.com>
|
||||
Rich Hodgkins <rhodgkins@gmail.com>
|
||||
Richard Lyon <richthegeek@gmail.com>
|
||||
Richard Torres <richardtorres314@gmail.com>
|
||||
Rodion Vynnychenko <roddiku@gmail.com>
|
||||
Rodrigo García <yo@rodrigogarcia.me>
|
||||
Roland Warmerdam <roland@segment.com>
|
||||
Romain Pellerin <rpellerin@users.noreply.github.com>
|
||||
Ruwan Pradeep Geeganage <rpgeeganage@users.noreply.github.com>
|
||||
Ryan Roemer <ryan@loose-bits.com>
|
||||
Ryan Wholey <rjwholey@gmail.com>
|
||||
STuFF <nchalleil@gmail.com>
|
||||
Sam Landfried <samlandfried@gmail.com>
|
||||
Saurav Azad <3856934+sauravazad@users.noreply.github.com>
|
||||
Scott Rudiger <scottrudiger@gmail.com>
|
||||
Sergio Cinos <scinos@atlassian.com>
|
||||
Serkan Özel <serkanozel380@gmail.com>
|
||||
Shaine Hatch <shainehatch@overstock.com>
|
||||
Shawn Krisman <skrisman@nodelings>
|
||||
Shinnosuke Watanabe <snnskwtnb@gmail.com>
|
||||
Simone Fonda <fonda@netseven.it>
|
||||
Sinan Bolel <1915925+sbolel@users.noreply.github.com>
|
||||
Stefan Weil <sw@weilnetz.de>
|
||||
Stefan du Fresne <stefan@sdufresne.info>
|
||||
StefanSchoof <Stefan.Schoof@direkt-gruppe.de>
|
||||
Stephen Burrows <stephen.r.burrows@gmail.com>
|
||||
Steven Lu <stevenlu443@gmail.com>
|
||||
Sven Fuchs <svenfuchs@artweb-design.de>
|
||||
Søren Enemærke <soren.enemaerke@gmail.com>
|
||||
T1st3 <contact@tiste.org>
|
||||
TEHEK Firefox <tehek@tehek.net>
|
||||
Tek Nynja <github@teknynja.com>
|
||||
The Gitter Badger <badger@gitter.im>
|
||||
Thomas Biesemann <thomas.biesemann@sap.com>
|
||||
Tieme van Veen <tiemevanveen@hotmail.com>
|
||||
Tim Branyen <tim@tabdeveloper.com>
|
||||
Tim Li <zhengang@sine.co>
|
||||
Tim Wienk <tim@wienk.name>
|
||||
Timo Tijhof <krinklemail@gmail.com>
|
||||
Tobias Mansfield-Williams <tmansfield-williams@esri.com>
|
||||
Tomek Wytrębowicz <tomalecpub@gmail.com>
|
||||
Valentin Agachi <github-com@agachi.name>
|
||||
Vignesh Kumar <vigneshkumar646@gmail.com>
|
||||
Volkan Ozcelik <volkan.ozcelik@jivesoftware.com>
|
||||
Vynce Montgomery <vynce.montgomery@gmail.com>
|
||||
White, Ben <ben.white@jpmchase.com>
|
||||
Whymarrh Whitby <whymarrh.whitby@gmail.com>
|
||||
Will Butler <will@butlerhq.com>
|
||||
William Meleyal <w.meleyal@wollzelle.com>
|
||||
Yury Fedorov <10244414+orlangure@users.noreply.github.com>
|
||||
Zakir <zak.saifi7@gmail.com>
|
||||
Zhengang Li <huttli@users.noreply.github.com>
|
||||
andrew <andrew.derozario@online-pajak.com>
|
||||
charlierudolph <charles.w.rudolph@gmail.com>
|
||||
clint <clint@wealthfront.com>
|
||||
codejedi365 <codejedi365@users.noreply.github.com>
|
||||
ehmicky <ehmicky@gmail.com>
|
||||
goligo <ich@malte.de>
|
||||
hannes <github@htmlcss.de>
|
||||
hashchange <heim@zeilenwechsel.de>
|
||||
ichthala <alice.mottola@gmail.com>
|
||||
jamestalmage <james.talmage@jrtechnical.com>
|
||||
jshayes <justin@yolk.ai>
|
||||
kbackowski <kbackowski@gmail.com>
|
||||
mareq <mareq@balint.eu>
|
||||
mbehboodian <morteza6909@gmail.com>
|
||||
ngryman <ngryman@gmail.com>
|
||||
niftylettuce <niftylettuce@gmail.com>
|
||||
simonzack <simonzack@gmail.com>
|
||||
stevesouth <stephen.south@caplin.com>
|
||||
stoically <stoically@protonmail.com>
|
||||
thefourtheye <thefourtheye@users.noreply.github.com>
|
||||
till <till@php.net>
|
||||
vsa <vsa@users.noreply.github.com>
|
||||
wwalser <waw325@gmail.com>
|
||||
Xiao Ma <x@medium.com>
|
||||
AJ Ortega <ajo@google.com>
|
||||
Adam Lynch <contact@adamlynch.com>
|
||||
AdilKhn <AdilKhn@users.noreply.github.com>
|
||||
Aditya Vohra <avohra@yelp.com>
|
||||
Adrian Phinney <adrian.phinney@bellaliant.net>
|
||||
Adrian Schmidt <adrian.schmidt@lime.tech>
|
||||
Akira Matsuda <ronnie@dio.jp>
|
||||
Aleksey Bobyr <aleksey.bobyr@beetroot.se>
|
||||
Alex Ghiculescu <alex@tanda.co>
|
||||
Alex Kessaris <alex@artsy.ca>
|
||||
Alex Tran <alex@Alexs-MacBook-Pro-2.local>
|
||||
Alexander Aivars <alex@aivars.se>
|
||||
Alexey Kucherenko <alexei.kucherenko@gmail.com>
|
||||
Alexsey <agat00@gmail.com>
|
||||
Alfonso Boza <alfonso@cloud.com>
|
||||
Ali Shakiba <ali@shakiba.me>
|
||||
Andrew Fong <afong@slack-corp.com>
|
||||
Andrew Leschinsky <andrew@leschinsky.com>
|
||||
Andrew Shirley <andrew@als-bi.com>
|
||||
Antonio D'Ettole <antonio@brandwatch.com>
|
||||
Auclair Emmanuel <auclair.emmanuel.prestataire@sfr.com>
|
||||
Aziz Punjani <aziz.punjani@gmail.com>
|
||||
Ben Brostoff <ben.brostoff@gmail.com>
|
||||
Ben Lertlumprasertkul <Ben.Lertlumprasertkul@ig.com>
|
||||
Bing Ren <bingtimren@gmail.com>
|
||||
Blaine Bublitz <blaine@iceddev.com>
|
||||
Blake Embrey <hello@blakeembrey.com>
|
||||
Blake Israel <blake.israel@gatech.edu>
|
||||
Boshen Chen <boshenc@gmail.com>
|
||||
Brandon Au <brandon.au@drexel.edu>
|
||||
Brett Zamir <brettz9@yahoo.com>
|
||||
Brian Bleakley <brianbleakley@gmail.com>
|
||||
Brian M Hunt <brianmhunt@gmail.com>
|
||||
Burak Yiğit Kaya <ben@byk.im>
|
||||
C. T. Lin <chentsulin@gmail.com>
|
||||
Crimson-riot <74468835+Crimson-riot@users.noreply.github.com>
|
||||
Dan Bird <danielsbird@gmail.com>
|
||||
Dan Peddle <dazld@users.noreply.github.com>
|
||||
Daniel Rentz <daniel.rentz@open-xchange.com>
|
||||
Daryl Lau <daryl@goodeggs.com>
|
||||
David Colucci <davidanthonycolucci@gmail.com>
|
||||
David Hayes <drhayes@users.noreply.github.com>
|
||||
David Hunt <davidhunt@Davids-MBP.local>
|
||||
Dean Sofer <ProLoser@users.noreply.github.com>
|
||||
Duc Tri Le <duc1@email.tiger-inc.com>
|
||||
Eduardo Diaz <eduardo.diaz@auth0.com>
|
||||
Eli White <github@eli-white.com>
|
||||
Eric Stobbart <Eric_Stobbart@comcast.com>
|
||||
Eric Wendelin <ewendelin@twitter.com>
|
||||
Ericat <erica.salvaneschi@gmail.com>
|
||||
Feiyang1 <plane1113@gmail.com>
|
||||
Felipe Carasso <felipe@carassonet.org>
|
||||
Franck Romano <fra@octo.com>
|
||||
GProst <gprostmail@gmail.com>
|
||||
Gabe Jackson <gj@mail.co.de>
|
||||
Gavin Boulton <gavin.boulton@digital.cabinet-office.gov.uk>
|
||||
Gerhard Stöbich <18708370+Flarna@users.noreply.github.com>
|
||||
Gilad Peleg <giladp007@gmail.com>
|
||||
Giorgos Giannoutsos <contact@nuc.gr>
|
||||
Gord Tanner <gord@tinyhippos.com>
|
||||
Gordon L. Hempton <ghempton@gmail.com>
|
||||
Gvozd <gvozdev.viktor@gmail.com>
|
||||
Harry Wolff <hswolff@gmail.com>
|
||||
HugoMuller <hmu@debian-hmu-dev>
|
||||
Ian Lewis <IanMLewis@gmail.com>
|
||||
Ian Thomas <ian@ian-thomas.net>
|
||||
Irving <Irvingb232@gmail.com>
|
||||
J France <jason.a.france@gmail.com>
|
||||
Jack Brown <jack.brown@mi9.com.au>
|
||||
Jahangir Iqbal <35706211+jiqbal48@users.noreply.github.com>
|
||||
Jake Champion <me@jakechampion.name>
|
||||
James Beavers <jamesjbeavers@gmail.com>
|
||||
James M. Greene <james.m.greene@gmail.com>
|
||||
Jan Kopriva <jan.kopriva@gooddata.com>
|
||||
Jan Suchý <jan.sandokan@gmail.com>
|
||||
Jani Hartikainen <jani.hartikainen@gmail.com>
|
||||
Jason Anderson <diurnalist@gmail.com>
|
||||
Joakim Wimmerstedt <joakim.wimmerstedt@gmail.com>
|
||||
Jochen Preusche <iilei@users.noreply.github.com>
|
||||
Johann Hubert Sonntagbauer <johann.sonntagbauer@gmx.at>
|
||||
John Bernardo <jbernardo@linkedin.com>
|
||||
Jonathan Roitgrund <jroitgrund@gmail.com>
|
||||
Jordan Harband <ljharb@gmail.com>
|
||||
Jordan Hawker <hawker.jordan@gmail.com>
|
||||
Joseph Evans <evonsdesigns@gmail.com>
|
||||
Joseph Spens <joseph@workmarket.com>
|
||||
Josh Goldberg <josh@fullscreenmario.com>
|
||||
Joshua Campbell <joshcampbell191@users.noreply.github.com>
|
||||
JoshuaCWebDeveloper <coosriverjoshua1@outlook.com>
|
||||
Juntao Zeng <31234156+juntaozeng@users.noreply.github.com>
|
||||
Kalisa Falzone <KalisaFalzone@users.noreply.github.com>
|
||||
Katrina Theodosopoulos <katrinaelaine6@gmail.com>
|
||||
Keith Rogers <git@keithrogers.eu>
|
||||
Kelly Selden <kellyselden@gmail.com>
|
||||
Kenneth Williams <scriptdaemon@gmail.com>
|
||||
Kev <lineus@gmail.com>
|
||||
Kevin Bosman <kevinbosman@users.noreply.github.com>
|
||||
Kevin Ennis <kennis84@gmail.com>
|
||||
Kevin Turner <kevin@decipherinc.com>
|
||||
Kim Joar Bekkelund <kjbekkelund@gmail.com>
|
||||
Kim Schmider <kim366@users.noreply.github.com>
|
||||
Kris Kowal <kris.kowal@cixar.com>
|
||||
Kristian <krisham87@hotmail.com>
|
||||
Kuba Orlik <kontakt@jakub-orlik.pl>
|
||||
Kurt Ruppel <me@kurtruppel.com>
|
||||
Lars Thorup <lars@zealake.com>
|
||||
LboAnn <extend1994@gmail.com>
|
||||
LostArchives <valentin.mullet@gmail.com>
|
||||
Lucas Vieira <vieiralucas@users.noreply.github.com>
|
||||
Luchs <Luchs@euirc.eu>
|
||||
Maarten Tromp <maarten@nouncy.com>
|
||||
Marco Ramirez <marco-ramirez@bankofamerica.com>
|
||||
Marcos Vanetta <marcos_vanetta@condenast.com>
|
||||
Mario Pareja <mpareja@360incentives.com>
|
||||
Mark Banner <standard8@mozilla.com>
|
||||
Mark Gibson <mgibson@adaptavist.com>
|
||||
Mark Stickley <markstickley@users.noreply.github.com>
|
||||
Martin Brochhaus <mbrochh@gmail.com>
|
||||
Martin Körner <martin.koerner@objectfab.de>
|
||||
Matthew Gabeler-Lee <mgabeler-lee@6river.com>
|
||||
Matthew Williams <mrwillihog@users.noreply.github.com>
|
||||
Max Klymyshyn <klymyshyn@gmail.com>
|
||||
Maxim Tsoy <maks.tsoy@gmail.com>
|
||||
Michael David Kuckuk <mdk@kuckuk.com>
|
||||
Michael Jackson <mjijackson@gmail.com>
|
||||
Michael Paulukonis <xraysmalevich@gmail.com>
|
||||
Michał Perłakowski <michal@perlakowski.pl>
|
||||
Mike Eve <ungrim97@gmail.com>
|
||||
Mike Flanigan <mkflan@gmail.com>
|
||||
Mikolaj Banasik <d1sover@gmail.com>
|
||||
MouseZero <rm@mousezero.com>
|
||||
Munieru <20086673+munierujp@users.noreply.github.com>
|
||||
Mustafa Sak <mustafa.sak@1und1.de>
|
||||
Nelson Silva <nelson.silva@inevo.pt>
|
||||
Nicholas Stephan <nicholas.stephan@gmail.com>
|
||||
Nicu Micleușanu <micnic90@gmail.com>
|
||||
Nikita Litvin <deltaidea@derpy.ru>
|
||||
Niklas Andreasson <eaglus_@hotmail.com>
|
||||
Noam Paz <noam.paz@gmail.com>
|
||||
Olmo Maldonado <olmo.maldonado@gmail.com>
|
||||
Paul Barry <paul@Pauls-Air.fios-router.home>
|
||||
Pelle Wessman <pelle@kodfabrik.se>
|
||||
Petar Dochev <dotchev@gmail.com>
|
||||
Peter Grainger <peter@grainger.xyz>
|
||||
Peter Zsoldos <peter.zsoldos@gmail.com>
|
||||
Pia Mancini <piamancini@gmail.com>
|
||||
Piper Chester <piperchester@users.noreply.github.com>
|
||||
Prayag Verma <prayag.verma@gmail.com>
|
||||
1662
node_modules/sinon/CHANGELOG.md
generated
vendored
1662
node_modules/sinon/CHANGELOG.md
generated
vendored
File diff suppressed because it is too large
Load Diff
4
node_modules/sinon/README.md
generated
vendored
4
node_modules/sinon/README.md
generated
vendored
@@ -23,11 +23,13 @@
|
||||
<a href="CODE_OF_CONDUCT.md"><img src="https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg" alt="Contributor Covenant" /></a>
|
||||
</p>
|
||||
|
||||
<!-- Shows an outdated badge. Will not be fixed until https://github.com/sinonjs/fake-timers/pull/395 ships.
|
||||
<p align=center>
|
||||
<a href="https://app.saucelabs.com/u/sinonjs">
|
||||
<img src="https://app.saucelabs.com/browser-matrix/sinonjs.svg" alt="Sauce Test Status"/>
|
||||
</a>
|
||||
</a>
|
||||
</p>
|
||||
-->
|
||||
|
||||
## Compatibility
|
||||
|
||||
|
||||
BIN
node_modules/sinon/lib/.DS_Store
generated
vendored
BIN
node_modules/sinon/lib/.DS_Store
generated
vendored
Binary file not shown.
3
node_modules/sinon/lib/package.json
generated
vendored
Normal file
3
node_modules/sinon/lib/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "commonjs"
|
||||
}
|
||||
14
node_modules/sinon/lib/sinon/assert.js
generated
vendored
14
node_modules/sinon/lib/sinon/assert.js
generated
vendored
@@ -159,10 +159,16 @@ function createAssertObject() {
|
||||
callCount: function assertCallCount(method, count) {
|
||||
verifyIsStub(method);
|
||||
|
||||
if (method.callCount !== count) {
|
||||
var msg = `expected %n to be called ${timesInWords(
|
||||
count
|
||||
)} but was called %c%C`;
|
||||
var msg;
|
||||
if (typeof count !== "number") {
|
||||
msg =
|
||||
`expected ${format(count)} to be a number ` +
|
||||
`but was of type ${typeof count}`;
|
||||
failAssertion(this, msg);
|
||||
} else if (method.callCount !== count) {
|
||||
msg =
|
||||
`expected %n to be called ${timesInWords(count)} ` +
|
||||
`but was called %c%C`;
|
||||
failAssertion(this, method.printf(msg));
|
||||
} else {
|
||||
assert.pass("callCount");
|
||||
|
||||
2
node_modules/sinon/lib/sinon/promise.js
generated
vendored
2
node_modules/sinon/lib/sinon/promise.js
generated
vendored
@@ -8,7 +8,7 @@ var STATUS_RESOLVED = "resolved";
|
||||
var STATUS_REJECTED = "rejected";
|
||||
|
||||
/**
|
||||
* Returns a fake for a given function or undefined. If no functino is given, a
|
||||
* Returns a fake for a given function or undefined. If no function is given, a
|
||||
* new fake is returned. If the given function is already a fake, it is
|
||||
* returned as is. Otherwise the given function is wrapped in a new fake.
|
||||
*
|
||||
|
||||
3
node_modules/sinon/lib/sinon/proxy-call.js
generated
vendored
3
node_modules/sinon/lib/sinon/proxy-call.js
generated
vendored
@@ -220,7 +220,8 @@ var callProto = {
|
||||
}
|
||||
}
|
||||
if (this.stack) {
|
||||
// Omit the error message and the two top stack frames in sinon itself:
|
||||
// If we have a stack, add the first frame that's in end-user code
|
||||
// Skip the first two frames because they will refer to Sinon code
|
||||
callStr += (this.stack.split("\n")[3] || "unknown").replace(
|
||||
/^\s*(?:at\s+|@)?/,
|
||||
" at "
|
||||
|
||||
10
node_modules/sinon/lib/sinon/proxy.js
generated
vendored
10
node_modules/sinon/lib/sinon/proxy.js
generated
vendored
@@ -120,16 +120,16 @@ var proxyApi = {
|
||||
var args = slice(arguments, 1);
|
||||
var formatter;
|
||||
|
||||
return (format || "").replace(/%(.)/g, function (match, specifyer) {
|
||||
formatter = proxyApi.formatters[specifyer];
|
||||
return (format || "").replace(/%(.)/g, function (match, specifier) {
|
||||
formatter = proxyApi.formatters[specifier];
|
||||
|
||||
if (typeof formatter === "function") {
|
||||
return String(formatter(spyInstance, args));
|
||||
} else if (!isNaN(parseInt(specifyer, 10))) {
|
||||
return sinonFormat(args[specifyer - 1]);
|
||||
} else if (!isNaN(parseInt(specifier, 10))) {
|
||||
return sinonFormat(args[specifier - 1]);
|
||||
}
|
||||
|
||||
return `%${specifyer}`;
|
||||
return `%${specifier}`;
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
22
node_modules/sinon/lib/sinon/spy-formatters.js
generated
vendored
22
node_modules/sinon/lib/sinon/spy-formatters.js
generated
vendored
@@ -72,29 +72,29 @@ module.exports = {
|
||||
j < calledArgs.length || j < expectedArgs.length;
|
||||
++j
|
||||
) {
|
||||
if (calledArgs[j]) {
|
||||
calledArgs[j] = quoteStringValue(calledArgs[j]);
|
||||
var calledArg = calledArgs[j];
|
||||
var expectedArg = expectedArgs[j];
|
||||
if (calledArg) {
|
||||
calledArg = quoteStringValue(calledArg);
|
||||
}
|
||||
|
||||
if (expectedArgs[j]) {
|
||||
expectedArgs[j] = quoteStringValue(expectedArgs[j]);
|
||||
if (expectedArg) {
|
||||
expectedArg = quoteStringValue(expectedArg);
|
||||
}
|
||||
|
||||
message += "\n";
|
||||
|
||||
var calledArgMessage =
|
||||
j < calledArgs.length ? sinonFormat(calledArgs[j]) : "";
|
||||
if (match.isMatcher(expectedArgs[j])) {
|
||||
j < calledArgs.length ? sinonFormat(calledArg) : "";
|
||||
if (match.isMatcher(expectedArg)) {
|
||||
message += colorSinonMatchText(
|
||||
expectedArgs[j],
|
||||
calledArgs[j],
|
||||
expectedArg,
|
||||
calledArg,
|
||||
calledArgMessage
|
||||
);
|
||||
} else {
|
||||
var expectedArgMessage =
|
||||
j < expectedArgs.length
|
||||
? sinonFormat(expectedArgs[j])
|
||||
: "";
|
||||
j < expectedArgs.length ? sinonFormat(expectedArg) : "";
|
||||
var diff = jsDiff.diffJson(
|
||||
calledArgMessage,
|
||||
expectedArgMessage
|
||||
|
||||
33
node_modules/sinon/lib/sinon/stub.js
generated
vendored
33
node_modules/sinon/lib/sinon/stub.js
generated
vendored
@@ -81,6 +81,9 @@ function stub(object, property) {
|
||||
}
|
||||
|
||||
var actualDescriptor = getPropertyDescriptor(object, property);
|
||||
|
||||
assertValidPropertyDescriptor(actualDescriptor, property);
|
||||
|
||||
var isObjectOrFunction =
|
||||
typeof object === "object" || typeof object === "function";
|
||||
var isStubbingEntireObject =
|
||||
@@ -147,6 +150,36 @@ stub.createStubInstance = function (constructor, overrides) {
|
||||
return stubbedObject;
|
||||
};
|
||||
|
||||
function assertValidPropertyDescriptor(descriptor, property) {
|
||||
if (!descriptor || !property) {
|
||||
return;
|
||||
}
|
||||
if (!descriptor.configurable && !descriptor.writable) {
|
||||
throw new TypeError(
|
||||
`Descriptor for property ${property} is non-configurable and non-writable`
|
||||
);
|
||||
}
|
||||
if ((descriptor.get || descriptor.set) && !descriptor.configurable) {
|
||||
throw new TypeError(
|
||||
`Descriptor for accessor property ${property} is non-configurable`
|
||||
);
|
||||
}
|
||||
if (isDataDescriptor(descriptor) && !descriptor.writable) {
|
||||
throw new TypeError(
|
||||
`Descriptor for data property ${property} is non-writable`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function isDataDescriptor(descriptor) {
|
||||
return (
|
||||
!descriptor.value &&
|
||||
!descriptor.writable &&
|
||||
!descriptor.set &&
|
||||
!descriptor.get
|
||||
);
|
||||
}
|
||||
|
||||
/*eslint-disable no-use-before-define*/
|
||||
function getParentBehaviour(stubInstance) {
|
||||
return stubInstance.parent && getCurrentBehavior(stubInstance.parent);
|
||||
|
||||
BIN
node_modules/sinon/lib/sinon/util/.DS_Store
generated
vendored
BIN
node_modules/sinon/lib/sinon/util/.DS_Store
generated
vendored
Binary file not shown.
BIN
node_modules/sinon/lib/sinon/util/core/.DS_Store
generated
vendored
BIN
node_modules/sinon/lib/sinon/util/core/.DS_Store
generated
vendored
Binary file not shown.
2
node_modules/sinon/lib/sinon/util/core/extend.js
generated
vendored
2
node_modules/sinon/lib/sinon/util/core/extend.js
generated
vendored
@@ -108,7 +108,7 @@ module.exports = function extend(target, ...sources) {
|
||||
};
|
||||
/*
|
||||
if the sorce has an Accessor property copy over the accessor functions (get and set)
|
||||
data properties has writable attribute where as acessor property don't
|
||||
data properties has writable attribute where as accessor property don't
|
||||
REF: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#properties
|
||||
*/
|
||||
|
||||
|
||||
11
node_modules/sinon/node_modules/@sinonjs/fake-timers/LICENSE
generated
vendored
Normal file
11
node_modules/sinon/node_modules/@sinonjs/fake-timers/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
Copyright (c) 2010-2014, Christian Johansen, christian@cjohansen.no. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
352
node_modules/sinon/node_modules/@sinonjs/fake-timers/README.md
generated
vendored
Normal file
352
node_modules/sinon/node_modules/@sinonjs/fake-timers/README.md
generated
vendored
Normal file
@@ -0,0 +1,352 @@
|
||||
# `@sinonjs/fake-timers`
|
||||
|
||||
[](https://circleci.com/gh/sinonjs/fake-timers)
|
||||
[](https://codecov.io/gh/sinonjs/fake-timers)
|
||||
<a href="CODE_OF_CONDUCT.md"><img src="https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg" alt="Contributor Covenant" /></a>
|
||||
|
||||
JavaScript implementation of the timer APIs; `setTimeout`, `clearTimeout`, `setImmediate`, `clearImmediate`, `setInterval`, `clearInterval`, `requestAnimationFrame`, `cancelAnimationFrame`, `requestIdleCallback`, and `cancelIdleCallback`, along with a clock instance that controls the flow of time. FakeTimers also provides a `Date` implementation that gets its time from the clock.
|
||||
|
||||
In addition in browser environment `@sinonjs/fake-timers` provides a `performance` implementation that gets its time from the clock. In Node environments FakeTimers provides a `nextTick` implementation that is synchronized with the clock - and a `process.hrtime` shim that works with the clock.
|
||||
|
||||
`@sinonjs/fake-timers` can be used to simulate passing time in automated tests and other
|
||||
situations where you want the scheduling semantics, but don't want to actually
|
||||
wait.
|
||||
|
||||
`@sinonjs/fake-timers` is extracted from [Sinon.JS](https://github.com/sinonjs/sinon.js) and targets the [same runtimes](https://sinonjs.org/releases/latest/#supported-runtimes).
|
||||
|
||||
## Autocomplete, IntelliSense and TypeScript definitions
|
||||
|
||||
Version 7 introduced JSDoc to the codebase. This should provide autocomplete and type suggestions in supporting IDEs. If you need more elaborate type support, TypeScript definitions for the Sinon projects are independently maintained by the Definitely Types community:
|
||||
|
||||
```
|
||||
npm install -D @types/sinonjs__fake-timers
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
`@sinonjs/fake-timers` can be used in both Node and browser environments. Installation is as easy as
|
||||
|
||||
```sh
|
||||
npm install @sinonjs/fake-timers
|
||||
```
|
||||
|
||||
If you want to use `@sinonjs/fake-timers` in a browser you can either build your own bundle or use [Skypack](https://www.skypack.dev).
|
||||
|
||||
## Usage
|
||||
|
||||
To use `@sinonjs/fake-timers`, create a new clock, schedule events on it using the timer
|
||||
functions and pass time using the `tick` method.
|
||||
|
||||
```js
|
||||
// In the browser distribution, a global `FakeTimers` is already available
|
||||
var FakeTimers = require("@sinonjs/fake-timers");
|
||||
var clock = FakeTimers.createClock();
|
||||
|
||||
clock.setTimeout(function () {
|
||||
console.log(
|
||||
"The poblano is a mild chili pepper originating in the state of Puebla, Mexico."
|
||||
);
|
||||
}, 15);
|
||||
|
||||
// ...
|
||||
|
||||
clock.tick(15);
|
||||
```
|
||||
|
||||
Upon executing the last line, an interesting fact about the
|
||||
[Poblano](https://en.wikipedia.org/wiki/Poblano) will be printed synchronously to
|
||||
the screen. If you want to simulate asynchronous behavior, please see the `async` function variants (eg `clock.tick(time)` vs `await clock.tickAsync(time)`).
|
||||
|
||||
The `next`, `runAll`, `runToFrame`, and `runToLast` methods are available to advance the clock. See the
|
||||
API Reference for more details.
|
||||
|
||||
### Faking the native timers
|
||||
|
||||
When using `@sinonjs/fake-timers` to test timers, you will most likely want to replace the native
|
||||
timers such that calling `setTimeout` actually schedules a callback with your
|
||||
clock instance, not the browser's internals.
|
||||
|
||||
Calling `install` with no arguments achieves this. You can call `uninstall`
|
||||
later to restore things as they were again.
|
||||
|
||||
```js
|
||||
// In the browser distribution, a global `FakeTimers` is already available
|
||||
var FakeTimers = require("@sinonjs/fake-timers");
|
||||
|
||||
var clock = FakeTimers.install();
|
||||
// Equivalent to
|
||||
// var clock = FakeTimers.install(typeof global !== "undefined" ? global : window);
|
||||
|
||||
setTimeout(fn, 15); // Schedules with clock.setTimeout
|
||||
|
||||
clock.uninstall();
|
||||
// setTimeout is restored to the native implementation
|
||||
```
|
||||
|
||||
To hijack timers in another context pass it to the `install` method.
|
||||
|
||||
```js
|
||||
var FakeTimers = require("@sinonjs/fake-timers");
|
||||
var context = {
|
||||
setTimeout: setTimeout, // By default context.setTimeout uses the global setTimeout
|
||||
};
|
||||
var clock = FakeTimers.withGlobal(context).install();
|
||||
|
||||
context.setTimeout(fn, 15); // Schedules with clock.setTimeout
|
||||
|
||||
clock.uninstall();
|
||||
// context.setTimeout is restored to the original implementation
|
||||
```
|
||||
|
||||
Usually you want to install the timers onto the global object, so call `install`
|
||||
without arguments.
|
||||
|
||||
#### Automatically incrementing mocked time
|
||||
|
||||
FakeTimers supports the possibility to attach the faked timers to any change
|
||||
in the real system time. This means that there is no need to `tick()` the
|
||||
clock in a situation where you won't know **when** to call `tick()`.
|
||||
|
||||
Please note that this is achieved using the original setImmediate() API at a certain
|
||||
configurable interval `config.advanceTimeDelta` (default: 20ms). Meaning time would
|
||||
be incremented every 20ms, not in real time.
|
||||
|
||||
An example would be:
|
||||
|
||||
```js
|
||||
var FakeTimers = require("@sinonjs/fake-timers");
|
||||
var clock = FakeTimers.install({
|
||||
shouldAdvanceTime: true,
|
||||
advanceTimeDelta: 40,
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
console.log("this just timed out"); //executed after 40ms
|
||||
}, 30);
|
||||
|
||||
setImmediate(() => {
|
||||
console.log("not so immediate"); //executed after 40ms
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
console.log("this timed out after"); //executed after 80ms
|
||||
clock.uninstall();
|
||||
}, 50);
|
||||
```
|
||||
|
||||
## API Reference
|
||||
|
||||
### `var clock = FakeTimers.createClock([now[, loopLimit]])`
|
||||
|
||||
Creates a clock. The default
|
||||
[epoch](https://en.wikipedia.org/wiki/Epoch_%28reference_date%29) is `0`.
|
||||
|
||||
The `now` argument may be a number (in milliseconds) or a Date object.
|
||||
|
||||
The `loopLimit` argument sets the maximum number of timers that will be run when calling `runAll()` before assuming that we have an infinite loop and throwing an error. The default is `1000`.
|
||||
|
||||
### `var clock = FakeTimers.install([config])`
|
||||
|
||||
Installs FakeTimers using the specified config (otherwise with epoch `0` on the global scope). The following configuration options are available
|
||||
|
||||
| Parameter | Type | Default | Description |
|
||||
| -------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `config.now` | Number/Date | 0 | installs FakeTimers with the specified unix epoch |
|
||||
| `config.toFake` | String[] | ["setTimeout", "clearTimeout", "setImmediate", "clearImmediate","setInterval", "clearInterval", "Date", "requestAnimationFrame", "cancelAnimationFrame", "requestIdleCallback", "cancelIdleCallback", "hrtime", "performance"] | an array with explicit function names (or objects, in the case of "performance") to hijack. _When not set, FakeTimers will automatically fake all methods **except** `nextTick`_ e.g., `FakeTimers.install({ toFake: ["setTimeout","nextTick"]})` will fake only `setTimeout` and `nextTick` |
|
||||
| `config.loopLimit` | Number | 1000 | the maximum number of timers that will be run when calling runAll() |
|
||||
| `config.shouldAdvanceTime` | Boolean | false | tells FakeTimers to increment mocked time automatically based on the real system time shift (e.g. the mocked time will be incremented by 20ms for every 20ms change in the real system time) |
|
||||
| `config.advanceTimeDelta` | Number | 20 | relevant only when using with `shouldAdvanceTime: true`. increment mocked time by `advanceTimeDelta` ms every `advanceTimeDelta` ms change in the real system time. |
|
||||
| `config.shouldClearNativeTimers` | Boolean | false | tells FakeTimers to clear 'native' (i.e. not fake) timers by delegating to their respective handlers. These are not cleared by default, leading to potentially unexpected behavior if timers existed prior to installing FakeTimers. |
|
||||
|
||||
### `var id = clock.setTimeout(callback, timeout)`
|
||||
|
||||
Schedules the callback to be fired once `timeout` milliseconds have ticked by.
|
||||
|
||||
In Node.js `setTimeout` returns a timer object. FakeTimers will do the same, however
|
||||
its `ref()` and `unref()` methods have no effect.
|
||||
|
||||
In browsers a timer ID is returned.
|
||||
|
||||
### `clock.clearTimeout(id)`
|
||||
|
||||
Clears the timer given the ID or timer object, as long as it was created using
|
||||
`setTimeout`.
|
||||
|
||||
### `var id = clock.setInterval(callback, timeout)`
|
||||
|
||||
Schedules the callback to be fired every time `timeout` milliseconds have ticked
|
||||
by.
|
||||
|
||||
In Node.js `setInterval` returns a timer object. FakeTimers will do the same, however
|
||||
its `ref()` and `unref()` methods have no effect.
|
||||
|
||||
In browsers a timer ID is returned.
|
||||
|
||||
### `clock.clearInterval(id)`
|
||||
|
||||
Clears the timer given the ID or timer object, as long as it was created using
|
||||
`setInterval`.
|
||||
|
||||
### `var id = clock.setImmediate(callback)`
|
||||
|
||||
Schedules the callback to be fired once `0` milliseconds have ticked by. Note
|
||||
that you'll still have to call `clock.tick()` for the callback to fire. If
|
||||
called during a tick the callback won't fire until `1` millisecond has ticked
|
||||
by.
|
||||
|
||||
In Node.js `setImmediate` returns a timer object. FakeTimers will do the same,
|
||||
however its `ref()` and `unref()` methods have no effect.
|
||||
|
||||
In browsers a timer ID is returned.
|
||||
|
||||
### `clock.clearImmediate(id)`
|
||||
|
||||
Clears the timer given the ID or timer object, as long as it was created using
|
||||
`setImmediate`.
|
||||
|
||||
### `clock.requestAnimationFrame(callback)`
|
||||
|
||||
Schedules the callback to be fired on the next animation frame, which runs every
|
||||
16 ticks. Returns an `id` which can be used to cancel the callback. This is
|
||||
available in both browser & node environments.
|
||||
|
||||
### `clock.cancelAnimationFrame(id)`
|
||||
|
||||
Cancels the callback scheduled by the provided id.
|
||||
|
||||
### `clock.requestIdleCallback(callback[, timeout])`
|
||||
|
||||
Queued the callback to be fired during idle periods to perform background and low priority work on the main event loop. Callbacks which have a timeout option will be fired no later than time in milliseconds. Returns an `id` which can be used to cancel the callback.
|
||||
|
||||
### `clock.cancelIdleCallback(id)`
|
||||
|
||||
Cancels the callback scheduled by the provided id.
|
||||
|
||||
### `clock.countTimers()`
|
||||
|
||||
Returns the number of waiting timers. This can be used to assert that a test
|
||||
finishes without leaking any timers.
|
||||
|
||||
### `clock.hrtime(prevTime?)`
|
||||
|
||||
Only available in Node.js, mimicks process.hrtime().
|
||||
|
||||
### `clock.nextTick(callback)`
|
||||
|
||||
Only available in Node.js, mimics `process.nextTick` to enable completely synchronous testing flows.
|
||||
|
||||
### `clock.performance.now()`
|
||||
|
||||
Only available in browser environments, mimicks performance.now().
|
||||
|
||||
### `clock.tick(time)` / `await clock.tickAsync(time)`
|
||||
|
||||
Advance the clock, firing callbacks if necessary. `time` may be the number of
|
||||
milliseconds to advance the clock by or a human-readable string. Valid string
|
||||
formats are `"08"` for eight seconds, `"01:00"` for one minute and `"02:34:10"`
|
||||
for two hours, 34 minutes and ten seconds.
|
||||
|
||||
The `tickAsync()` will also break the event loop, allowing any scheduled promise
|
||||
callbacks to execute _before_ running the timers.
|
||||
|
||||
### `clock.next()` / `await clock.nextAsync()`
|
||||
|
||||
Advances the clock to the the moment of the first scheduled timer, firing it.
|
||||
|
||||
The `nextAsync()` will also break the event loop, allowing any scheduled promise
|
||||
callbacks to execute _before_ running the timers.
|
||||
|
||||
### `clock.reset()`
|
||||
|
||||
Removes all timers and ticks without firing them, and sets `now` to `config.now`
|
||||
that was provided to `FakeTimers.install` or to `0` if `config.now` was not provided.
|
||||
Useful to reset the state of the clock without having to `uninstall` and `install` it.
|
||||
|
||||
### `clock.runAll()` / `await clock.runAllAsync()`
|
||||
|
||||
This runs all pending timers until there are none remaining. If new timers are added while it is executing they will be run as well.
|
||||
|
||||
This makes it easier to run asynchronous tests to completion without worrying about the number of timers they use, or the delays in those timers.
|
||||
|
||||
It runs a maximum of `loopLimit` times after which it assumes there is an infinite loop of timers and throws an error.
|
||||
|
||||
The `runAllAsync()` will also break the event loop, allowing any scheduled promise
|
||||
callbacks to execute _before_ running the timers.
|
||||
|
||||
### `clock.runMicrotasks()`
|
||||
|
||||
This runs all pending microtasks scheduled with `nextTick` but none of the timers and is mostly useful for libraries using FakeTimers underneath and for running `nextTick` items without any timers.
|
||||
|
||||
### `clock.runToFrame()`
|
||||
|
||||
Advances the clock to the next frame, firing all scheduled animation frame callbacks,
|
||||
if any, for that frame as well as any other timers scheduled along the way.
|
||||
|
||||
### `clock.runToLast()` / `await clock.runToLastAsync()`
|
||||
|
||||
This takes note of the last scheduled timer when it is run, and advances the
|
||||
clock to that time firing callbacks as necessary.
|
||||
|
||||
If new timers are added while it is executing they will be run only if they
|
||||
would occur before this time.
|
||||
|
||||
This is useful when you want to run a test to completion, but the test recursively
|
||||
sets timers that would cause `runAll` to trigger an infinite loop warning.
|
||||
|
||||
The `runToLastAsync()` will also break the event loop, allowing any scheduled promise
|
||||
callbacks to execute _before_ running the timers.
|
||||
|
||||
### `clock.setSystemTime([now])`
|
||||
|
||||
This simulates a user changing the system clock while your program is running.
|
||||
It affects the current time but it does not in itself cause e.g. timers to fire;
|
||||
they will fire exactly as they would have done without the call to
|
||||
setSystemTime().
|
||||
|
||||
### `clock.uninstall()`
|
||||
|
||||
Restores the original methods of the native timers or the methods on the object
|
||||
that was passed to `FakeTimers.withGlobal`
|
||||
|
||||
### `Date`
|
||||
|
||||
Implements the `Date` object but using the clock to provide the correct time.
|
||||
|
||||
### `Performance`
|
||||
|
||||
Implements the `now` method of the [`Performance`](https://developer.mozilla.org/en-US/docs/Web/API/Performance/now) object but using the clock to provide the correct time. Only available in environments that support the Performance object (browsers mostly).
|
||||
|
||||
### `FakeTimers.withGlobal`
|
||||
|
||||
In order to support creating clocks based on separate or sandboxed environments (such as JSDOM), FakeTimers exports a factory method which takes single argument `global`, which it inspects to figure out what to mock and what features to support. When invoking this function with a global, you will get back an object with `timers`, `createClock` and `install` - same as the regular FakeTimers exports only based on the passed in global instead of the global environment.
|
||||
|
||||
## Running tests
|
||||
|
||||
FakeTimers has a comprehensive test suite. If you're thinking of contributing bug
|
||||
fixes or suggesting new features, you need to make sure you have not broken any
|
||||
tests. You are also expected to add tests for any new behavior.
|
||||
|
||||
### On node:
|
||||
|
||||
```sh
|
||||
npm test
|
||||
```
|
||||
|
||||
Or, if you prefer more verbose output:
|
||||
|
||||
```
|
||||
$(npm bin)/mocha ./test/fake-timers-test.js
|
||||
```
|
||||
|
||||
### In the browser
|
||||
|
||||
[Mochify](https://github.com/mantoni/mochify.js) is used to run the tests in
|
||||
PhantomJS. Make sure you have `phantomjs` installed. Then:
|
||||
|
||||
```sh
|
||||
npm test-headless
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
BSD 3-clause "New" or "Revised" License (see LICENSE file)
|
||||
71
node_modules/sinon/node_modules/@sinonjs/fake-timers/package.json
generated
vendored
Normal file
71
node_modules/sinon/node_modules/@sinonjs/fake-timers/package.json
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"name": "@sinonjs/fake-timers",
|
||||
"description": "Fake JavaScript timers",
|
||||
"version": "9.0.0",
|
||||
"homepage": "https://github.com/sinonjs/fake-timers",
|
||||
"author": "Christian Johansen",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sinonjs/fake-timers.git"
|
||||
},
|
||||
"bugs": {
|
||||
"mail": "christian@cjohansen.no",
|
||||
"url": "https://github.com/sinonjs/fake-timers/issues"
|
||||
},
|
||||
"license": "BSD-3-Clause",
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"test-node": "mocha --timeout 200 test/ integration-test/ -R dot --check-leaks",
|
||||
"test-headless": "mochify --no-detect-globals --timeout=10000",
|
||||
"test-check-coverage": "npm run test-coverage && nyc check-coverage",
|
||||
"test-cloud": "mochify --wd --no-detect-globals --timeout=10000",
|
||||
"test-coverage": "nyc --all --reporter text --reporter html --reporter lcovonly npm run test-node",
|
||||
"test": "npm run test-node && npm run test-headless",
|
||||
"prettier:check": "prettier --check '**/*.{js,css,md}'",
|
||||
"prettier:write": "prettier --write '**/*.{js,css,md}'",
|
||||
"preversion": "./scripts/preversion.sh",
|
||||
"version": "./scripts/version.sh",
|
||||
"postversion": "./scripts/postversion.sh"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,css,md}": "prettier --check",
|
||||
"*.js": "eslint"
|
||||
},
|
||||
"files": [
|
||||
"src/"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@sinonjs/eslint-config": "4.0.2",
|
||||
"@sinonjs/referee-sinon": "6.0.1",
|
||||
"eslint-config-prettier": "8.3.0",
|
||||
"eslint-plugin-prettier": "3.4.1",
|
||||
"husky": "4.2.1",
|
||||
"jsdom": "16.5.2",
|
||||
"lint-staged": "10.0.7",
|
||||
"mocha": "8.3.2",
|
||||
"mochify": "7.0.0",
|
||||
"nyc": "14.1.1",
|
||||
"prettier": "2.2.1"
|
||||
},
|
||||
"main": "./src/fake-timers-src.js",
|
||||
"dependencies": {
|
||||
"@sinonjs/commons": "^1.7.0"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "npm run lint"
|
||||
}
|
||||
},
|
||||
"nyc": {
|
||||
"branches": 85,
|
||||
"lines": 92,
|
||||
"functions": 92,
|
||||
"statements": 92,
|
||||
"exclude": [
|
||||
"**/*-test.js",
|
||||
"coverage/**",
|
||||
"types/**",
|
||||
"fake-timers.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
1746
node_modules/sinon/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js
generated
vendored
Normal file
1746
node_modules/sinon/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
47
node_modules/sinon/package.json
generated
vendored
47
node_modules/sinon/package.json
generated
vendored
@@ -15,7 +15,7 @@
|
||||
"xhr",
|
||||
"assert"
|
||||
],
|
||||
"version": "11.1.2",
|
||||
"version": "13.0.0",
|
||||
"homepage": "https://sinonjs.org/",
|
||||
"author": "Christian Johansen",
|
||||
"repository": {
|
||||
@@ -37,24 +37,25 @@
|
||||
"test-coverage": "nyc npm run test-headless -- --transform [ babelify --ignore [ test ] --plugins [ babel-plugin-istanbul ] ]",
|
||||
"test-cloud": "npm run test-headless -- --wd",
|
||||
"test-webworker": "mochify --no-detect-globals --https-server 8080 --no-request-interception test/webworker/webworker-support-assessment.js",
|
||||
"test-esm": "mocha -r esm test/es2015/module-support-assessment-test.es6",
|
||||
"test-esm-bundle": "node test/es2015/check-esm-bundle-is-runnable.js",
|
||||
"test-esm-support": "mocha test/es2015/module-support-assessment-test.mjs",
|
||||
"check-esm-bundle-runs-in-browser": "node test/es2015/check-esm-bundle-is-runnable.js",
|
||||
"test-docker-image": "docker-compose up",
|
||||
"test-runnable-examples": "docs/release-source/release/examples/run-test.sh",
|
||||
"test": "npm run test-node && npm run test-headless && npm run test-webworker && npm run test-esm",
|
||||
"test": "npm run test-node && npm run test-headless && npm run test-webworker",
|
||||
"check-dependencies": "dependency-check package.json --no-dev --ignore-module esm",
|
||||
"build": "node ./build.js",
|
||||
"build": "node ./build.cjs",
|
||||
"build-docs": "cd docs; bundle exec jekyll build",
|
||||
"serve-docs": "cd docs; bundle exec jekyll serve --incremental --verbose",
|
||||
"lint": "eslint '**/*.{js,mjs}'",
|
||||
"lint": "eslint '**/*.{js,cjs,mjs}'",
|
||||
"pretest-webworker": "npm run build",
|
||||
"prebuild": "rimraf pkg && npm run check-dependencies",
|
||||
"postbuild": "npm run test-esm-bundle",
|
||||
"postbuild": "npm run test-esm-support && npm run check-esm-bundle-runs-in-browser",
|
||||
"prebuild-docs": "./scripts/update-compatibility.js",
|
||||
"prepublishOnly": "npm run build",
|
||||
"prettier:check": "prettier --check '**/*.{js,css,md}'",
|
||||
"prettier:write": "prettier --write '**/*.{js,css,md}'",
|
||||
"preversion": "./scripts/preversion.sh",
|
||||
"version": "changes --commits --footer",
|
||||
"postversion": "./scripts/postversion.sh"
|
||||
},
|
||||
"nyc": {
|
||||
@@ -72,33 +73,33 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@sinonjs/commons": "^1.8.3",
|
||||
"@sinonjs/fake-timers": "^7.1.2",
|
||||
"@sinonjs/samsam": "^6.0.2",
|
||||
"@sinonjs/fake-timers": "^9.0.0",
|
||||
"@sinonjs/samsam": "^6.1.1",
|
||||
"diff": "^5.0.0",
|
||||
"nise": "^5.1.0",
|
||||
"supports-color": "^7.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.14.3",
|
||||
"@sinonjs/eslint-config": "^4.0.2",
|
||||
"@babel/core": "^7.16.12",
|
||||
"@sinonjs/eslint-config": "^4.0.5",
|
||||
"@sinonjs/eslint-plugin-no-prototype-methods": "^0.1.1",
|
||||
"@sinonjs/referee": "^8.0.2",
|
||||
"babel-plugin-istanbul": "^6.0.0",
|
||||
"@sinonjs/referee": "^9.1.1",
|
||||
"@studio/changes": "^2.2.0",
|
||||
"babel-plugin-istanbul": "^6.1.1",
|
||||
"babelify": "^10.0.0",
|
||||
"browserify": "^16.5.2",
|
||||
"debug": "^4.3.1",
|
||||
"dependency-check": "^4.1.0",
|
||||
"esm": "^3.2.25",
|
||||
"husky": "^6.0.0",
|
||||
"lint-staged": "^11.0.0",
|
||||
"mocha": "^8.4.0",
|
||||
"mochify": "^7.1.1",
|
||||
"lint-staged": "^12.3.2",
|
||||
"mocha": "^9.2.0",
|
||||
"mochify": "^9.1.0",
|
||||
"nyc": "^15.1.0",
|
||||
"prettier": "^2.3.0",
|
||||
"prettier": "^2.5.1",
|
||||
"proxyquire": "^2.1.3",
|
||||
"proxyquire-universal": "^3.0.1",
|
||||
"proxyquireify": "^3.2.1",
|
||||
"puppeteer": "^9.1.1",
|
||||
"puppeteer": "^13.1.2",
|
||||
"rimraf": "^3.0.2",
|
||||
"shelljs": "^0.8.4"
|
||||
},
|
||||
@@ -115,6 +116,14 @@
|
||||
"browser": "./lib/sinon.js",
|
||||
"main": "./lib/sinon.js",
|
||||
"module": "./pkg/sinon-esm.js",
|
||||
"exports": {
|
||||
".": {
|
||||
"require": "./lib/sinon.js",
|
||||
"import": "./pkg/sinon-esm.js"
|
||||
},
|
||||
"./*": "./*"
|
||||
},
|
||||
"type": "module",
|
||||
"cdn": "./pkg/sinon.js",
|
||||
"jsdelivr": "./pkg/sinon.js",
|
||||
"esm": {
|
||||
|
||||
2423
node_modules/sinon/pkg/sinon-esm.js
generated
vendored
2423
node_modules/sinon/pkg/sinon-esm.js
generated
vendored
File diff suppressed because it is too large
Load Diff
2423
node_modules/sinon/pkg/sinon-no-sourcemaps.js → node_modules/sinon/pkg/sinon-no-sourcemaps.cjs
generated
vendored
2423
node_modules/sinon/pkg/sinon-no-sourcemaps.js → node_modules/sinon/pkg/sinon-no-sourcemaps.cjs
generated
vendored
File diff suppressed because it is too large
Load Diff
2425
node_modules/sinon/pkg/sinon.js
generated
vendored
2425
node_modules/sinon/pkg/sinon.js
generated
vendored
File diff suppressed because one or more lines are too long
4
node_modules/tr46/.npmignore
generated
vendored
Normal file
4
node_modules/tr46/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
scripts/
|
||||
test/
|
||||
|
||||
!lib/mapping_table.json
|
||||
193
node_modules/tr46/index.js
generated
vendored
Normal file
193
node_modules/tr46/index.js
generated
vendored
Normal file
@@ -0,0 +1,193 @@
|
||||
"use strict";
|
||||
|
||||
var punycode = require("punycode");
|
||||
var mappingTable = require("./lib/mappingTable.json");
|
||||
|
||||
var PROCESSING_OPTIONS = {
|
||||
TRANSITIONAL: 0,
|
||||
NONTRANSITIONAL: 1
|
||||
};
|
||||
|
||||
function normalize(str) { // fix bug in v8
|
||||
return str.split('\u0000').map(function (s) { return s.normalize('NFC'); }).join('\u0000');
|
||||
}
|
||||
|
||||
function findStatus(val) {
|
||||
var start = 0;
|
||||
var end = mappingTable.length - 1;
|
||||
|
||||
while (start <= end) {
|
||||
var mid = Math.floor((start + end) / 2);
|
||||
|
||||
var target = mappingTable[mid];
|
||||
if (target[0][0] <= val && target[0][1] >= val) {
|
||||
return target;
|
||||
} else if (target[0][0] > val) {
|
||||
end = mid - 1;
|
||||
} else {
|
||||
start = mid + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
var regexAstralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
||||
|
||||
function countSymbols(string) {
|
||||
return string
|
||||
// replace every surrogate pair with a BMP symbol
|
||||
.replace(regexAstralSymbols, '_')
|
||||
// then get the length
|
||||
.length;
|
||||
}
|
||||
|
||||
function mapChars(domain_name, useSTD3, processing_option) {
|
||||
var hasError = false;
|
||||
var processed = "";
|
||||
|
||||
var len = countSymbols(domain_name);
|
||||
for (var i = 0; i < len; ++i) {
|
||||
var codePoint = domain_name.codePointAt(i);
|
||||
var status = findStatus(codePoint);
|
||||
|
||||
switch (status[1]) {
|
||||
case "disallowed":
|
||||
hasError = true;
|
||||
processed += String.fromCodePoint(codePoint);
|
||||
break;
|
||||
case "ignored":
|
||||
break;
|
||||
case "mapped":
|
||||
processed += String.fromCodePoint.apply(String, status[2]);
|
||||
break;
|
||||
case "deviation":
|
||||
if (processing_option === PROCESSING_OPTIONS.TRANSITIONAL) {
|
||||
processed += String.fromCodePoint.apply(String, status[2]);
|
||||
} else {
|
||||
processed += String.fromCodePoint(codePoint);
|
||||
}
|
||||
break;
|
||||
case "valid":
|
||||
processed += String.fromCodePoint(codePoint);
|
||||
break;
|
||||
case "disallowed_STD3_mapped":
|
||||
if (useSTD3) {
|
||||
hasError = true;
|
||||
processed += String.fromCodePoint(codePoint);
|
||||
} else {
|
||||
processed += String.fromCodePoint.apply(String, status[2]);
|
||||
}
|
||||
break;
|
||||
case "disallowed_STD3_valid":
|
||||
if (useSTD3) {
|
||||
hasError = true;
|
||||
}
|
||||
|
||||
processed += String.fromCodePoint(codePoint);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
string: processed,
|
||||
error: hasError
|
||||
};
|
||||
}
|
||||
|
||||
var combiningMarksRegex = /[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E4-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u18A9\u1920-\u192B\u1930-\u193B\u19B0-\u19C0\u19C8\u19C9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C4\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2D]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC7F-\uDC82\uDCB0-\uDCBA\uDD00-\uDD02\uDD27-\uDD34\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDE2C-\uDE37\uDEDF-\uDEEA\uDF01-\uDF03\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDE30-\uDE40\uDEAB-\uDEB7]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF51-\uDF7E\uDF8F-\uDF92]|\uD82F[\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD83A[\uDCD0-\uDCD6]|\uDB40[\uDD00-\uDDEF]/;
|
||||
|
||||
function validateLabel(label, processing_option) {
|
||||
if (label.substr(0, 4) === "xn--") {
|
||||
label = punycode.toUnicode(label);
|
||||
processing_option = PROCESSING_OPTIONS.NONTRANSITIONAL;
|
||||
}
|
||||
|
||||
var error = false;
|
||||
|
||||
if (normalize(label) !== label ||
|
||||
(label[3] === "-" && label[4] === "-") ||
|
||||
label[0] === "-" || label[label.length - 1] === "-" ||
|
||||
label.indexOf(".") !== -1 ||
|
||||
label.search(combiningMarksRegex) === 0) {
|
||||
error = true;
|
||||
}
|
||||
|
||||
var len = countSymbols(label);
|
||||
for (var i = 0; i < len; ++i) {
|
||||
var status = findStatus(label.codePointAt(i));
|
||||
if ((processing === PROCESSING_OPTIONS.TRANSITIONAL && status[1] !== "valid") ||
|
||||
(processing === PROCESSING_OPTIONS.NONTRANSITIONAL &&
|
||||
status[1] !== "valid" && status[1] !== "deviation")) {
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
label: label,
|
||||
error: error
|
||||
};
|
||||
}
|
||||
|
||||
function processing(domain_name, useSTD3, processing_option) {
|
||||
var result = mapChars(domain_name, useSTD3, processing_option);
|
||||
result.string = normalize(result.string);
|
||||
|
||||
var labels = result.string.split(".");
|
||||
for (var i = 0; i < labels.length; ++i) {
|
||||
try {
|
||||
var validation = validateLabel(labels[i]);
|
||||
labels[i] = validation.label;
|
||||
result.error = result.error || validation.error;
|
||||
} catch(e) {
|
||||
result.error = true;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
string: labels.join("."),
|
||||
error: result.error
|
||||
};
|
||||
}
|
||||
|
||||
module.exports.toASCII = function(domain_name, useSTD3, processing_option, verifyDnsLength) {
|
||||
var result = processing(domain_name, useSTD3, processing_option);
|
||||
var labels = result.string.split(".");
|
||||
labels = labels.map(function(l) {
|
||||
try {
|
||||
return punycode.toASCII(l);
|
||||
} catch(e) {
|
||||
result.error = true;
|
||||
return l;
|
||||
}
|
||||
});
|
||||
|
||||
if (verifyDnsLength) {
|
||||
var total = labels.slice(0, labels.length - 1).join(".").length;
|
||||
if (total.length > 253 || total.length === 0) {
|
||||
result.error = true;
|
||||
}
|
||||
|
||||
for (var i=0; i < labels.length; ++i) {
|
||||
if (labels.length > 63 || labels.length === 0) {
|
||||
result.error = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (result.error) return null;
|
||||
return labels.join(".");
|
||||
};
|
||||
|
||||
module.exports.toUnicode = function(domain_name, useSTD3) {
|
||||
var result = processing(domain_name, useSTD3, PROCESSING_OPTIONS.NONTRANSITIONAL);
|
||||
|
||||
return {
|
||||
domain: result.string,
|
||||
error: result.error
|
||||
};
|
||||
};
|
||||
|
||||
module.exports.PROCESSING_OPTIONS = PROCESSING_OPTIONS;
|
||||
0
node_modules/tr46/lib/.gitkeep
generated
vendored
Normal file
0
node_modules/tr46/lib/.gitkeep
generated
vendored
Normal file
1
node_modules/tr46/lib/mappingTable.json
generated
vendored
Normal file
1
node_modules/tr46/lib/mappingTable.json
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
31
node_modules/tr46/package.json
generated
vendored
Normal file
31
node_modules/tr46/package.json
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "tr46",
|
||||
"version": "0.0.3",
|
||||
"description": "An implementation of the Unicode TR46 spec",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "mocha",
|
||||
"pretest": "node scripts/getLatestUnicodeTests.js",
|
||||
"prepublish": "node scripts/generateMappingTable.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Sebmaster/tr46.js.git"
|
||||
},
|
||||
"keywords": [
|
||||
"unicode",
|
||||
"tr46",
|
||||
"url",
|
||||
"whatwg"
|
||||
],
|
||||
"author": "Sebastian Mayr <npm@smayr.name>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/Sebmaster/tr46.js/issues"
|
||||
},
|
||||
"homepage": "https://github.com/Sebmaster/tr46.js#readme",
|
||||
"devDependencies": {
|
||||
"mocha": "^2.2.5",
|
||||
"request": "^2.57.0"
|
||||
}
|
||||
}
|
||||
12
node_modules/webidl-conversions/LICENSE.md
generated
vendored
Normal file
12
node_modules/webidl-conversions/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# The BSD 2-Clause License
|
||||
|
||||
Copyright (c) 2014, Domenic Denicola
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
53
node_modules/webidl-conversions/README.md
generated
vendored
Normal file
53
node_modules/webidl-conversions/README.md
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
# WebIDL Type Conversions on JavaScript Values
|
||||
|
||||
This package implements, in JavaScript, the algorithms to convert a given JavaScript value according to a given [WebIDL](http://heycam.github.io/webidl/) [type](http://heycam.github.io/webidl/#idl-types).
|
||||
|
||||
The goal is that you should be able to write code like
|
||||
|
||||
```js
|
||||
const conversions = require("webidl-conversions");
|
||||
|
||||
function doStuff(x, y) {
|
||||
x = conversions["boolean"](x);
|
||||
y = conversions["unsigned long"](y);
|
||||
// actual algorithm code here
|
||||
}
|
||||
```
|
||||
|
||||
and your function `doStuff` will behave the same as a WebIDL operation declared as
|
||||
|
||||
```webidl
|
||||
void doStuff(boolean x, unsigned long y);
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
This package's main module's default export is an object with a variety of methods, each corresponding to a different WebIDL type. Each method, when invoked on a JavaScript value, will give back the new JavaScript value that results after passing through the WebIDL conversion rules. (See below for more details on what that means.) Alternately, the method could throw an error, if the WebIDL algorithm is specified to do so: for example `conversions["float"](NaN)` [will throw a `TypeError`](http://heycam.github.io/webidl/#es-float).
|
||||
|
||||
## Status
|
||||
|
||||
All of the numeric types are implemented (float being implemented as double) and some others are as well - check the source for all of them. This list will grow over time in service of the [HTML as Custom Elements](https://github.com/dglazkov/html-as-custom-elements) project, but in the meantime, pull requests welcome!
|
||||
|
||||
I'm not sure yet what the strategy will be for modifiers, e.g. [`[Clamp]`](http://heycam.github.io/webidl/#Clamp). Maybe something like `conversions["unsigned long"](x, { clamp: true })`? We'll see.
|
||||
|
||||
We might also want to extend the API to give better error messages, e.g. "Argument 1 of HTMLMediaElement.fastSeek is not a finite floating-point value" instead of "Argument is not a finite floating-point value." This would require passing in more information to the conversion functions than we currently do.
|
||||
|
||||
## Background
|
||||
|
||||
What's actually going on here, conceptually, is pretty weird. Let's try to explain.
|
||||
|
||||
WebIDL, as part of its madness-inducing design, has its own type system. When people write algorithms in web platform specs, they usually operate on WebIDL values, i.e. instances of WebIDL types. For example, if they were specifying the algorithm for our `doStuff` operation above, they would treat `x` as a WebIDL value of [WebIDL type `boolean`](http://heycam.github.io/webidl/#idl-boolean). Crucially, they would _not_ treat `x` as a JavaScript variable whose value is either the JavaScript `true` or `false`. They're instead working in a different type system altogether, with its own rules.
|
||||
|
||||
Separately from its type system, WebIDL defines a ["binding"](http://heycam.github.io/webidl/#ecmascript-binding) of the type system into JavaScript. This contains rules like: when you pass a JavaScript value to the JavaScript method that manifests a given WebIDL operation, how does that get converted into a WebIDL value? For example, a JavaScript `true` passed in the position of a WebIDL `boolean` argument becomes a WebIDL `true`. But, a JavaScript `true` passed in the position of a [WebIDL `unsigned long`](http://heycam.github.io/webidl/#idl-unsigned-long) becomes a WebIDL `1`. And so on.
|
||||
|
||||
Finally, we have the actual implementation code. This is usually C++, although these days [some smart people are using Rust](https://github.com/servo/servo). The implementation, of course, has its own type system. So when they implement the WebIDL algorithms, they don't actually use WebIDL values, since those aren't "real" outside of specs. Instead, implementations apply the WebIDL binding rules in such a way as to convert incoming JavaScript values into C++ values. For example, if code in the browser called `doStuff(true, true)`, then the implementation code would eventually receive a C++ `bool` containing `true` and a C++ `uint32_t` containing `1`.
|
||||
|
||||
The upside of all this is that implementations can abstract all the conversion logic away, letting WebIDL handle it, and focus on implementing the relevant methods in C++ with values of the correct type already provided. That is payoff of WebIDL, in a nutshell.
|
||||
|
||||
And getting to that payoff is the goal of _this_ project—but for JavaScript implementations, instead of C++ ones. That is, this library is designed to make it easier for JavaScript developers to write functions that behave like a given WebIDL operation. So conceptually, the conversion pipeline, which in its general form is JavaScript values ↦ WebIDL values ↦ implementation-language values, in this case becomes JavaScript values ↦ WebIDL values ↦ JavaScript values. And that intermediate step is where all the logic is performed: a JavaScript `true` becomes a WebIDL `1` in an unsigned long context, which then becomes a JavaScript `1`.
|
||||
|
||||
## Don't Use This
|
||||
|
||||
Seriously, why would you ever use this? You really shouldn't. WebIDL is … not great, and you shouldn't be emulating its semantics. If you're looking for a generic argument-processing library, you should find one with better rules than those from WebIDL. In general, your JavaScript should not be trying to become more like WebIDL; if anything, we should fix WebIDL to make it more like JavaScript.
|
||||
|
||||
The _only_ people who should use this are those trying to create faithful implementations (or polyfills) of web platform interfaces defined in WebIDL.
|
||||
189
node_modules/webidl-conversions/lib/index.js
generated
vendored
Normal file
189
node_modules/webidl-conversions/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,189 @@
|
||||
"use strict";
|
||||
|
||||
var conversions = {};
|
||||
module.exports = conversions;
|
||||
|
||||
function sign(x) {
|
||||
return x < 0 ? -1 : 1;
|
||||
}
|
||||
|
||||
function evenRound(x) {
|
||||
// Round x to the nearest integer, choosing the even integer if it lies halfway between two.
|
||||
if ((x % 1) === 0.5 && (x & 1) === 0) { // [even number].5; round down (i.e. floor)
|
||||
return Math.floor(x);
|
||||
} else {
|
||||
return Math.round(x);
|
||||
}
|
||||
}
|
||||
|
||||
function createNumberConversion(bitLength, typeOpts) {
|
||||
if (!typeOpts.unsigned) {
|
||||
--bitLength;
|
||||
}
|
||||
const lowerBound = typeOpts.unsigned ? 0 : -Math.pow(2, bitLength);
|
||||
const upperBound = Math.pow(2, bitLength) - 1;
|
||||
|
||||
const moduloVal = typeOpts.moduloBitLength ? Math.pow(2, typeOpts.moduloBitLength) : Math.pow(2, bitLength);
|
||||
const moduloBound = typeOpts.moduloBitLength ? Math.pow(2, typeOpts.moduloBitLength - 1) : Math.pow(2, bitLength - 1);
|
||||
|
||||
return function(V, opts) {
|
||||
if (!opts) opts = {};
|
||||
|
||||
let x = +V;
|
||||
|
||||
if (opts.enforceRange) {
|
||||
if (!Number.isFinite(x)) {
|
||||
throw new TypeError("Argument is not a finite number");
|
||||
}
|
||||
|
||||
x = sign(x) * Math.floor(Math.abs(x));
|
||||
if (x < lowerBound || x > upperBound) {
|
||||
throw new TypeError("Argument is not in byte range");
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
if (!isNaN(x) && opts.clamp) {
|
||||
x = evenRound(x);
|
||||
|
||||
if (x < lowerBound) x = lowerBound;
|
||||
if (x > upperBound) x = upperBound;
|
||||
return x;
|
||||
}
|
||||
|
||||
if (!Number.isFinite(x) || x === 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
x = sign(x) * Math.floor(Math.abs(x));
|
||||
x = x % moduloVal;
|
||||
|
||||
if (!typeOpts.unsigned && x >= moduloBound) {
|
||||
return x - moduloVal;
|
||||
} else if (typeOpts.unsigned) {
|
||||
if (x < 0) {
|
||||
x += moduloVal;
|
||||
} else if (x === -0) { // don't return negative zero
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
conversions["void"] = function () {
|
||||
return undefined;
|
||||
};
|
||||
|
||||
conversions["boolean"] = function (val) {
|
||||
return !!val;
|
||||
};
|
||||
|
||||
conversions["byte"] = createNumberConversion(8, { unsigned: false });
|
||||
conversions["octet"] = createNumberConversion(8, { unsigned: true });
|
||||
|
||||
conversions["short"] = createNumberConversion(16, { unsigned: false });
|
||||
conversions["unsigned short"] = createNumberConversion(16, { unsigned: true });
|
||||
|
||||
conversions["long"] = createNumberConversion(32, { unsigned: false });
|
||||
conversions["unsigned long"] = createNumberConversion(32, { unsigned: true });
|
||||
|
||||
conversions["long long"] = createNumberConversion(32, { unsigned: false, moduloBitLength: 64 });
|
||||
conversions["unsigned long long"] = createNumberConversion(32, { unsigned: true, moduloBitLength: 64 });
|
||||
|
||||
conversions["double"] = function (V) {
|
||||
const x = +V;
|
||||
|
||||
if (!Number.isFinite(x)) {
|
||||
throw new TypeError("Argument is not a finite floating-point value");
|
||||
}
|
||||
|
||||
return x;
|
||||
};
|
||||
|
||||
conversions["unrestricted double"] = function (V) {
|
||||
const x = +V;
|
||||
|
||||
if (isNaN(x)) {
|
||||
throw new TypeError("Argument is NaN");
|
||||
}
|
||||
|
||||
return x;
|
||||
};
|
||||
|
||||
// not quite valid, but good enough for JS
|
||||
conversions["float"] = conversions["double"];
|
||||
conversions["unrestricted float"] = conversions["unrestricted double"];
|
||||
|
||||
conversions["DOMString"] = function (V, opts) {
|
||||
if (!opts) opts = {};
|
||||
|
||||
if (opts.treatNullAsEmptyString && V === null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return String(V);
|
||||
};
|
||||
|
||||
conversions["ByteString"] = function (V, opts) {
|
||||
const x = String(V);
|
||||
let c = undefined;
|
||||
for (let i = 0; (c = x.codePointAt(i)) !== undefined; ++i) {
|
||||
if (c > 255) {
|
||||
throw new TypeError("Argument is not a valid bytestring");
|
||||
}
|
||||
}
|
||||
|
||||
return x;
|
||||
};
|
||||
|
||||
conversions["USVString"] = function (V) {
|
||||
const S = String(V);
|
||||
const n = S.length;
|
||||
const U = [];
|
||||
for (let i = 0; i < n; ++i) {
|
||||
const c = S.charCodeAt(i);
|
||||
if (c < 0xD800 || c > 0xDFFF) {
|
||||
U.push(String.fromCodePoint(c));
|
||||
} else if (0xDC00 <= c && c <= 0xDFFF) {
|
||||
U.push(String.fromCodePoint(0xFFFD));
|
||||
} else {
|
||||
if (i === n - 1) {
|
||||
U.push(String.fromCodePoint(0xFFFD));
|
||||
} else {
|
||||
const d = S.charCodeAt(i + 1);
|
||||
if (0xDC00 <= d && d <= 0xDFFF) {
|
||||
const a = c & 0x3FF;
|
||||
const b = d & 0x3FF;
|
||||
U.push(String.fromCodePoint((2 << 15) + (2 << 9) * a + b));
|
||||
++i;
|
||||
} else {
|
||||
U.push(String.fromCodePoint(0xFFFD));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return U.join('');
|
||||
};
|
||||
|
||||
conversions["Date"] = function (V, opts) {
|
||||
if (!(V instanceof Date)) {
|
||||
throw new TypeError("Argument is not a Date object");
|
||||
}
|
||||
if (isNaN(V)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return V;
|
||||
};
|
||||
|
||||
conversions["RegExp"] = function (V, opts) {
|
||||
if (!(V instanceof RegExp)) {
|
||||
V = new RegExp(V);
|
||||
}
|
||||
|
||||
return V;
|
||||
};
|
||||
23
node_modules/webidl-conversions/package.json
generated
vendored
Normal file
23
node_modules/webidl-conversions/package.json
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "webidl-conversions",
|
||||
"version": "3.0.1",
|
||||
"description": "Implements the WebIDL algorithms for converting to and from JavaScript values",
|
||||
"main": "lib/index.js",
|
||||
"scripts": {
|
||||
"test": "mocha test/*.js"
|
||||
},
|
||||
"repository": "jsdom/webidl-conversions",
|
||||
"keywords": [
|
||||
"webidl",
|
||||
"web",
|
||||
"types"
|
||||
],
|
||||
"files": [
|
||||
"lib/"
|
||||
],
|
||||
"author": "Domenic Denicola <d@domenic.me> (https://domenic.me/)",
|
||||
"license": "BSD-2-Clause",
|
||||
"devDependencies": {
|
||||
"mocha": "^1.21.4"
|
||||
}
|
||||
}
|
||||
21
node_modules/whatwg-url/LICENSE.txt
generated
vendored
Normal file
21
node_modules/whatwg-url/LICENSE.txt
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015–2016 Sebastian Mayr
|
||||
|
||||
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.
|
||||
67
node_modules/whatwg-url/README.md
generated
vendored
Normal file
67
node_modules/whatwg-url/README.md
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
# whatwg-url
|
||||
|
||||
whatwg-url is a full implementation of the WHATWG [URL Standard](https://url.spec.whatwg.org/). It can be used standalone, but it also exposes a lot of the internal algorithms that are useful for integrating a URL parser into a project like [jsdom](https://github.com/tmpvar/jsdom).
|
||||
|
||||
## Current Status
|
||||
|
||||
whatwg-url is currently up to date with the URL spec up to commit [a62223](https://github.com/whatwg/url/commit/a622235308342c9adc7fc2fd1659ff059f7d5e2a).
|
||||
|
||||
## API
|
||||
|
||||
### The `URL` Constructor
|
||||
|
||||
The main API is the [`URL`](https://url.spec.whatwg.org/#url) export, which follows the spec's behavior in all ways (including e.g. `USVString` conversion). Most consumers of this library will want to use this.
|
||||
|
||||
### Low-level URL Standard API
|
||||
|
||||
The following methods are exported for use by places like jsdom that need to implement things like [`HTMLHyperlinkElementUtils`](https://html.spec.whatwg.org/#htmlhyperlinkelementutils). They operate on or return an "internal URL" or ["URL record"](https://url.spec.whatwg.org/#concept-url) type.
|
||||
|
||||
- [URL parser](https://url.spec.whatwg.org/#concept-url-parser): `parseURL(input, { baseURL, encodingOverride })`
|
||||
- [Basic URL parser](https://url.spec.whatwg.org/#concept-basic-url-parser): `basicURLParse(input, { baseURL, encodingOverride, url, stateOverride })`
|
||||
- [URL serializer](https://url.spec.whatwg.org/#concept-url-serializer): `serializeURL(urlRecord, excludeFragment)`
|
||||
- [Host serializer](https://url.spec.whatwg.org/#concept-host-serializer): `serializeHost(hostFromURLRecord)`
|
||||
- [Serialize an integer](https://url.spec.whatwg.org/#serialize-an-integer): `serializeInteger(number)`
|
||||
- [Origin](https://url.spec.whatwg.org/#concept-url-origin) [serializer](https://html.spec.whatwg.org/multipage/browsers.html#serialization-of-an-origin): `serializeURLOrigin(urlRecord)`
|
||||
- [Set the username](https://url.spec.whatwg.org/#set-the-username): `setTheUsername(urlRecord, usernameString)`
|
||||
- [Set the password](https://url.spec.whatwg.org/#set-the-password): `setThePassword(urlRecord, passwordString)`
|
||||
- [Cannot have a username/password/port](https://url.spec.whatwg.org/#cannot-have-a-username-password-port): `cannotHaveAUsernamePasswordPort(urlRecord)`
|
||||
|
||||
The `stateOverride` parameter is one of the following strings:
|
||||
|
||||
- [`"scheme start"`](https://url.spec.whatwg.org/#scheme-start-state)
|
||||
- [`"scheme"`](https://url.spec.whatwg.org/#scheme-state)
|
||||
- [`"no scheme"`](https://url.spec.whatwg.org/#no-scheme-state)
|
||||
- [`"special relative or authority"`](https://url.spec.whatwg.org/#special-relative-or-authority-state)
|
||||
- [`"path or authority"`](https://url.spec.whatwg.org/#path-or-authority-state)
|
||||
- [`"relative"`](https://url.spec.whatwg.org/#relative-state)
|
||||
- [`"relative slash"`](https://url.spec.whatwg.org/#relative-slash-state)
|
||||
- [`"special authority slashes"`](https://url.spec.whatwg.org/#special-authority-slashes-state)
|
||||
- [`"special authority ignore slashes"`](https://url.spec.whatwg.org/#special-authority-ignore-slashes-state)
|
||||
- [`"authority"`](https://url.spec.whatwg.org/#authority-state)
|
||||
- [`"host"`](https://url.spec.whatwg.org/#host-state)
|
||||
- [`"hostname"`](https://url.spec.whatwg.org/#hostname-state)
|
||||
- [`"port"`](https://url.spec.whatwg.org/#port-state)
|
||||
- [`"file"`](https://url.spec.whatwg.org/#file-state)
|
||||
- [`"file slash"`](https://url.spec.whatwg.org/#file-slash-state)
|
||||
- [`"file host"`](https://url.spec.whatwg.org/#file-host-state)
|
||||
- [`"path start"`](https://url.spec.whatwg.org/#path-start-state)
|
||||
- [`"path"`](https://url.spec.whatwg.org/#path-state)
|
||||
- [`"cannot-be-a-base-URL path"`](https://url.spec.whatwg.org/#cannot-be-a-base-url-path-state)
|
||||
- [`"query"`](https://url.spec.whatwg.org/#query-state)
|
||||
- [`"fragment"`](https://url.spec.whatwg.org/#fragment-state)
|
||||
|
||||
The URL record type has the following API:
|
||||
|
||||
- [`scheme`](https://url.spec.whatwg.org/#concept-url-scheme)
|
||||
- [`username`](https://url.spec.whatwg.org/#concept-url-username)
|
||||
- [`password`](https://url.spec.whatwg.org/#concept-url-password)
|
||||
- [`host`](https://url.spec.whatwg.org/#concept-url-host)
|
||||
- [`port`](https://url.spec.whatwg.org/#concept-url-port)
|
||||
- [`path`](https://url.spec.whatwg.org/#concept-url-path) (as an array)
|
||||
- [`query`](https://url.spec.whatwg.org/#concept-url-query)
|
||||
- [`fragment`](https://url.spec.whatwg.org/#concept-url-fragment)
|
||||
- [`cannotBeABaseURL`](https://url.spec.whatwg.org/#url-cannot-be-a-base-url-flag) (as a boolean)
|
||||
|
||||
These properties should be treated with care, as in general changing them will cause the URL record to be in an inconsistent state until the appropriate invocation of `basicURLParse` is used to fix it up. You can see examples of this in the URL Standard, where there are many step sequences like "4. Set context object’s url’s fragment to the empty string. 5. Basic URL parse _input_ with context object’s url as _url_ and fragment state as _state override_." In between those two steps, a URL record is in an unusable state.
|
||||
|
||||
The return value of "failure" in the spec is represented by the string `"failure"`. That is, functions like `parseURL` and `basicURLParse` can return _either_ a URL record _or_ the string `"failure"`.
|
||||
200
node_modules/whatwg-url/lib/URL-impl.js
generated
vendored
Normal file
200
node_modules/whatwg-url/lib/URL-impl.js
generated
vendored
Normal file
@@ -0,0 +1,200 @@
|
||||
"use strict";
|
||||
const usm = require("./url-state-machine");
|
||||
|
||||
exports.implementation = class URLImpl {
|
||||
constructor(constructorArgs) {
|
||||
const url = constructorArgs[0];
|
||||
const base = constructorArgs[1];
|
||||
|
||||
let parsedBase = null;
|
||||
if (base !== undefined) {
|
||||
parsedBase = usm.basicURLParse(base);
|
||||
if (parsedBase === "failure") {
|
||||
throw new TypeError("Invalid base URL");
|
||||
}
|
||||
}
|
||||
|
||||
const parsedURL = usm.basicURLParse(url, { baseURL: parsedBase });
|
||||
if (parsedURL === "failure") {
|
||||
throw new TypeError("Invalid URL");
|
||||
}
|
||||
|
||||
this._url = parsedURL;
|
||||
|
||||
// TODO: query stuff
|
||||
}
|
||||
|
||||
get href() {
|
||||
return usm.serializeURL(this._url);
|
||||
}
|
||||
|
||||
set href(v) {
|
||||
const parsedURL = usm.basicURLParse(v);
|
||||
if (parsedURL === "failure") {
|
||||
throw new TypeError("Invalid URL");
|
||||
}
|
||||
|
||||
this._url = parsedURL;
|
||||
}
|
||||
|
||||
get origin() {
|
||||
return usm.serializeURLOrigin(this._url);
|
||||
}
|
||||
|
||||
get protocol() {
|
||||
return this._url.scheme + ":";
|
||||
}
|
||||
|
||||
set protocol(v) {
|
||||
usm.basicURLParse(v + ":", { url: this._url, stateOverride: "scheme start" });
|
||||
}
|
||||
|
||||
get username() {
|
||||
return this._url.username;
|
||||
}
|
||||
|
||||
set username(v) {
|
||||
if (usm.cannotHaveAUsernamePasswordPort(this._url)) {
|
||||
return;
|
||||
}
|
||||
|
||||
usm.setTheUsername(this._url, v);
|
||||
}
|
||||
|
||||
get password() {
|
||||
return this._url.password;
|
||||
}
|
||||
|
||||
set password(v) {
|
||||
if (usm.cannotHaveAUsernamePasswordPort(this._url)) {
|
||||
return;
|
||||
}
|
||||
|
||||
usm.setThePassword(this._url, v);
|
||||
}
|
||||
|
||||
get host() {
|
||||
const url = this._url;
|
||||
|
||||
if (url.host === null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (url.port === null) {
|
||||
return usm.serializeHost(url.host);
|
||||
}
|
||||
|
||||
return usm.serializeHost(url.host) + ":" + usm.serializeInteger(url.port);
|
||||
}
|
||||
|
||||
set host(v) {
|
||||
if (this._url.cannotBeABaseURL) {
|
||||
return;
|
||||
}
|
||||
|
||||
usm.basicURLParse(v, { url: this._url, stateOverride: "host" });
|
||||
}
|
||||
|
||||
get hostname() {
|
||||
if (this._url.host === null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return usm.serializeHost(this._url.host);
|
||||
}
|
||||
|
||||
set hostname(v) {
|
||||
if (this._url.cannotBeABaseURL) {
|
||||
return;
|
||||
}
|
||||
|
||||
usm.basicURLParse(v, { url: this._url, stateOverride: "hostname" });
|
||||
}
|
||||
|
||||
get port() {
|
||||
if (this._url.port === null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return usm.serializeInteger(this._url.port);
|
||||
}
|
||||
|
||||
set port(v) {
|
||||
if (usm.cannotHaveAUsernamePasswordPort(this._url)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (v === "") {
|
||||
this._url.port = null;
|
||||
} else {
|
||||
usm.basicURLParse(v, { url: this._url, stateOverride: "port" });
|
||||
}
|
||||
}
|
||||
|
||||
get pathname() {
|
||||
if (this._url.cannotBeABaseURL) {
|
||||
return this._url.path[0];
|
||||
}
|
||||
|
||||
if (this._url.path.length === 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return "/" + this._url.path.join("/");
|
||||
}
|
||||
|
||||
set pathname(v) {
|
||||
if (this._url.cannotBeABaseURL) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._url.path = [];
|
||||
usm.basicURLParse(v, { url: this._url, stateOverride: "path start" });
|
||||
}
|
||||
|
||||
get search() {
|
||||
if (this._url.query === null || this._url.query === "") {
|
||||
return "";
|
||||
}
|
||||
|
||||
return "?" + this._url.query;
|
||||
}
|
||||
|
||||
set search(v) {
|
||||
// TODO: query stuff
|
||||
|
||||
const url = this._url;
|
||||
|
||||
if (v === "") {
|
||||
url.query = null;
|
||||
return;
|
||||
}
|
||||
|
||||
const input = v[0] === "?" ? v.substring(1) : v;
|
||||
url.query = "";
|
||||
usm.basicURLParse(input, { url, stateOverride: "query" });
|
||||
}
|
||||
|
||||
get hash() {
|
||||
if (this._url.fragment === null || this._url.fragment === "") {
|
||||
return "";
|
||||
}
|
||||
|
||||
return "#" + this._url.fragment;
|
||||
}
|
||||
|
||||
set hash(v) {
|
||||
if (v === "") {
|
||||
this._url.fragment = null;
|
||||
return;
|
||||
}
|
||||
|
||||
const input = v[0] === "#" ? v.substring(1) : v;
|
||||
this._url.fragment = "";
|
||||
usm.basicURLParse(input, { url: this._url, stateOverride: "fragment" });
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
return this.href;
|
||||
}
|
||||
};
|
||||
196
node_modules/whatwg-url/lib/URL.js
generated
vendored
Normal file
196
node_modules/whatwg-url/lib/URL.js
generated
vendored
Normal file
@@ -0,0 +1,196 @@
|
||||
"use strict";
|
||||
|
||||
const conversions = require("webidl-conversions");
|
||||
const utils = require("./utils.js");
|
||||
const Impl = require(".//URL-impl.js");
|
||||
|
||||
const impl = utils.implSymbol;
|
||||
|
||||
function URL(url) {
|
||||
if (!this || this[impl] || !(this instanceof URL)) {
|
||||
throw new TypeError("Failed to construct 'URL': Please use the 'new' operator, this DOM object constructor cannot be called as a function.");
|
||||
}
|
||||
if (arguments.length < 1) {
|
||||
throw new TypeError("Failed to construct 'URL': 1 argument required, but only " + arguments.length + " present.");
|
||||
}
|
||||
const args = [];
|
||||
for (let i = 0; i < arguments.length && i < 2; ++i) {
|
||||
args[i] = arguments[i];
|
||||
}
|
||||
args[0] = conversions["USVString"](args[0]);
|
||||
if (args[1] !== undefined) {
|
||||
args[1] = conversions["USVString"](args[1]);
|
||||
}
|
||||
|
||||
module.exports.setup(this, args);
|
||||
}
|
||||
|
||||
URL.prototype.toJSON = function toJSON() {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
const args = [];
|
||||
for (let i = 0; i < arguments.length && i < 0; ++i) {
|
||||
args[i] = arguments[i];
|
||||
}
|
||||
return this[impl].toJSON.apply(this[impl], args);
|
||||
};
|
||||
Object.defineProperty(URL.prototype, "href", {
|
||||
get() {
|
||||
return this[impl].href;
|
||||
},
|
||||
set(V) {
|
||||
V = conversions["USVString"](V);
|
||||
this[impl].href = V;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
URL.prototype.toString = function () {
|
||||
if (!this || !module.exports.is(this)) {
|
||||
throw new TypeError("Illegal invocation");
|
||||
}
|
||||
return this.href;
|
||||
};
|
||||
|
||||
Object.defineProperty(URL.prototype, "origin", {
|
||||
get() {
|
||||
return this[impl].origin;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(URL.prototype, "protocol", {
|
||||
get() {
|
||||
return this[impl].protocol;
|
||||
},
|
||||
set(V) {
|
||||
V = conversions["USVString"](V);
|
||||
this[impl].protocol = V;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(URL.prototype, "username", {
|
||||
get() {
|
||||
return this[impl].username;
|
||||
},
|
||||
set(V) {
|
||||
V = conversions["USVString"](V);
|
||||
this[impl].username = V;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(URL.prototype, "password", {
|
||||
get() {
|
||||
return this[impl].password;
|
||||
},
|
||||
set(V) {
|
||||
V = conversions["USVString"](V);
|
||||
this[impl].password = V;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(URL.prototype, "host", {
|
||||
get() {
|
||||
return this[impl].host;
|
||||
},
|
||||
set(V) {
|
||||
V = conversions["USVString"](V);
|
||||
this[impl].host = V;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(URL.prototype, "hostname", {
|
||||
get() {
|
||||
return this[impl].hostname;
|
||||
},
|
||||
set(V) {
|
||||
V = conversions["USVString"](V);
|
||||
this[impl].hostname = V;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(URL.prototype, "port", {
|
||||
get() {
|
||||
return this[impl].port;
|
||||
},
|
||||
set(V) {
|
||||
V = conversions["USVString"](V);
|
||||
this[impl].port = V;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(URL.prototype, "pathname", {
|
||||
get() {
|
||||
return this[impl].pathname;
|
||||
},
|
||||
set(V) {
|
||||
V = conversions["USVString"](V);
|
||||
this[impl].pathname = V;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(URL.prototype, "search", {
|
||||
get() {
|
||||
return this[impl].search;
|
||||
},
|
||||
set(V) {
|
||||
V = conversions["USVString"](V);
|
||||
this[impl].search = V;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(URL.prototype, "hash", {
|
||||
get() {
|
||||
return this[impl].hash;
|
||||
},
|
||||
set(V) {
|
||||
V = conversions["USVString"](V);
|
||||
this[impl].hash = V;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
|
||||
module.exports = {
|
||||
is(obj) {
|
||||
return !!obj && obj[impl] instanceof Impl.implementation;
|
||||
},
|
||||
create(constructorArgs, privateData) {
|
||||
let obj = Object.create(URL.prototype);
|
||||
this.setup(obj, constructorArgs, privateData);
|
||||
return obj;
|
||||
},
|
||||
setup(obj, constructorArgs, privateData) {
|
||||
if (!privateData) privateData = {};
|
||||
privateData.wrapper = obj;
|
||||
|
||||
obj[impl] = new Impl.implementation(constructorArgs, privateData);
|
||||
obj[impl][utils.wrapperSymbol] = obj;
|
||||
},
|
||||
interface: URL,
|
||||
expose: {
|
||||
Window: { URL: URL },
|
||||
Worker: { URL: URL }
|
||||
}
|
||||
};
|
||||
|
||||
11
node_modules/whatwg-url/lib/public-api.js
generated
vendored
Normal file
11
node_modules/whatwg-url/lib/public-api.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
exports.URL = require("./URL").interface;
|
||||
exports.serializeURL = require("./url-state-machine").serializeURL;
|
||||
exports.serializeURLOrigin = require("./url-state-machine").serializeURLOrigin;
|
||||
exports.basicURLParse = require("./url-state-machine").basicURLParse;
|
||||
exports.setTheUsername = require("./url-state-machine").setTheUsername;
|
||||
exports.setThePassword = require("./url-state-machine").setThePassword;
|
||||
exports.serializeHost = require("./url-state-machine").serializeHost;
|
||||
exports.serializeInteger = require("./url-state-machine").serializeInteger;
|
||||
exports.parseURL = require("./url-state-machine").parseURL;
|
||||
1297
node_modules/whatwg-url/lib/url-state-machine.js
generated
vendored
Normal file
1297
node_modules/whatwg-url/lib/url-state-machine.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
20
node_modules/whatwg-url/lib/utils.js
generated
vendored
Normal file
20
node_modules/whatwg-url/lib/utils.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
|
||||
module.exports.mixin = function mixin(target, source) {
|
||||
const keys = Object.getOwnPropertyNames(source);
|
||||
for (let i = 0; i < keys.length; ++i) {
|
||||
Object.defineProperty(target, keys[i], Object.getOwnPropertyDescriptor(source, keys[i]));
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.wrapperSymbol = Symbol("wrapper");
|
||||
module.exports.implSymbol = Symbol("impl");
|
||||
|
||||
module.exports.wrapperForImpl = function (impl) {
|
||||
return impl[module.exports.wrapperSymbol];
|
||||
};
|
||||
|
||||
module.exports.implForWrapper = function (wrapper) {
|
||||
return wrapper[module.exports.implSymbol];
|
||||
};
|
||||
|
||||
32
node_modules/whatwg-url/package.json
generated
vendored
Normal file
32
node_modules/whatwg-url/package.json
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "whatwg-url",
|
||||
"version": "5.0.0",
|
||||
"description": "An implementation of the WHATWG URL Standard's URL API and parsing machinery",
|
||||
"main": "lib/public-api.js",
|
||||
"files": [
|
||||
"lib/"
|
||||
],
|
||||
"author": "Sebastian Mayr <github@smayr.name>",
|
||||
"license": "MIT",
|
||||
"repository": "jsdom/whatwg-url",
|
||||
"dependencies": {
|
||||
"tr46": "~0.0.3",
|
||||
"webidl-conversions": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^2.6.0",
|
||||
"istanbul": "~0.4.3",
|
||||
"mocha": "^2.2.4",
|
||||
"recast": "~0.10.29",
|
||||
"request": "^2.55.0",
|
||||
"webidl2js": "^3.0.2"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node scripts/transform.js && node scripts/convert-idl.js",
|
||||
"coverage": "istanbul cover node_modules/mocha/bin/_mocha",
|
||||
"lint": "eslint .",
|
||||
"prepublish": "npm run build",
|
||||
"pretest": "node scripts/get-latest-platform-tests.js && npm run build",
|
||||
"test": "mocha"
|
||||
}
|
||||
}
|
||||
118
package-lock.json
generated
118
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "codeql",
|
||||
"version": "1.0.29",
|
||||
"version": "1.0.31",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "codeql",
|
||||
"version": "1.0.29",
|
||||
"version": "1.0.31",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/artifact": "^0.5.2",
|
||||
@@ -56,7 +56,7 @@
|
||||
"micromatch": "4.0.4",
|
||||
"nock": "^13.1.1",
|
||||
"removeNPMAbsolutePaths": "2.0.0",
|
||||
"sinon": "^11.1.2",
|
||||
"sinon": "^13.0.0",
|
||||
"typescript": "^4.4.2"
|
||||
}
|
||||
},
|
||||
@@ -527,9 +527,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@sinonjs/samsam": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-6.0.2.tgz",
|
||||
"integrity": "sha512-jxPRPp9n93ci7b8hMfJOFDPRLFYadN6FSpeROFTR4UNF4i5b+EK6m4QXPO46BDhFgRy1JuS87zAnFOzCUwMJcQ==",
|
||||
"version": "6.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-6.1.1.tgz",
|
||||
"integrity": "sha512-cZ7rKJTLiE7u7Wi/v9Hc2fs3Ucc3jrWeMgPHbbTCeVAB2S0wOBbYlkJVeNSL04i7fdhT8wIbDq1zhC/PXTD2SA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@sinonjs/commons": "^1.6.0",
|
||||
@@ -4378,10 +4378,22 @@
|
||||
}
|
||||
},
|
||||
"node_modules/node-fetch": {
|
||||
"version": "2.6.1",
|
||||
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==",
|
||||
"version": "2.6.7",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
|
||||
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
|
||||
"dependencies": {
|
||||
"whatwg-url": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "4.x || >=6.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"encoding": "^0.1.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"encoding": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/normalize-package-data": {
|
||||
@@ -5600,14 +5612,14 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/sinon": {
|
||||
"version": "11.1.2",
|
||||
"resolved": "https://registry.npmjs.org/sinon/-/sinon-11.1.2.tgz",
|
||||
"integrity": "sha512-59237HChms4kg7/sXhiRcUzdSkKuydDeTiamT/jesUVHshBgL8XAmhgFo0GfK6RruMDM/iRSij1EybmMog9cJw==",
|
||||
"version": "13.0.0",
|
||||
"resolved": "https://registry.npmjs.org/sinon/-/sinon-13.0.0.tgz",
|
||||
"integrity": "sha512-3tjMDB/tY04b06Bnb4aMKQfNrau2C9HET+R4HVWfv2KegDVLGg4wnBqjVepvxR7S7R1GTwDZzEv52tpFipt6yA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@sinonjs/commons": "^1.8.3",
|
||||
"@sinonjs/fake-timers": "^7.1.2",
|
||||
"@sinonjs/samsam": "^6.0.2",
|
||||
"@sinonjs/fake-timers": "^9.0.0",
|
||||
"@sinonjs/samsam": "^6.1.1",
|
||||
"diff": "^5.0.0",
|
||||
"nise": "^5.1.0",
|
||||
"supports-color": "^7.2.0"
|
||||
@@ -5617,6 +5629,15 @@
|
||||
"url": "https://opencollective.com/sinon"
|
||||
}
|
||||
},
|
||||
"node_modules/sinon/node_modules/@sinonjs/fake-timers": {
|
||||
"version": "9.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-9.0.0.tgz",
|
||||
"integrity": "sha512-+shXA2X7KNP7H7qNbQTJ3SA+NQc0pZDSBrdvFSRwF8sAo/ohw+ZQFD8Moc+gnz51+1eRXtEQBpKWPiQ4jsRC/w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@sinonjs/commons": "^1.7.0"
|
||||
}
|
||||
},
|
||||
"node_modules/sinon/node_modules/has-flag": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||
@@ -6074,6 +6095,11 @@
|
||||
"node": ">=8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/tr46": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
||||
"integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o="
|
||||
},
|
||||
"node_modules/trim-off-newlines": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/trim-off-newlines/-/trim-off-newlines-1.0.2.tgz",
|
||||
@@ -6369,6 +6395,11 @@
|
||||
"defaults": "^1.0.3"
|
||||
}
|
||||
},
|
||||
"node_modules/webidl-conversions": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
||||
"integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE="
|
||||
},
|
||||
"node_modules/well-known-symbols": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/well-known-symbols/-/well-known-symbols-2.0.0.tgz",
|
||||
@@ -6378,6 +6409,15 @@
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/whatwg-url": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
|
||||
"integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=",
|
||||
"dependencies": {
|
||||
"tr46": "~0.0.3",
|
||||
"webidl-conversions": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/which": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||
@@ -6984,9 +7024,9 @@
|
||||
}
|
||||
},
|
||||
"@sinonjs/samsam": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-6.0.2.tgz",
|
||||
"integrity": "sha512-jxPRPp9n93ci7b8hMfJOFDPRLFYadN6FSpeROFTR4UNF4i5b+EK6m4QXPO46BDhFgRy1JuS87zAnFOzCUwMJcQ==",
|
||||
"version": "6.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-6.1.1.tgz",
|
||||
"integrity": "sha512-cZ7rKJTLiE7u7Wi/v9Hc2fs3Ucc3jrWeMgPHbbTCeVAB2S0wOBbYlkJVeNSL04i7fdhT8wIbDq1zhC/PXTD2SA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@sinonjs/commons": "^1.6.0",
|
||||
@@ -9800,8 +9840,12 @@
|
||||
}
|
||||
},
|
||||
"node-fetch": {
|
||||
"version": "2.6.1",
|
||||
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
|
||||
"version": "2.6.7",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
|
||||
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
|
||||
"requires": {
|
||||
"whatwg-url": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"normalize-package-data": {
|
||||
"version": "2.5.0",
|
||||
@@ -10692,19 +10736,28 @@
|
||||
"dev": true
|
||||
},
|
||||
"sinon": {
|
||||
"version": "11.1.2",
|
||||
"resolved": "https://registry.npmjs.org/sinon/-/sinon-11.1.2.tgz",
|
||||
"integrity": "sha512-59237HChms4kg7/sXhiRcUzdSkKuydDeTiamT/jesUVHshBgL8XAmhgFo0GfK6RruMDM/iRSij1EybmMog9cJw==",
|
||||
"version": "13.0.0",
|
||||
"resolved": "https://registry.npmjs.org/sinon/-/sinon-13.0.0.tgz",
|
||||
"integrity": "sha512-3tjMDB/tY04b06Bnb4aMKQfNrau2C9HET+R4HVWfv2KegDVLGg4wnBqjVepvxR7S7R1GTwDZzEv52tpFipt6yA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@sinonjs/commons": "^1.8.3",
|
||||
"@sinonjs/fake-timers": "^7.1.2",
|
||||
"@sinonjs/samsam": "^6.0.2",
|
||||
"@sinonjs/fake-timers": "^9.0.0",
|
||||
"@sinonjs/samsam": "^6.1.1",
|
||||
"diff": "^5.0.0",
|
||||
"nise": "^5.1.0",
|
||||
"supports-color": "^7.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@sinonjs/fake-timers": {
|
||||
"version": "9.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-9.0.0.tgz",
|
||||
"integrity": "sha512-+shXA2X7KNP7H7qNbQTJ3SA+NQc0pZDSBrdvFSRwF8sAo/ohw+ZQFD8Moc+gnz51+1eRXtEQBpKWPiQ4jsRC/w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@sinonjs/commons": "^1.7.0"
|
||||
}
|
||||
},
|
||||
"has-flag": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||
@@ -11061,6 +11114,11 @@
|
||||
"is-number": "^7.0.0"
|
||||
}
|
||||
},
|
||||
"tr46": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
||||
"integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o="
|
||||
},
|
||||
"trim-off-newlines": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/trim-off-newlines/-/trim-off-newlines-1.0.2.tgz",
|
||||
@@ -11288,12 +11346,26 @@
|
||||
"defaults": "^1.0.3"
|
||||
}
|
||||
},
|
||||
"webidl-conversions": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
||||
"integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE="
|
||||
},
|
||||
"well-known-symbols": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/well-known-symbols/-/well-known-symbols-2.0.0.tgz",
|
||||
"integrity": "sha512-ZMjC3ho+KXo0BfJb7JgtQ5IBuvnShdlACNkKkdsqBmYw3bPAaJfPeYUo6tLUaT5tG/Gkh7xkpBhKRQ9e7pyg9Q==",
|
||||
"dev": true
|
||||
},
|
||||
"whatwg-url": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
|
||||
"integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=",
|
||||
"requires": {
|
||||
"tr46": "~0.0.3",
|
||||
"webidl-conversions": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"which": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "codeql",
|
||||
"version": "1.0.29",
|
||||
"version": "1.0.31",
|
||||
"private": true,
|
||||
"description": "CodeQL action",
|
||||
"scripts": {
|
||||
@@ -72,7 +72,7 @@
|
||||
"micromatch": "4.0.4",
|
||||
"nock": "^13.1.1",
|
||||
"removeNPMAbsolutePaths": "2.0.0",
|
||||
"sinon": "^11.1.2",
|
||||
"sinon": "^13.0.0",
|
||||
"typescript": "^4.4.2"
|
||||
},
|
||||
"resolutions": {
|
||||
|
||||
35
runner/package-lock.json
generated
35
runner/package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "codeql-runner",
|
||||
"version": "1.0.29",
|
||||
"version": "1.0.31",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@@ -1290,10 +1290,13 @@
|
||||
}
|
||||
},
|
||||
"node-fetch": {
|
||||
"version": "2.6.1",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
|
||||
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==",
|
||||
"dev": true
|
||||
"version": "2.6.7",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
|
||||
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"whatwg-url": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"node-releases": {
|
||||
"version": "1.1.74",
|
||||
@@ -1905,6 +1908,12 @@
|
||||
"is-number": "^7.0.0"
|
||||
}
|
||||
},
|
||||
"tr46": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
||||
"integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=",
|
||||
"dev": true
|
||||
},
|
||||
"ts-loader": {
|
||||
"version": "9.2.5",
|
||||
"resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.2.5.tgz",
|
||||
@@ -1978,6 +1987,12 @@
|
||||
"graceful-fs": "^4.1.2"
|
||||
}
|
||||
},
|
||||
"webidl-conversions": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
||||
"integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=",
|
||||
"dev": true
|
||||
},
|
||||
"webpack": {
|
||||
"version": "5.50.0",
|
||||
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.50.0.tgz",
|
||||
@@ -2055,6 +2070,16 @@
|
||||
"integrity": "sha512-fahN08Et7P9trej8xz/Z7eRu8ltyiygEo/hnRi9KqBUs80KeDcnf96ZJo++ewWd84fEf3xSX9bp4ZS9hbw0OBw==",
|
||||
"dev": true
|
||||
},
|
||||
"whatwg-url": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
|
||||
"integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"tr46": "~0.0.3",
|
||||
"webidl-conversions": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"which": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "codeql-runner",
|
||||
"version": "1.0.29",
|
||||
"version": "1.0.31",
|
||||
"private": true,
|
||||
"description": "CodeQL runner",
|
||||
"scripts": {
|
||||
|
||||
@@ -111,12 +111,6 @@ async function run() {
|
||||
repositoryNwo,
|
||||
logger
|
||||
);
|
||||
// We currently perform an API request in both the `init` and `analyze` Actions to determine
|
||||
// what feature flags are enabled. At the time of writing, this redundant API call is acceptable
|
||||
// to us, but if we wanted to avoid it, we could do so by serializing the feature flags as part
|
||||
// of the config file.
|
||||
void featureFlags.preloadFeatureFlags();
|
||||
|
||||
await runFinalize(outputDir, threads, memory, config, logger);
|
||||
if (actionsUtil.getRequiredInput("skip-queries") !== "true") {
|
||||
runStats = await runQueries(
|
||||
|
||||
@@ -232,12 +232,7 @@ export async function runQueries(
|
||||
|
||||
try {
|
||||
if (hasPackWithCustomQueries) {
|
||||
logger.info("*************");
|
||||
logger.info(
|
||||
"Performing analysis with custom QL Packs. QL Packs are an experimental feature."
|
||||
);
|
||||
logger.info("And should not be used in production yet.");
|
||||
logger.info("*************");
|
||||
logger.info("Performing analysis with custom CodeQL Packs.");
|
||||
logger.startGroup(`Downloading custom packs for ${language}`);
|
||||
|
||||
const codeql = await getCodeQL(config.codeQLCmd);
|
||||
|
||||
@@ -805,7 +805,12 @@ async function getCodeQLForCmd(
|
||||
await toolrunnerErrorCatcher(cmd, args, errorMatchers);
|
||||
},
|
||||
async resolveLanguages() {
|
||||
const codeqlArgs = ["resolve", "languages", "--format=json"];
|
||||
const codeqlArgs = [
|
||||
"resolve",
|
||||
"languages",
|
||||
"--format=json",
|
||||
...getExtraOptionsFromEnv(["resolve", "languages"]),
|
||||
];
|
||||
const output = await runTool(cmd, codeqlArgs);
|
||||
|
||||
try {
|
||||
@@ -956,6 +961,7 @@ async function getCodeQLForCmd(
|
||||
"cleanup",
|
||||
databasePath,
|
||||
`--mode=${cleanupLevel}`,
|
||||
...getExtraOptionsFromEnv(["database", "cleanup"]),
|
||||
];
|
||||
await runTool(cmd, codeqlArgs);
|
||||
},
|
||||
@@ -970,6 +976,7 @@ async function getCodeQLForCmd(
|
||||
databasePath,
|
||||
`--output=${outputFilePath}`,
|
||||
`--name=${databaseName}`,
|
||||
...getExtraOptionsFromEnv(["database", "bundle"]),
|
||||
];
|
||||
await new toolrunner.ToolRunner(cmd, args).exec();
|
||||
},
|
||||
|
||||
@@ -10,7 +10,7 @@ import * as apiClient from "./api-client";
|
||||
import { setCodeQL } from "./codeql";
|
||||
import { Config } from "./config-utils";
|
||||
import { uploadDatabases } from "./database-upload";
|
||||
import { createFeatureFlags, FeatureFlag, FeatureFlags } from "./feature-flags";
|
||||
import { createFeatureFlags, FeatureFlag } from "./feature-flags";
|
||||
import { Language } from "./languages";
|
||||
import { RepositoryNwo } from "./repository";
|
||||
import {
|
||||
@@ -37,7 +37,6 @@ test.beforeEach(() => {
|
||||
|
||||
const uploadToUploadsDomainFlags = createFeatureFlags([
|
||||
FeatureFlag.DatabaseUploadsEnabled,
|
||||
FeatureFlag.UploadsDomainEnabled,
|
||||
]);
|
||||
|
||||
const testRepoName: RepositoryNwo = { owner: "github", repo: "example" };
|
||||
@@ -65,18 +64,14 @@ function getTestConfig(tmpDir: string): Config {
|
||||
};
|
||||
}
|
||||
|
||||
async function mockHttpRequests(
|
||||
featureFlags: FeatureFlags,
|
||||
databaseUploadStatusCode: number
|
||||
) {
|
||||
async function mockHttpRequests(databaseUploadStatusCode: number) {
|
||||
// Passing an auth token is required, so we just use a dummy value
|
||||
const client = github.getOctokit("123");
|
||||
|
||||
const requestSpy = sinon.stub(client, "request");
|
||||
|
||||
const url = (await featureFlags.getValue(FeatureFlag.UploadsDomainEnabled))
|
||||
? "POST https://uploads.github.com/repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name"
|
||||
: "PUT /repos/:owner/:repo/code-scanning/codeql/databases/:language";
|
||||
const url =
|
||||
"POST https://uploads.github.com/repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name";
|
||||
const databaseUploadSpy = requestSpy.withArgs(url);
|
||||
if (databaseUploadStatusCode < 300) {
|
||||
databaseUploadSpy.resolves(undefined);
|
||||
@@ -222,7 +217,7 @@ test("Abort database upload if feature flag is disabled", async (t) => {
|
||||
await uploadDatabases(
|
||||
testRepoName,
|
||||
getTestConfig(tmpDir),
|
||||
createFeatureFlags([FeatureFlag.UploadsDomainEnabled]),
|
||||
createFeatureFlags([]),
|
||||
testApiDetails,
|
||||
getRecordingLogger(loggedMessages)
|
||||
);
|
||||
@@ -250,7 +245,7 @@ test("Don't crash if uploading a database fails", async (t) => {
|
||||
FeatureFlag.DatabaseUploadsEnabled,
|
||||
]);
|
||||
|
||||
await mockHttpRequests(featureFlags, 500);
|
||||
await mockHttpRequests(500);
|
||||
|
||||
setCodeQL({
|
||||
async databaseBundle(_: string, outputFilePath: string) {
|
||||
@@ -287,7 +282,7 @@ test("Successfully uploading a database to api.github.com", async (t) => {
|
||||
.returns("true");
|
||||
sinon.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(true);
|
||||
|
||||
await mockHttpRequests(uploadToUploadsDomainFlags, 201);
|
||||
await mockHttpRequests(201);
|
||||
|
||||
setCodeQL({
|
||||
async databaseBundle(_: string, outputFilePath: string) {
|
||||
@@ -322,7 +317,7 @@ test("Successfully uploading a database to uploads.github.com", async (t) => {
|
||||
.returns("true");
|
||||
sinon.stub(actionsUtil, "isAnalyzingDefaultBranch").resolves(true);
|
||||
|
||||
await mockHttpRequests(uploadToUploadsDomainFlags, 201);
|
||||
await mockHttpRequests(201);
|
||||
|
||||
setCodeQL({
|
||||
async databaseBundle(_: string, outputFilePath: string) {
|
||||
|
||||
@@ -43,9 +43,6 @@ export async function uploadDatabases(
|
||||
|
||||
const client = getApiClient(apiDetails);
|
||||
const codeql = await getCodeQL(config.codeQLCmd);
|
||||
const useUploadDomain = await featureFlags.getValue(
|
||||
FeatureFlag.UploadsDomainEnabled
|
||||
);
|
||||
|
||||
for (const language of config.languages) {
|
||||
// Upload the database bundle.
|
||||
@@ -56,31 +53,20 @@ export async function uploadDatabases(
|
||||
await bundleDb(config, language, codeql, language)
|
||||
);
|
||||
try {
|
||||
if (useUploadDomain) {
|
||||
await client.request(
|
||||
`POST https://uploads.github.com/repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name`,
|
||||
{
|
||||
owner: repositoryNwo.owner,
|
||||
repo: repositoryNwo.repo,
|
||||
language,
|
||||
name: `${language}-database`,
|
||||
data: payload,
|
||||
headers: {
|
||||
authorization: `token ${apiDetails.auth}`,
|
||||
},
|
||||
}
|
||||
);
|
||||
} else {
|
||||
await client.request(
|
||||
`PUT /repos/:owner/:repo/code-scanning/codeql/databases/:language`,
|
||||
{
|
||||
owner: repositoryNwo.owner,
|
||||
repo: repositoryNwo.repo,
|
||||
language,
|
||||
data: payload,
|
||||
}
|
||||
);
|
||||
}
|
||||
await client.request(
|
||||
`POST https://uploads.github.com/repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name`,
|
||||
{
|
||||
owner: repositoryNwo.owner,
|
||||
repo: repositoryNwo.repo,
|
||||
language,
|
||||
name: `${language}-database`,
|
||||
data: payload,
|
||||
headers: {
|
||||
authorization: `token ${apiDetails.auth}`,
|
||||
"Content-Type": "application/zip",
|
||||
},
|
||||
}
|
||||
);
|
||||
logger.debug(`Successfully uploaded database for ${language}`);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"bundleVersion": "codeql-bundle-20220112"
|
||||
"bundleVersion": "codeql-bundle-20220120"
|
||||
}
|
||||
|
||||
@@ -88,7 +88,6 @@ test("Feature flags are disabled if they're not returned in API response", async
|
||||
for (const featureFlag of [
|
||||
"database_uploads_enabled",
|
||||
"ml_powered_queries_enabled",
|
||||
"uploads_domain_enabled",
|
||||
]) {
|
||||
t.assert(
|
||||
loggedMessages.find(
|
||||
@@ -115,17 +114,19 @@ test("Feature flags exception is propagated if the API request errors", async (t
|
||||
|
||||
mockFeatureFlagApiEndpoint(500, {});
|
||||
|
||||
await t.throwsAsync(async () => featureFlags.preloadFeatureFlags(), {
|
||||
message:
|
||||
"Encountered an error while trying to load feature flags: Error: some error message",
|
||||
});
|
||||
await t.throwsAsync(
|
||||
async () => featureFlags.getValue(FeatureFlag.DatabaseUploadsEnabled),
|
||||
{
|
||||
message:
|
||||
"Encountered an error while trying to load feature flags: Error: some error message",
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
const FEATURE_FLAGS = [
|
||||
"database_uploads_enabled",
|
||||
"ml_powered_queries_enabled",
|
||||
"uploads_domain_enabled",
|
||||
];
|
||||
|
||||
for (const featureFlag of FEATURE_FLAGS) {
|
||||
@@ -154,9 +155,6 @@ for (const featureFlag of FEATURE_FLAGS) {
|
||||
ml_powered_queries_enabled: await featureFlags.getValue(
|
||||
FeatureFlag.MlPoweredQueriesEnabled
|
||||
),
|
||||
uploads_domain_enabled: await featureFlags.getValue(
|
||||
FeatureFlag.UploadsDomainEnabled
|
||||
),
|
||||
};
|
||||
|
||||
t.deepEqual(actualFeatureFlags, expectedFeatureFlags);
|
||||
|
||||
@@ -10,7 +10,6 @@ export interface FeatureFlags {
|
||||
export enum FeatureFlag {
|
||||
DatabaseUploadsEnabled = "database_uploads_enabled",
|
||||
MlPoweredQueriesEnabled = "ml_powered_queries_enabled",
|
||||
UploadsDomainEnabled = "uploads_domain_enabled",
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,10 +41,6 @@ export class GitHubFeatureFlags implements FeatureFlags {
|
||||
return response;
|
||||
}
|
||||
|
||||
async preloadFeatureFlags(): Promise<void> {
|
||||
await this.getApiResponse();
|
||||
}
|
||||
|
||||
private async getApiResponse(): Promise<FeatureFlagsApiResponse> {
|
||||
const loadApiResponse = async () => {
|
||||
// Do nothing when not running against github.com
|
||||
@@ -66,13 +61,22 @@ export class GitHubFeatureFlags implements FeatureFlags {
|
||||
);
|
||||
return response.data;
|
||||
} catch (e) {
|
||||
// Some feature flags, such as `ml_powered_queries_enabled` affect the produced alerts.
|
||||
// Considering these feature flags disabled in the event of a transient error could
|
||||
// therefore lead to alert churn. As a result, we crash if we cannot determine the value of
|
||||
// the feature flags.
|
||||
throw new Error(
|
||||
`Encountered an error while trying to load feature flags: ${e}`
|
||||
);
|
||||
if (util.isHTTPError(e) && e.status === 403) {
|
||||
this.logger.warning(
|
||||
"This run of the CodeQL Action does not have permission to access Code Scanning API endpoints. " +
|
||||
"As a result, it will not be opted into any experimental features. " +
|
||||
"This could be because the Action is running on a pull request from a fork. If not, " +
|
||||
`please ensure the Action has the 'security-events: write' permission. Details: ${e}`
|
||||
);
|
||||
} else {
|
||||
// Some feature flags, such as `ml_powered_queries_enabled` affect the produced alerts.
|
||||
// Considering these feature flags disabled in the event of a transient error could
|
||||
// therefore lead to alert churn. As a result, we crash if we cannot determine the value of
|
||||
// the feature flags.
|
||||
throw new Error(
|
||||
`Encountered an error while trying to load feature flags: ${e}`
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -143,7 +143,6 @@ async function run() {
|
||||
repositoryNwo,
|
||||
logger
|
||||
);
|
||||
void featureFlags.preloadFeatureFlags();
|
||||
|
||||
try {
|
||||
const workflowErrors = await validateWorkflow();
|
||||
|
||||
49
src/init.ts
49
src/init.ts
@@ -91,26 +91,41 @@ export async function runInit(
|
||||
): Promise<TracerConfig | undefined> {
|
||||
fs.mkdirSync(config.dbLocation, { recursive: true });
|
||||
|
||||
if (await codeQlVersionAbove(codeql, CODEQL_VERSION_NEW_TRACING)) {
|
||||
// Init a database cluster
|
||||
await codeql.databaseInitCluster(
|
||||
config.dbLocation,
|
||||
config.languages,
|
||||
sourceRoot,
|
||||
processName,
|
||||
processLevel
|
||||
);
|
||||
} else {
|
||||
for (const language of config.languages) {
|
||||
// Init language database
|
||||
await codeql.databaseInit(
|
||||
util.getCodeQLDatabasePath(config, language),
|
||||
language,
|
||||
sourceRoot
|
||||
try {
|
||||
if (await codeQlVersionAbove(codeql, CODEQL_VERSION_NEW_TRACING)) {
|
||||
// Init a database cluster
|
||||
await codeql.databaseInitCluster(
|
||||
config.dbLocation,
|
||||
config.languages,
|
||||
sourceRoot,
|
||||
processName,
|
||||
processLevel
|
||||
);
|
||||
} else {
|
||||
for (const language of config.languages) {
|
||||
// Init language database
|
||||
await codeql.databaseInit(
|
||||
util.getCodeQLDatabasePath(config, language),
|
||||
language,
|
||||
sourceRoot
|
||||
);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
// Handle the situation where init is called twice
|
||||
// for the same database in the same job.
|
||||
if (
|
||||
e instanceof Error &&
|
||||
e.message?.includes("Refusing to create databases") &&
|
||||
e.message.includes("exists and is not an empty directory.")
|
||||
) {
|
||||
throw new Error(
|
||||
`Is the "init" action called twice in the same job? ${e.message}`
|
||||
);
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
return await getCombinedTracerConfig(config, codeql);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user