Initial commit
This commit is contained in:
1
themes/keepit/node_modules/.bin/JSONStream
generated
vendored
Symbolic link
1
themes/keepit/node_modules/.bin/JSONStream
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../JSONStream/bin.js
|
||||
1
themes/keepit/node_modules/.bin/acorn
generated
vendored
Symbolic link
1
themes/keepit/node_modules/.bin/acorn
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../acorn/bin/acorn
|
||||
1
themes/keepit/node_modules/.bin/algolia
generated
vendored
Symbolic link
1
themes/keepit/node_modules/.bin/algolia
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../@algolia/cli/index.js
|
||||
1
themes/keepit/node_modules/.bin/babel
generated
vendored
Symbolic link
1
themes/keepit/node_modules/.bin/babel
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../@babel/cli/bin/babel.js
|
||||
1
themes/keepit/node_modules/.bin/babel-external-helpers
generated
vendored
Symbolic link
1
themes/keepit/node_modules/.bin/babel-external-helpers
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../@babel/cli/bin/babel-external-helpers.js
|
||||
1
themes/keepit/node_modules/.bin/browser-pack
generated
vendored
Symbolic link
1
themes/keepit/node_modules/.bin/browser-pack
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../browser-pack/bin/cmd.js
|
||||
1
themes/keepit/node_modules/.bin/browserify
generated
vendored
Symbolic link
1
themes/keepit/node_modules/.bin/browserify
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../browserify/bin/cmd.js
|
||||
1
themes/keepit/node_modules/.bin/browserslist
generated
vendored
Symbolic link
1
themes/keepit/node_modules/.bin/browserslist
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../browserslist/cli.js
|
||||
1
themes/keepit/node_modules/.bin/csvtojson
generated
vendored
Symbolic link
1
themes/keepit/node_modules/.bin/csvtojson
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../csvtojson/bin/csvtojson
|
||||
1
themes/keepit/node_modules/.bin/deps-sort
generated
vendored
Symbolic link
1
themes/keepit/node_modules/.bin/deps-sort
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../deps-sort/bin/cmd.js
|
||||
1
themes/keepit/node_modules/.bin/detective
generated
vendored
Symbolic link
1
themes/keepit/node_modules/.bin/detective
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../detective/bin/detective.js
|
||||
1
themes/keepit/node_modules/.bin/envify
generated
vendored
Symbolic link
1
themes/keepit/node_modules/.bin/envify
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../envify/bin/envify
|
||||
1
themes/keepit/node_modules/.bin/esparse
generated
vendored
Symbolic link
1
themes/keepit/node_modules/.bin/esparse
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../esprima/bin/esparse.js
|
||||
1
themes/keepit/node_modules/.bin/esvalidate
generated
vendored
Symbolic link
1
themes/keepit/node_modules/.bin/esvalidate
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../esprima/bin/esvalidate.js
|
||||
1
themes/keepit/node_modules/.bin/husky
generated
vendored
Symbolic link
1
themes/keepit/node_modules/.bin/husky
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../husky/lib/bin.js
|
||||
1
themes/keepit/node_modules/.bin/insert-module-globals
generated
vendored
Symbolic link
1
themes/keepit/node_modules/.bin/insert-module-globals
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../insert-module-globals/bin/cmd.js
|
||||
1
themes/keepit/node_modules/.bin/jsesc
generated
vendored
Symbolic link
1
themes/keepit/node_modules/.bin/jsesc
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../jsesc/bin/jsesc
|
||||
1
themes/keepit/node_modules/.bin/json5
generated
vendored
Symbolic link
1
themes/keepit/node_modules/.bin/json5
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../json5/lib/cli.js
|
||||
1
themes/keepit/node_modules/.bin/miller-rabin
generated
vendored
Symbolic link
1
themes/keepit/node_modules/.bin/miller-rabin
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../miller-rabin/bin/miller-rabin
|
||||
1
themes/keepit/node_modules/.bin/module-deps
generated
vendored
Symbolic link
1
themes/keepit/node_modules/.bin/module-deps
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../module-deps/bin/cmd.js
|
||||
1
themes/keepit/node_modules/.bin/parser
generated
vendored
Symbolic link
1
themes/keepit/node_modules/.bin/parser
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../@babel/parser/bin/babel-parser.js
|
||||
1
themes/keepit/node_modules/.bin/regjsparser
generated
vendored
Symbolic link
1
themes/keepit/node_modules/.bin/regjsparser
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../regjsparser/bin/parser
|
||||
1
themes/keepit/node_modules/.bin/resolve
generated
vendored
Symbolic link
1
themes/keepit/node_modules/.bin/resolve
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../resolve/bin/resolve
|
||||
1
themes/keepit/node_modules/.bin/semver
generated
vendored
Symbolic link
1
themes/keepit/node_modules/.bin/semver
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../semver/bin/semver.js
|
||||
1
themes/keepit/node_modules/.bin/sha.js
generated
vendored
Symbolic link
1
themes/keepit/node_modules/.bin/sha.js
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../sha.js/bin.js
|
||||
1
themes/keepit/node_modules/.bin/speedtest-net
generated
vendored
Symbolic link
1
themes/keepit/node_modules/.bin/speedtest-net
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../speedtest-net/bin/index.js
|
||||
1
themes/keepit/node_modules/.bin/umd
generated
vendored
Symbolic link
1
themes/keepit/node_modules/.bin/umd
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../umd/bin/cli.js
|
||||
1
themes/keepit/node_modules/.bin/undeclared-identifiers
generated
vendored
Symbolic link
1
themes/keepit/node_modules/.bin/undeclared-identifiers
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../undeclared-identifiers/bin.js
|
||||
4702
themes/keepit/node_modules/.package-lock.json
generated
vendored
Normal file
4702
themes/keepit/node_modules/.package-lock.json
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
16
themes/keepit/node_modules/@algolia/cli/commands.js
generated
vendored
Normal file
16
themes/keepit/node_modules/@algolia/cli/commands.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
module.exports = {
|
||||
addrules: require('./commands/AddRules.js'),
|
||||
addsynonyms: require('./commands/AddSynonyms.js'),
|
||||
deleteindicespattern: require('./commands/DeleteIndicesPattern.js'),
|
||||
export: require('./commands/Export.js'),
|
||||
exportrules: require('./commands/ExportRules.js'),
|
||||
exportsynonyms: require('./commands/ExportSynonyms.js'),
|
||||
getsettings: require('./commands/GetSettings.js'),
|
||||
import: require('./commands/Import.js'),
|
||||
interactive: require('./commands/Interactive.js'),
|
||||
search: require('./commands/Search.js'),
|
||||
setsettings: require('./commands/SetSettings.js'),
|
||||
transferindex: require('./commands/TransferIndex.js'),
|
||||
transferindexconfig: require('./commands/TransferIndexConfig.js'),
|
||||
transformlines: require('./commands/TransformLines.js'),
|
||||
};
|
||||
72
themes/keepit/node_modules/@algolia/cli/commands/AddRules.js
generated
vendored
Normal file
72
themes/keepit/node_modules/@algolia/cli/commands/AddRules.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
const fs = require('fs');
|
||||
const algolia = require('algoliasearch');
|
||||
const Base = require('./Base.js');
|
||||
|
||||
class AddRulesScript extends Base {
|
||||
constructor() {
|
||||
super();
|
||||
// Bind class methods
|
||||
this.getSource = this.getSource.bind(this);
|
||||
this.parseBatchRulesOptions = this.parseBatchRulesOptions.bind(this);
|
||||
this.start = this.start.bind(this);
|
||||
// Define validation constants
|
||||
this.message =
|
||||
'\nExample: $ algolia addrules -a algoliaappid -k algoliaapikey -n algoliaindexname -s sourcefilepath -p batchRulesParams\n\n';
|
||||
this.params = [
|
||||
'algoliaappid',
|
||||
'algoliaapikey',
|
||||
'algoliaindexname',
|
||||
'sourcefilepath',
|
||||
];
|
||||
}
|
||||
|
||||
getSource(path) {
|
||||
const filepath = this.normalizePath(path);
|
||||
if (!fs.lstatSync(filepath).isFile())
|
||||
throw new Error('Source filepath must target valid rules file.');
|
||||
return filepath;
|
||||
}
|
||||
|
||||
parseBatchRulesOptions(params) {
|
||||
try {
|
||||
const options = { forwardToReplicas: false, clearExistingRules: false };
|
||||
if (params === null) return options;
|
||||
else return JSON.parse(params);
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
async start(program) {
|
||||
try {
|
||||
// Validate command; if invalid display help text and exit
|
||||
this.validate(program, this.message, this.params);
|
||||
|
||||
// Config params
|
||||
const appId = program.algoliaappid;
|
||||
const apiKey = program.algoliaapikey;
|
||||
const indexName = program.algoliaindexname;
|
||||
const sourcefilepath = program.sourcefilepath;
|
||||
const params = program.params || null;
|
||||
|
||||
// Get rules
|
||||
const rulesPath = this.getSource(sourcefilepath);
|
||||
const rulesFile = await fs.readFileSync(rulesPath);
|
||||
const rules = JSON.parse(rulesFile);
|
||||
// Get options
|
||||
const batchRulesOptions = this.parseBatchRulesOptions(params);
|
||||
|
||||
// Instantiate Algolia index
|
||||
const client = algolia(appId, apiKey);
|
||||
const index = client.initIndex(indexName);
|
||||
// Add rules
|
||||
const result = await index.batchRules(rules, batchRulesOptions);
|
||||
return console.log(result);
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const addRulesScript = new AddRulesScript();
|
||||
module.exports = addRulesScript;
|
||||
89
themes/keepit/node_modules/@algolia/cli/commands/AddSynonyms.js
generated
vendored
Normal file
89
themes/keepit/node_modules/@algolia/cli/commands/AddSynonyms.js
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
const fs = require('fs');
|
||||
const algolia = require('algoliasearch');
|
||||
const Base = require('./Base.js');
|
||||
|
||||
class AddSynonymsScript extends Base {
|
||||
constructor() {
|
||||
super();
|
||||
// Bind class methods
|
||||
this.getSource = this.getSource.bind(this);
|
||||
this.parseBatchSynonymsOptions = this.parseBatchSynonymsOptions.bind(this);
|
||||
this.convertCsvToJson = this.convertCsvToJson.bind(this);
|
||||
this.start = this.start.bind(this);
|
||||
// Define validation constants
|
||||
this.message =
|
||||
'\nExample: $ algolia addsynonyms -a algoliaappid -k algoliaapikey -n algoliaindexname -s sourcefilepath -p batchSynonymsParams\n\n';
|
||||
this.params = [
|
||||
'algoliaappid',
|
||||
'algoliaapikey',
|
||||
'algoliaindexname',
|
||||
'sourcefilepath',
|
||||
];
|
||||
}
|
||||
|
||||
getSource(path) {
|
||||
const filepath = this.normalizePath(path);
|
||||
if (!fs.lstatSync(filepath).isFile())
|
||||
throw new Error('Source filepath must target valid synonyms file.');
|
||||
return filepath;
|
||||
}
|
||||
|
||||
parseBatchSynonymsOptions(params) {
|
||||
try {
|
||||
const options = {
|
||||
forwardToReplicas: false,
|
||||
clearExistingSynonyms: false,
|
||||
};
|
||||
if (params === null) return options;
|
||||
else return JSON.parse(params);
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
convertCsvToJson(synonymFile, filepath) {
|
||||
const synonyms = synonymFile.toString().split('\n');
|
||||
return synonyms.map((line, num) => ({
|
||||
type: 'synonym',
|
||||
objectID: `${filepath}-${num}`,
|
||||
synonyms: line.split(','),
|
||||
}));
|
||||
}
|
||||
|
||||
async start(program) {
|
||||
try {
|
||||
// Validate command; if invalid display help text and exit
|
||||
this.validate(program, this.message, this.params);
|
||||
|
||||
// Config params
|
||||
const appId = program.algoliaappid;
|
||||
const apiKey = program.algoliaapikey;
|
||||
const indexName = program.algoliaindexname;
|
||||
const sourcefilepath = program.sourcefilepath;
|
||||
const params = program.params || null;
|
||||
const isCsv = sourcefilepath.split('.').pop() === 'csv';
|
||||
|
||||
// Get synonyms
|
||||
const synonymsPath = this.getSource(sourcefilepath);
|
||||
const synonymsFile = await fs.readFileSync(synonymsPath);
|
||||
const synonyms = isCsv
|
||||
? this.convertCsvToJson(synonymsFile, sourcefilepath)
|
||||
: JSON.parse(synonymsFile);
|
||||
|
||||
// Get options
|
||||
const batchSynonymsOptions = this.parseBatchSynonymsOptions(params);
|
||||
|
||||
// Instantiate Algolia index
|
||||
const client = algolia(appId, apiKey);
|
||||
const index = client.initIndex(indexName);
|
||||
// Add rules
|
||||
const result = await index.batchSynonyms(synonyms, batchSynonymsOptions);
|
||||
return console.log(result);
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const addSynonymsScript = new AddSynonymsScript();
|
||||
module.exports = addSynonymsScript;
|
||||
97
themes/keepit/node_modules/@algolia/cli/commands/Base.js
generated
vendored
Normal file
97
themes/keepit/node_modules/@algolia/cli/commands/Base.js
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
const os = require('os');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const readLine = require('readline');
|
||||
const chalk = require('chalk');
|
||||
const speedTest = require('speedtest-net');
|
||||
|
||||
class Base {
|
||||
constructor() {
|
||||
this.maxHeapMb = process.arch.includes('64') ? 1024 : 512;
|
||||
}
|
||||
|
||||
validate(program, message, params) {
|
||||
let flag = false;
|
||||
let output = message;
|
||||
params.forEach(param => {
|
||||
if (!program[param]) {
|
||||
output += chalk.red(`Must specify ${param}\n`);
|
||||
flag = true;
|
||||
}
|
||||
});
|
||||
if (flag) return program.help(h => h + output);
|
||||
else return { flag, output };
|
||||
}
|
||||
|
||||
writeProgress(message) {
|
||||
readLine.clearLine(process.stdout, 0);
|
||||
readLine.cursorTo(process.stdout, 0);
|
||||
process.stdout.write(message);
|
||||
}
|
||||
|
||||
normalizePath(input) {
|
||||
// Convert path input param to valid system absolute path
|
||||
// Path is absolute, originating from system root
|
||||
if (path.isAbsolute(input)) return input;
|
||||
// Path is relative to user's home directory
|
||||
if (input[0] === '~') return path.join(os.homedir(), input.substr(1));
|
||||
// Path is relative to current directory
|
||||
return path.resolve(process.cwd(), input);
|
||||
}
|
||||
|
||||
setSource(options) {
|
||||
// Set source directory and filenames array
|
||||
// Used to process path inputs that may either be a single file or a directory of files
|
||||
const source = this.normalizePath(options.sourceFilepath);
|
||||
if (fs.lstatSync(source).isDirectory()) {
|
||||
this.directory = source;
|
||||
this.filenames = fs.readdirSync(source);
|
||||
} else if (fs.lstatSync(source).isFile()) {
|
||||
this.directory = path.parse(source).dir;
|
||||
this.filenames = [path.parse(source).base];
|
||||
} else {
|
||||
throw new Error('Invalid sourcefilepath param');
|
||||
}
|
||||
}
|
||||
|
||||
getMemoryUsage() {
|
||||
const used = process.memoryUsage().heapUsed / 1024 / 1024;
|
||||
const usedMb = Math.round(used * 100) / 100;
|
||||
const percentUsed = Math.floor((usedMb / this.maxHeapMb) * 100);
|
||||
return { usedMb, percentUsed };
|
||||
}
|
||||
|
||||
getStringSizeMb(string) {
|
||||
const bytes = Buffer.byteLength(string, 'utf8');
|
||||
const mb = bytes / 1024 / 1024;
|
||||
return Math.ceil(mb);
|
||||
}
|
||||
|
||||
getNetworkSpeed() {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.writeProgress('Estimating network speed...');
|
||||
const test = speedTest({ maxTime: 5000 });
|
||||
let downloadSpeedMb = null;
|
||||
let uploadSpeedMb = null;
|
||||
test.on('error', e => {
|
||||
console.log(chalk.white.bgRed('Speed test error'), chalk.red(e));
|
||||
reject(e);
|
||||
});
|
||||
test.on('downloadspeed', speed => {
|
||||
downloadSpeedMb = ((speed * 125) / 1000).toFixed(2);
|
||||
});
|
||||
test.on('uploadspeed', speed => {
|
||||
uploadSpeedMb = ((speed * 125) / 1000).toFixed(2);
|
||||
});
|
||||
test.on('done', () => {
|
||||
console.log(
|
||||
chalk.blue(`\nDownload: ${downloadSpeedMb} MB/s`),
|
||||
chalk.blue(`\nUpload: ${uploadSpeedMb} MB/s`)
|
||||
);
|
||||
resolve(uploadSpeedMb);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Base;
|
||||
104
themes/keepit/node_modules/@algolia/cli/commands/DeleteIndicesPattern.js
generated
vendored
Normal file
104
themes/keepit/node_modules/@algolia/cli/commands/DeleteIndicesPattern.js
generated
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
const algolia = require('algoliasearch');
|
||||
const Base = require('./Base.js');
|
||||
|
||||
class DeleteIndicesPatternScript extends Base {
|
||||
constructor() {
|
||||
super();
|
||||
// Define validation constants
|
||||
this.message =
|
||||
"\nUsage: $ algolia deleteindices -a algoliaappid -k algoliaapikey -r 'regexp for filtering' -x\n\n";
|
||||
this.params = ['algoliaappid', 'algoliaapikey', 'regexp', 'dryrun'];
|
||||
}
|
||||
|
||||
removeReplicas({ indices, regexp, dryRun }) {
|
||||
return Promise.all(
|
||||
indices.map(async ({ name: indexName }) => {
|
||||
const index = await this.client.initIndex(indexName);
|
||||
const indexSettings = await index.getSettings();
|
||||
const replicas = indexSettings.slaves || indexSettings.replicas;
|
||||
if (replicas !== undefined && replicas.length > 0) {
|
||||
const newReplicas = replicas.filter(
|
||||
replicaIndexName => regexp.test(replicaIndexName) === false
|
||||
);
|
||||
|
||||
if (replicas.length !== newReplicas.length) {
|
||||
if (dryRun === false) {
|
||||
const { taskID } = await index.setSettings({
|
||||
[indexSettings.slaves !== undefined
|
||||
? 'slaves'
|
||||
: 'replicas']: newReplicas,
|
||||
});
|
||||
await index.waitTask(taskID);
|
||||
} else {
|
||||
console.log(
|
||||
`[DRY RUN] Replicas change on index ${indexName}, \n- before: ${replicas.join(
|
||||
','
|
||||
)}\n- after: ${newReplicas.join(',')}`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
deleteIndices({ indices, regexp, dryRun }) {
|
||||
let deletedIndices = 0;
|
||||
return Promise.all(
|
||||
indices
|
||||
.filter(({ name: indexName }) => regexp.test(indexName) === true)
|
||||
.map(async ({ name: indexName }) => {
|
||||
deletedIndices++;
|
||||
|
||||
if (dryRun === false) {
|
||||
this.writeProgress(`Deleted indices: ${deletedIndices}`);
|
||||
const index = this.client.initIndex(indexName);
|
||||
const { taskID } = await this.client.deleteIndex(indexName);
|
||||
return index.waitTask(taskID);
|
||||
} else {
|
||||
console.log(`[DRY RUN] Delete index ${indexName}`);
|
||||
return false;
|
||||
}
|
||||
})
|
||||
).then(() => {
|
||||
console.log('');
|
||||
if (dryRun === false) {
|
||||
console.log(`${deletedIndices} indices deleted`);
|
||||
} else {
|
||||
console.log(`[DRY RUN] ${deletedIndices} indices deleted`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async deleteIndicesPattern(options) {
|
||||
this.client = algolia(options.appId, options.apiKey);
|
||||
const { items: indices } = await this.client.listIndexes();
|
||||
const regexp = new RegExp(options.regexp);
|
||||
await this.removeReplicas({ indices, regexp, dryRun: options.dryRun });
|
||||
await this.deleteIndices({ indices, regexp, dryRun: options.dryRun });
|
||||
}
|
||||
|
||||
start(program) {
|
||||
try {
|
||||
// Validate command; if invalid display help text and exit
|
||||
this.validate(program, this.message, this.params);
|
||||
|
||||
// Config params
|
||||
const options = {
|
||||
appId: program.algoliaappid,
|
||||
apiKey: program.algoliaapikey,
|
||||
regexp: program.regexp,
|
||||
dryRun: program.dryrun !== undefined ? program.dryrun === 'true' : true,
|
||||
};
|
||||
|
||||
// Delete indices
|
||||
return this.deleteIndicesPattern(options);
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = new DeleteIndicesPatternScript();
|
||||
117
themes/keepit/node_modules/@algolia/cli/commands/Export.js
generated
vendored
Normal file
117
themes/keepit/node_modules/@algolia/cli/commands/Export.js
generated
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const algolia = require('algoliasearch');
|
||||
const Base = require('./Base.js');
|
||||
|
||||
class ExportScript extends Base {
|
||||
constructor() {
|
||||
super();
|
||||
// Bind class methods
|
||||
this.getOutput = this.getOutput.bind(this);
|
||||
this.parseParams = this.parseParams.bind(this);
|
||||
this.writeFile = this.writeFile.bind(this);
|
||||
this.exportData = this.exportData.bind(this);
|
||||
this.start = this.start.bind(this);
|
||||
// Define validation constants
|
||||
this.message =
|
||||
'\nExample: $ algolia export -a algoliaappid -k algoliaapikey -n algoliaindexname -o outputpath -p params\n\n';
|
||||
this.params = ['algoliaappid', 'algoliaapikey', 'algoliaindexname'];
|
||||
}
|
||||
|
||||
getOutput(outputPath) {
|
||||
// If no outputPath is provided, use directory from which command was invoked
|
||||
const outputDir =
|
||||
outputPath !== null ? this.normalizePath(outputPath) : process.cwd();
|
||||
// Ensure outputPath is a directory
|
||||
if (!fs.lstatSync(outputDir).isDirectory())
|
||||
throw new Error('Output path must be a directory.');
|
||||
return outputDir;
|
||||
}
|
||||
|
||||
parseParams(params) {
|
||||
try {
|
||||
if (params === null) return { hitsPerPage: 1000 };
|
||||
return JSON.parse(params);
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
writeFile(hits, options, fileCount) {
|
||||
const filename = `algolia-index-${options.indexName}-${fileCount}.json`;
|
||||
const filePath = path.resolve(options.outputPath, filename);
|
||||
fs.writeFileSync(filePath, JSON.stringify(hits));
|
||||
return console.log(`\nDone writing ${filename}`);
|
||||
}
|
||||
|
||||
exportData(options) {
|
||||
return new Promise((resolve, reject) => {
|
||||
// Instantiate Algolia index
|
||||
const client = algolia(options.appId, options.apiKey);
|
||||
const index = client.initIndex(options.indexName);
|
||||
|
||||
// Export index
|
||||
const browse = index.browseAll('', options.params);
|
||||
let hits = [];
|
||||
let hitsCount = 0;
|
||||
let fileCount = 0;
|
||||
|
||||
browse.on('result', result => {
|
||||
// Push 1000 new hits to array
|
||||
hits = hits.concat(result.hits);
|
||||
hitsCount += result.hits.length;
|
||||
this.writeProgress(`Records browsed: ${hitsCount}`);
|
||||
if (hits.length >= 10000) {
|
||||
// Write batch of 10,000 records to file
|
||||
fileCount++;
|
||||
this.writeFile(hits, options, fileCount);
|
||||
// Clear array
|
||||
hits = [];
|
||||
}
|
||||
});
|
||||
|
||||
browse.on('end', () => {
|
||||
if (hits.length > 0) {
|
||||
// Write remaining records to file
|
||||
fileCount++;
|
||||
this.writeFile(hits, options, fileCount);
|
||||
}
|
||||
return resolve(
|
||||
`\nDone exporting index.\nSee your data here: ${options.outputPath}`
|
||||
);
|
||||
});
|
||||
|
||||
browse.on('error', err => reject(err));
|
||||
});
|
||||
}
|
||||
|
||||
async start(program) {
|
||||
try {
|
||||
// Validate command; if invalid display help text and exit
|
||||
this.validate(program, this.message, this.params);
|
||||
|
||||
// Config params
|
||||
const options = {
|
||||
appId: program.algoliaappid,
|
||||
apiKey: program.algoliaapikey,
|
||||
indexName: program.algoliaindexname,
|
||||
outputPath: program.outputpath || null,
|
||||
params: program.params || null,
|
||||
};
|
||||
|
||||
// Configure and validate output path
|
||||
options.outputPath = this.getOutput(options.outputPath);
|
||||
// Configure browseAll params
|
||||
options.params = this.parseParams(options.params);
|
||||
|
||||
// Export data
|
||||
const result = await this.exportData(options);
|
||||
return console.log(result);
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const exportScript = new ExportScript();
|
||||
module.exports = exportScript;
|
||||
61
themes/keepit/node_modules/@algolia/cli/commands/ExportRules.js
generated
vendored
Normal file
61
themes/keepit/node_modules/@algolia/cli/commands/ExportRules.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const algolia = require('algoliasearch');
|
||||
const Base = require('./Base.js');
|
||||
|
||||
class ExportRulesScript extends Base {
|
||||
constructor() {
|
||||
super();
|
||||
// Bind class methods
|
||||
this.getOutputPath = this.getOutputPath.bind(this);
|
||||
this.start = this.start.bind(this);
|
||||
// Define validation constants
|
||||
this.message =
|
||||
'\nExample: $ algolia exportrules -a algoliaappid -k algoliaapikey -n algoliaindexname -o outputpath\n\n';
|
||||
this.params = ['algoliaappid', 'algoliaapikey', 'algoliaindexname'];
|
||||
}
|
||||
|
||||
getOutputPath(outputpath, indexName) {
|
||||
const defaultFilename = `${indexName}-rules.json`;
|
||||
const defaultFilepath = path.resolve(process.cwd(), defaultFilename);
|
||||
// Process output filepath
|
||||
const filepath =
|
||||
outputpath !== null ? this.normalizePath(outputpath) : defaultFilepath;
|
||||
// Validate filepath targets valid directory
|
||||
const dir = path.dirname(filepath);
|
||||
if (!fs.lstatSync(dir).isDirectory()) {
|
||||
throw new Error(
|
||||
`Output path must target valid directory. Eg. ${defaultFilepath}`
|
||||
);
|
||||
}
|
||||
return filepath;
|
||||
}
|
||||
|
||||
async start(program) {
|
||||
try {
|
||||
// Validate command; if invalid display help text and exit
|
||||
this.validate(program, this.message, this.params);
|
||||
|
||||
// Config params
|
||||
const appId = program.algoliaappid;
|
||||
const apiKey = program.algoliaapikey;
|
||||
const indexName = program.algoliaindexname;
|
||||
const outputpath = program.outputpath || null;
|
||||
|
||||
const filepath = this.getOutputPath(outputpath, indexName);
|
||||
|
||||
// Instantiate Algolia index
|
||||
const client = algolia(appId, apiKey);
|
||||
const index = client.initIndex(indexName);
|
||||
// Get index settings
|
||||
const rules = await index.exportRules();
|
||||
fs.writeFileSync(filepath, JSON.stringify(rules));
|
||||
return console.log(`Done writing ${filepath}`);
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const exportRulesScript = new ExportRulesScript();
|
||||
module.exports = exportRulesScript;
|
||||
61
themes/keepit/node_modules/@algolia/cli/commands/ExportSynonyms.js
generated
vendored
Normal file
61
themes/keepit/node_modules/@algolia/cli/commands/ExportSynonyms.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const algolia = require('algoliasearch');
|
||||
const Base = require('./Base.js');
|
||||
|
||||
class ExportSynonymsScript extends Base {
|
||||
constructor() {
|
||||
super();
|
||||
// Bind class methods
|
||||
this.getOutputPath = this.getOutputPath.bind(this);
|
||||
this.start = this.start.bind(this);
|
||||
// Define validation constants
|
||||
this.message =
|
||||
'\nExample: $ algolia exportsynonyms -a algoliaappid -k algoliaapikey -n algoliaindexname -o outputpath\n\n';
|
||||
this.params = ['algoliaappid', 'algoliaapikey', 'algoliaindexname'];
|
||||
}
|
||||
|
||||
getOutputPath(outputpath, indexName) {
|
||||
const defaultFilename = `${indexName}-synonyms.json`;
|
||||
const defaultFilepath = path.resolve(process.cwd(), defaultFilename);
|
||||
// Process output filepath
|
||||
const filepath =
|
||||
outputpath !== null ? this.normalizePath(outputpath) : defaultFilepath;
|
||||
// Validate filepath targets valid directory
|
||||
const dir = path.dirname(filepath);
|
||||
if (!fs.lstatSync(dir).isDirectory()) {
|
||||
throw new Error(
|
||||
`Output path must target valid directory. Eg. ${defaultFilepath}`
|
||||
);
|
||||
}
|
||||
return filepath;
|
||||
}
|
||||
|
||||
async start(program) {
|
||||
try {
|
||||
// Validate command; if invalid display help text and exit
|
||||
this.validate(program, this.message, this.params);
|
||||
|
||||
// Config params
|
||||
const appId = program.algoliaappid;
|
||||
const apiKey = program.algoliaapikey;
|
||||
const indexName = program.algoliaindexname;
|
||||
const outputpath = program.outputpath || null;
|
||||
|
||||
const filepath = this.getOutputPath(outputpath, indexName);
|
||||
|
||||
// Instantiate Algolia index
|
||||
const client = algolia(appId, apiKey);
|
||||
const index = client.initIndex(indexName);
|
||||
// Get index settings
|
||||
const synonyms = await index.exportSynonyms();
|
||||
fs.writeFileSync(filepath, JSON.stringify(synonyms));
|
||||
return console.log(`Done writing ${filepath}`);
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const exportSynonymsScript = new ExportSynonymsScript();
|
||||
module.exports = exportSynonymsScript;
|
||||
38
themes/keepit/node_modules/@algolia/cli/commands/GetSettings.js
generated
vendored
Normal file
38
themes/keepit/node_modules/@algolia/cli/commands/GetSettings.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
const algolia = require('algoliasearch');
|
||||
const Base = require('./Base.js');
|
||||
|
||||
class GetSettingsScript extends Base {
|
||||
constructor() {
|
||||
super();
|
||||
// Bind class methods
|
||||
this.start = this.start.bind(this);
|
||||
// Define validation constants
|
||||
this.message =
|
||||
'\nExample: $ algolia getsettings -a algoliaappid -k algoliaapikey -n algoliaindexname\n\n';
|
||||
this.params = ['algoliaappid', 'algoliaapikey', 'algoliaindexname'];
|
||||
}
|
||||
|
||||
async start(program) {
|
||||
try {
|
||||
// Validate command; if invalid display help text and exit
|
||||
this.validate(program, this.message, this.params);
|
||||
|
||||
// Config params
|
||||
const appId = program.algoliaappid;
|
||||
const apiKey = program.algoliaapikey;
|
||||
const indexName = program.algoliaindexname;
|
||||
|
||||
// Instantiate Algolia index
|
||||
const client = algolia(appId, apiKey);
|
||||
const index = client.initIndex(indexName);
|
||||
// Get index settings
|
||||
const settings = await index.getSettings();
|
||||
return console.log(JSON.stringify(settings));
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const getSettingsScript = new GetSettingsScript();
|
||||
module.exports = getSettingsScript;
|
||||
379
themes/keepit/node_modules/@algolia/cli/commands/Import.js
generated
vendored
Normal file
379
themes/keepit/node_modules/@algolia/cli/commands/Import.js
generated
vendored
Normal file
@@ -0,0 +1,379 @@
|
||||
const fs = require('fs');
|
||||
const JSONStream = require('JSONStream');
|
||||
const through = require('through');
|
||||
const transform = require('stream-transform');
|
||||
const Batch = require('batch-stream');
|
||||
const async = require('async');
|
||||
const csv = require('csvtojson');
|
||||
const regexParser = require('regex-parser');
|
||||
const chalk = require('chalk');
|
||||
const algolia = require('algoliasearch');
|
||||
const Base = require('./Base.js');
|
||||
|
||||
class ImportScript extends Base {
|
||||
constructor() {
|
||||
super();
|
||||
// Bind class methods
|
||||
this.defaultTransformations = this.defaultTransformations.bind(this);
|
||||
this.suggestions = this.suggestions.bind(this);
|
||||
this.checkMemoryUsage = this.checkMemoryUsage.bind(this);
|
||||
this.handleHighMemoryUsage = this.handleHighMemoryUsage.bind(this);
|
||||
this.handleExtremeMemoryUsage = this.handleExtremeMemoryUsage.bind(this);
|
||||
this.setIndex = this.setIndex.bind(this);
|
||||
this.setTransformations = this.setTransformations.bind(this);
|
||||
this.setCsvOptions = this.setCsvOptions.bind(this);
|
||||
this.conditionallyParseCsv = this.conditionallyParseCsv.bind(this);
|
||||
this.setBatchSize = this.setBatchSize.bind(this);
|
||||
this.estimateBatchSize = this.estimateBatchSize.bind(this);
|
||||
this.updateBatchSize = this.updateBatchSize.bind(this);
|
||||
this.importToAlgolia = this.importToAlgolia.bind(this);
|
||||
this.retryImport = this.retryImport.bind(this);
|
||||
this.indexFiles = this.indexFiles.bind(this);
|
||||
this.start = this.start.bind(this);
|
||||
// Define validation constants
|
||||
this.message =
|
||||
'\nExample: $ algolia import -s sourcefilepath -a algoliaappid -k algoliaapikey -n algoliaindexname -b batchsize -t transformationfilepath -m maxconcurrency -p csvtojsonparams\n\n';
|
||||
this.params = [
|
||||
'sourcefilepath',
|
||||
'algoliaappid',
|
||||
'algoliaapikey',
|
||||
'algoliaindexname',
|
||||
];
|
||||
}
|
||||
|
||||
defaultTransformations(data, cb) {
|
||||
cb(null, data);
|
||||
}
|
||||
|
||||
suggestions() {
|
||||
let output = `\nConsider reducing <batchSize> (currently ${
|
||||
this.batchSize
|
||||
}).`;
|
||||
if (this.maxConcurrency > 1)
|
||||
output += `\nConsider reducing <maxConcurrency> (currently ${
|
||||
this.maxConcurrency
|
||||
}).`;
|
||||
return output;
|
||||
}
|
||||
|
||||
checkMemoryUsage() {
|
||||
// Exit early if high memory usage warning issued too recently
|
||||
if (this.highMemoryUsage) return false;
|
||||
// Get memory usage
|
||||
const { usedMb, percentUsed } = this.getMemoryUsage();
|
||||
// Handle if heap usage exceeds n% of estimated allocation for node process
|
||||
if (percentUsed >= 70) this.handleHighMemoryUsage(percentUsed);
|
||||
if (percentUsed >= 90) this.handleExtremeMemoryUsage(usedMb, percentUsed);
|
||||
return false;
|
||||
}
|
||||
|
||||
handleHighMemoryUsage(percentUsed) {
|
||||
const newBatchSize = Math.floor(this.batchSize / 2);
|
||||
this.updateBatchSize(newBatchSize);
|
||||
this.writeProgress(
|
||||
`High memory usage (${percentUsed}%). Reducing batchSize to ${newBatchSize}`
|
||||
);
|
||||
}
|
||||
|
||||
handleExtremeMemoryUsage(usedMb, percentUsed) {
|
||||
// Issue warning
|
||||
const name = `Warning: High memory usage`;
|
||||
const message = `Memory usage at ${usedMb} MB (${percentUsed}% of heap allocation for this process).`;
|
||||
// Set class instance flag to debounce future warnings
|
||||
this.highMemoryUsage = true;
|
||||
// Output warning
|
||||
console.log(
|
||||
chalk.white.bgRed(`\n${name}`),
|
||||
chalk.red(`\n${message}`),
|
||||
chalk.red(`${this.suggestions()}`)
|
||||
);
|
||||
// Reset flag in 30 seconds
|
||||
setTimeout(() => {
|
||||
this.highMemoryUsage = false;
|
||||
}, 30000);
|
||||
}
|
||||
|
||||
setIndex(options) {
|
||||
// Set Algolia index
|
||||
this.client = algolia(options.appId, options.apiKey);
|
||||
this.index = this.client.initIndex(options.indexName);
|
||||
}
|
||||
|
||||
setTransformations(options) {
|
||||
try {
|
||||
// Set JSON record transformations
|
||||
const transformations = options.transformations
|
||||
? require(this.normalizePath(options.transformations))
|
||||
: null;
|
||||
// Validate transformations function input param
|
||||
const valid = transformations && typeof transformations === 'function';
|
||||
// Assign our transformations function using provided custom transformations file if exists
|
||||
this.formatRecord = valid ? transformations : this.defaultTransformations;
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
setCsvOptions(options) {
|
||||
try {
|
||||
this.csvOptions = options.csvToJsonParams
|
||||
? JSON.parse(options.csvToJsonParams)
|
||||
: null;
|
||||
if (!this.csvOptions) return;
|
||||
const csvToJsonRegexPropertyList = ['includeColumns', 'ignoreColumns'];
|
||||
csvToJsonRegexPropertyList.forEach(prop => {
|
||||
if (this.csvOptions.hasOwnProperty(prop)) {
|
||||
this.csvOptions[prop] = regexParser(this.csvOptions[prop]);
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
conditionallyParseCsv(isCsv) {
|
||||
// Return the appropriate writestream for piping depending on filetype
|
||||
return isCsv
|
||||
? csv(this.csvOptions) // Convert from CSV to JSON
|
||||
: through(); // Do nothing
|
||||
}
|
||||
|
||||
async setBatchSize(options) {
|
||||
try {
|
||||
// If user provided batchSize, use and exit early
|
||||
// Otherwise calculate and set optimal batch size
|
||||
if (options.objectsPerBatch !== null) {
|
||||
this.batchSize = options.objectsPerBatch;
|
||||
return;
|
||||
}
|
||||
// Test files to estimate optimal batch size
|
||||
const estimatedBatchSize = await this.estimateBatchSize();
|
||||
// Test network upload speed
|
||||
const uploadSpeedMb = await this.getNetworkSpeed();
|
||||
// Calculate optimal batch size
|
||||
this.writeProgress('Calculating optimal batch size...');
|
||||
let batchSize;
|
||||
// Reconcile batch size with network speed
|
||||
if (uploadSpeedMb >= this.desiredBatchSizeMb)
|
||||
batchSize = Math.floor(estimatedBatchSize);
|
||||
else
|
||||
batchSize = Math.floor(
|
||||
(uploadSpeedMb / this.desiredBatchSizeMb) * estimatedBatchSize
|
||||
);
|
||||
// Ensure minimum batch size is enforced
|
||||
batchSize = Math.max(this.minBatchSize, batchSize);
|
||||
console.log(chalk.blue(`\nOptimal batch size: ${batchSize}`));
|
||||
// Set batch size
|
||||
this.batchSize = batchSize;
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
estimateBatchSize() {
|
||||
// Read file, estimate average record size, estimate batch size
|
||||
// Return estimated batch size divided by maxConcurrency
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
const filename = this.filenames[0];
|
||||
const file = `${this.directory}/${filename}`;
|
||||
const isCsv = filename.split('.').pop() === 'csv';
|
||||
const fileStream = fs.createReadStream(file, {
|
||||
autoclose: true,
|
||||
flags: 'r',
|
||||
});
|
||||
this.writeProgress(`Estimating data size...`);
|
||||
const jsonStreamOption = isCsv ? null : '*';
|
||||
fileStream
|
||||
.pipe(this.conditionallyParseCsv(isCsv))
|
||||
.pipe(JSONStream.parse(jsonStreamOption))
|
||||
.pipe(transform(this.formatRecord))
|
||||
.pipe(new Batch({ size: 10000 }))
|
||||
.pipe(
|
||||
through(data => {
|
||||
const count = data.length;
|
||||
const string = JSON.stringify(data);
|
||||
const batchSizeMb = this.getStringSizeMb(string);
|
||||
const avgRecordSizeMb = batchSizeMb / count;
|
||||
const avgRecordSizeKb = Math.ceil(avgRecordSizeMb * 1000);
|
||||
const roughBatchSize = this.desiredBatchSizeMb / avgRecordSizeMb;
|
||||
const estimatedBatchSize = Math.floor(
|
||||
roughBatchSize / this.maxConcurrency
|
||||
);
|
||||
console.log(
|
||||
chalk.blue(`\nAverage record size: ${avgRecordSizeKb} Kb`)
|
||||
);
|
||||
fileStream.destroy();
|
||||
resolve(estimatedBatchSize);
|
||||
})
|
||||
);
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
updateBatchSize(newSize) {
|
||||
this.batchSize = newSize;
|
||||
}
|
||||
|
||||
getBatchStream() {
|
||||
return new Batch({ size: this.batchSize });
|
||||
}
|
||||
|
||||
async importToAlgolia(data) {
|
||||
// Method to index batches of records in Algolia
|
||||
try {
|
||||
await this.index.addObjects(data);
|
||||
this.importCount += data.length;
|
||||
this.writeProgress(`Records indexed: ${this.importCount}`);
|
||||
} catch (e) {
|
||||
let message = e.message;
|
||||
let addendum = e.stack;
|
||||
if (e.name === 'AlgoliaSearchRequestTimeoutError') {
|
||||
message = `You may be attempting to import batches too large for the network connection.`;
|
||||
addendum = this.suggestions();
|
||||
this.retryImport(data);
|
||||
}
|
||||
console.log(
|
||||
chalk.white.bgRed(`\nImport error: ${e.name}`),
|
||||
chalk.red(`\n${message}`),
|
||||
chalk.red(addendum)
|
||||
);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
retryImport(data) {
|
||||
// Algolia import retry strategy
|
||||
try {
|
||||
this.retryCount++;
|
||||
console.log(`\n(${this.retryCount}) Retrying batch...`);
|
||||
const importedBatchCount = Math.floor(this.importCount / this.batchSize);
|
||||
const retryLimit =
|
||||
this.retryCount > 15 && this.retryCount > importedBatchCount / 2;
|
||||
if (retryLimit) {
|
||||
console.log(
|
||||
chalk.white.bgRed(`\nError: Failure to index data`),
|
||||
chalk.red(`\nRetry limit reached.`),
|
||||
chalk.red(this.suggestions())
|
||||
);
|
||||
return;
|
||||
}
|
||||
// Split data in half
|
||||
const middle = Math.floor(data.length / 2);
|
||||
const firstHalf = data.splice(0, middle);
|
||||
// Reduce batchsize
|
||||
if (this.batchSize > middle) this.updateBatchSize(middle);
|
||||
// Push each half of data into import queue
|
||||
this.queue.push([firstHalf]);
|
||||
this.queue.push([data]);
|
||||
} catch (e) {
|
||||
console.error('Retry error:', e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
indexFiles(filenames) {
|
||||
// Recursive method that iterates through an array of filenames, opens a read stream for each file
|
||||
// then pipes the read stream through a series of transformations (parse CSV/JSON objects, transform
|
||||
// them, batch them, index them in Algolia) while imposing a queue so that only so many
|
||||
// indexing threads will be run in parallel
|
||||
if (filenames.length <= 0) {
|
||||
console.log('\nDone reading files');
|
||||
return;
|
||||
}
|
||||
// Start new file read stream
|
||||
// Note: filenames is a reference to the mutable class instance variable this.filenames
|
||||
const filename = filenames.pop();
|
||||
const file = `${this.directory}/${filename}`;
|
||||
const isCsv = filename.split('.').pop() === 'csv';
|
||||
const fileStream = fs.createReadStream(file, {
|
||||
autoclose: true,
|
||||
flags: 'r',
|
||||
});
|
||||
|
||||
fileStream.on('data', () => {
|
||||
if (this.queue.length() >= this.maxConcurrency) {
|
||||
// If async upload queue is full, pause reading from file stream
|
||||
fileStream.pause();
|
||||
}
|
||||
});
|
||||
|
||||
fileStream.on('end', () => {
|
||||
// File complete, process next file
|
||||
this.indexFiles(filenames);
|
||||
});
|
||||
|
||||
// Once the async upload queue is drained, resume reading from file stream
|
||||
this.queue.drain = () => {
|
||||
fileStream.resume();
|
||||
};
|
||||
|
||||
// Handle parsing, transforming, batching, and indexing JSON and CSV files
|
||||
console.log(`\nImporting [${filename}]`);
|
||||
const jsonStreamOption = isCsv ? null : '*';
|
||||
fileStream
|
||||
.pipe(this.conditionallyParseCsv(isCsv, filename))
|
||||
.pipe(JSONStream.parse(jsonStreamOption))
|
||||
.pipe(transform(this.formatRecord))
|
||||
.pipe(this.getBatchStream())
|
||||
.pipe(
|
||||
through(data => {
|
||||
this.checkMemoryUsage();
|
||||
this.queue.push([data]);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
async start(program) {
|
||||
// Script reads JSON or CSV file, or directory of such files, optionally applies
|
||||
// transformations, then batches and indexes the data in Algolia.
|
||||
|
||||
// Validate command; if invalid display help text and exit
|
||||
this.validate(program, this.message, this.params);
|
||||
|
||||
// Config params
|
||||
const options = {
|
||||
sourceFilepath: program.sourcefilepath,
|
||||
appId: program.algoliaappid,
|
||||
apiKey: program.algoliaapikey,
|
||||
indexName: program.algoliaindexname,
|
||||
objectsPerBatch: program.batchsize || null,
|
||||
transformations: program.transformationfilepath || null,
|
||||
maxConcurrency: program.maxconcurrency || 2,
|
||||
csvToJsonParams: program.params || null,
|
||||
};
|
||||
// Configure Algolia (this.client, this.index)
|
||||
this.setIndex(options);
|
||||
// Configure source paths (this.directory, this.filenames)
|
||||
this.setSource(options);
|
||||
// Configure transformations (this.formatRecord)
|
||||
this.setTransformations(options);
|
||||
// Configure optional csvtojson params (this.csvOptions)
|
||||
this.setCsvOptions(options);
|
||||
// Configure data upload parameters
|
||||
this.maxConcurrency = options.maxConcurrency;
|
||||
// Theoretically desirable batch size in MB
|
||||
this.desiredBatchSizeMb = 10;
|
||||
// Minimum batch size
|
||||
this.minBatchSize = 100;
|
||||
// Configure number of records to index per batch (this.batchSize, this.batch)
|
||||
await this.setBatchSize(options);
|
||||
// Assign dangerous memory usage flag
|
||||
this.highMemoryUsage = false;
|
||||
// Assign import count
|
||||
this.importCount = 0;
|
||||
// Assign retry count
|
||||
this.retryCount = 0;
|
||||
// Assign async queue
|
||||
this.queue = async.queue(this.importToAlgolia, this.maxConcurrency);
|
||||
|
||||
// Execute import
|
||||
console.log(chalk.bgGreen.white('Starting import...'));
|
||||
return this.indexFiles(this.filenames);
|
||||
}
|
||||
}
|
||||
|
||||
const importScript = new ImportScript();
|
||||
module.exports = importScript;
|
||||
60
themes/keepit/node_modules/@algolia/cli/commands/Interactive.js
generated
vendored
Normal file
60
themes/keepit/node_modules/@algolia/cli/commands/Interactive.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
const inquirer = require('inquirer');
|
||||
|
||||
class Interactive {
|
||||
parseCommandNames(commandList, ownName) {
|
||||
const names = commandList.map(command => command._name);
|
||||
// Remove current command name and default command
|
||||
const commandNames = names.filter(name => name !== ownName && name !== '*');
|
||||
return commandNames;
|
||||
}
|
||||
|
||||
getCommandQuestion(commandNames) {
|
||||
return {
|
||||
type: 'list',
|
||||
name: 'commandChoice',
|
||||
message: 'Select the command to run',
|
||||
choices: commandNames,
|
||||
};
|
||||
}
|
||||
|
||||
getArgumentQuestions(validArguments) {
|
||||
return validArguments.map(argument => ({
|
||||
type: argument.description.includes('key') ? 'password' : 'input',
|
||||
name: argument.long.substring(2),
|
||||
message: `${argument.long} | ${argument.description}`,
|
||||
}));
|
||||
}
|
||||
|
||||
async start(program) {
|
||||
try {
|
||||
const commands = require('../commands.js');
|
||||
const ownName = program._name;
|
||||
const commandList = program.parent.commands;
|
||||
// Get list of valid commands
|
||||
const commandNames = this.parseCommandNames(commandList, ownName);
|
||||
const commandQuestion = this.getCommandQuestion(commandNames);
|
||||
// Prompt user to select a command
|
||||
const commandResponse = await inquirer.prompt(commandQuestion);
|
||||
// Prepare subsequent questions
|
||||
const selectedCommand = commandList.find(
|
||||
command => command._name === commandResponse.commandChoice
|
||||
);
|
||||
const validArguments = selectedCommand.options;
|
||||
const argumentQuestions = this.getArgumentQuestions(validArguments);
|
||||
// Prompt user to input command arguments
|
||||
const argumentsResponse = await inquirer.prompt(argumentQuestions);
|
||||
// Pass arguments to program
|
||||
const argumentsList = Object.keys(argumentsResponse);
|
||||
argumentsList.forEach(arg => {
|
||||
if (argumentsResponse[arg] !== '')
|
||||
program[arg] = argumentsResponse[arg]; // eslint-disable-line no-param-reassign
|
||||
});
|
||||
// Execute selected command
|
||||
commands[selectedCommand._name].start(program);
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = new Interactive();
|
||||
68
themes/keepit/node_modules/@algolia/cli/commands/Search.js
generated
vendored
Normal file
68
themes/keepit/node_modules/@algolia/cli/commands/Search.js
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const algolia = require('algoliasearch');
|
||||
const Base = require('./Base.js');
|
||||
|
||||
class SearchScript extends Base {
|
||||
constructor() {
|
||||
super();
|
||||
// Bind class methods
|
||||
this.start = this.start.bind(this);
|
||||
this.parseSearchOptions = this.parseSearchOptions.bind(this);
|
||||
this.writeOutput = this.writeOutput.bind(this);
|
||||
// Define validation constants
|
||||
this.message =
|
||||
'\nExample: $ algolia search -a algoliaappid -k algoliaapikey -n algoliaindexname -q query -p searchparams -o outputpath\n\n';
|
||||
this.params = ['algoliaappid', 'algoliaapikey', 'algoliaindexname'];
|
||||
}
|
||||
|
||||
parseSearchOptions(params) {
|
||||
return params === null ? {} : JSON.parse(params);
|
||||
}
|
||||
|
||||
async writeOutput(outputFilepath, content) {
|
||||
const defaultFilepath = path.resolve(process.cwd(), 'search-results.json');
|
||||
const filepath = this.normalizePath(outputFilepath);
|
||||
const dir = path.dirname(filepath);
|
||||
if (!fs.lstatSync(dir).isDirectory()) {
|
||||
throw new Error(
|
||||
`Output path must target valid directory. Eg. ${defaultFilepath}`
|
||||
);
|
||||
} else {
|
||||
await fs.writeFileSync(filepath, content);
|
||||
}
|
||||
}
|
||||
|
||||
async start(program) {
|
||||
try {
|
||||
// Validate command; if invalid display help text and exit
|
||||
this.validate(program, this.message, this.params);
|
||||
|
||||
// Config params
|
||||
const appId = program.algoliaappid;
|
||||
const apiKey = program.algoliaapikey;
|
||||
const indexName = program.algoliaindexname;
|
||||
const query = program.query || '';
|
||||
const params = program.params || null;
|
||||
const outputPath = program.outputpath || null;
|
||||
|
||||
// Get options
|
||||
const options = this.parseSearchOptions(params);
|
||||
|
||||
// Instantiate Algolia index
|
||||
const client = algolia(appId, apiKey);
|
||||
const index = client.initIndex(indexName);
|
||||
// Get index settings
|
||||
const result = await index.search(query, options);
|
||||
const output = JSON.stringify(result);
|
||||
return outputPath === null
|
||||
? console.log(output)
|
||||
: await this.writeOutput(outputPath, output);
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const searchScript = new SearchScript();
|
||||
module.exports = searchScript;
|
||||
72
themes/keepit/node_modules/@algolia/cli/commands/SetSettings.js
generated
vendored
Normal file
72
themes/keepit/node_modules/@algolia/cli/commands/SetSettings.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
const fs = require('fs');
|
||||
const algolia = require('algoliasearch');
|
||||
const Base = require('./Base.js');
|
||||
|
||||
class SetSettingsScript extends Base {
|
||||
constructor() {
|
||||
super();
|
||||
// Bind class methods
|
||||
this.getSource = this.getSource.bind(this);
|
||||
this.parseSetSettingsOptions = this.parseSetSettingsOptions.bind(this);
|
||||
this.start = this.start.bind(this);
|
||||
// Define validation constants
|
||||
this.message =
|
||||
'\nExample: $ algolia setsettings -a algoliaappid -k algoliaapikey -n algoliaindexname -s sourcefilepath -p setsettingsparams\n\n';
|
||||
this.params = [
|
||||
'algoliaappid',
|
||||
'algoliaapikey',
|
||||
'algoliaindexname',
|
||||
'sourcefilepath',
|
||||
];
|
||||
}
|
||||
|
||||
getSource(path) {
|
||||
const filepath = this.normalizePath(path);
|
||||
if (!fs.lstatSync(filepath).isFile())
|
||||
throw new Error('Source filepath must target valid settings file.');
|
||||
return filepath;
|
||||
}
|
||||
|
||||
parseSetSettingsOptions(params) {
|
||||
try {
|
||||
const options = { forwardToReplicas: false };
|
||||
if (params === null) return options;
|
||||
else return JSON.parse(params);
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
async start(program) {
|
||||
try {
|
||||
// Validate command; if invalid display help text and exit
|
||||
this.validate(program, this.message, this.params);
|
||||
|
||||
// Config params
|
||||
const appId = program.algoliaappid;
|
||||
const apiKey = program.algoliaapikey;
|
||||
const indexName = program.algoliaindexname;
|
||||
const sourceFilepath = program.sourcefilepath;
|
||||
const params = program.params || null;
|
||||
|
||||
// Get index settings
|
||||
const settingsPath = this.getSource(sourceFilepath);
|
||||
const settingsFile = await fs.readFileSync(settingsPath);
|
||||
const settings = JSON.parse(settingsFile);
|
||||
// Get options
|
||||
const settingsOptions = this.parseSetSettingsOptions(params);
|
||||
|
||||
// Instantiate Algolia index
|
||||
const client = algolia(appId, apiKey);
|
||||
const index = client.initIndex(indexName);
|
||||
// Set index settings
|
||||
const result = await index.setSettings(settings, settingsOptions);
|
||||
return console.log(result);
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const setSettingsScript = new SetSettingsScript();
|
||||
module.exports = setSettingsScript;
|
||||
126
themes/keepit/node_modules/@algolia/cli/commands/TransferIndex.js
generated
vendored
Normal file
126
themes/keepit/node_modules/@algolia/cli/commands/TransferIndex.js
generated
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
const algolia = require('algoliasearch');
|
||||
const Base = require('./Base.js');
|
||||
|
||||
class TransferIndexScript extends Base {
|
||||
constructor() {
|
||||
super();
|
||||
// Bind class methods
|
||||
this.getIndices = this.getIndices.bind(this);
|
||||
this.getTransformations = this.getTransformations.bind(this);
|
||||
this.transferIndexConfig = this.transferIndexConfig.bind(this);
|
||||
this.transferData = this.transferData.bind(this);
|
||||
this.start = this.start.bind(this);
|
||||
// Define validation constants
|
||||
this.message =
|
||||
'\nExample: $ algolia transferindex -a sourcealgoliaappid -k sourcealgoliaapikey -n sourcealgoliaindexname -d destinationalgoliaappid -y destinationalgoliaapikey -i destinationindexname -t transformationfilepath -e true\n\n';
|
||||
this.params = [
|
||||
'sourcealgoliaappid',
|
||||
'sourcealgoliaapikey',
|
||||
'sourcealgoliaindexname',
|
||||
'destinationalgoliaappid',
|
||||
'destinationalgoliaapikey',
|
||||
];
|
||||
}
|
||||
|
||||
getIndices(options) {
|
||||
// Instantiate Algolia indices
|
||||
const sourceClient = algolia(options.sourceAppId, options.sourceApiKey);
|
||||
const sourceIndex = sourceClient.initIndex(options.sourceIndexName);
|
||||
const destinationClient = algolia(
|
||||
options.destinationAppId,
|
||||
options.destinationApiKey
|
||||
);
|
||||
const destinationIndex = destinationClient.initIndex(
|
||||
options.destinationIndexName
|
||||
);
|
||||
|
||||
return { sourceIndex, destinationIndex };
|
||||
}
|
||||
|
||||
getTransformations(options) {
|
||||
// Set JSON record transformations
|
||||
const transformations = options.transformations
|
||||
? require(options.transformations)
|
||||
: null;
|
||||
// Validate transformations function input param
|
||||
const valid = transformations && typeof transformations === 'function';
|
||||
// Return provided transformation function if exists
|
||||
return valid ? transformations : null;
|
||||
}
|
||||
|
||||
async transferIndexConfig(indices, options) {
|
||||
// Transfer settings, synonyms, and query rules
|
||||
const settings = await indices.sourceIndex.getSettings();
|
||||
const synonyms = await indices.sourceIndex.exportSynonyms();
|
||||
const rules = await indices.sourceIndex.exportRules();
|
||||
if (options.excludeReplicas) delete settings.replicas;
|
||||
await indices.destinationIndex.setSettings(settings);
|
||||
await indices.destinationIndex.batchSynonyms(synonyms);
|
||||
await indices.destinationIndex.batchRules(rules);
|
||||
}
|
||||
|
||||
transferData(indices, formatRecord) {
|
||||
return new Promise((resolve, reject) => {
|
||||
// Export index
|
||||
const browse = indices.sourceIndex.browseAll('', {
|
||||
attributesToRetrieve: ['*'],
|
||||
});
|
||||
let hitsCount = 0;
|
||||
// Set browseAll event handlers
|
||||
browse.on('result', async result => {
|
||||
// Push hits to destination index
|
||||
try {
|
||||
const hits = formatRecord
|
||||
? result.hits.map(formatRecord)
|
||||
: result.hits;
|
||||
await indices.destinationIndex.addObjects(hits);
|
||||
hitsCount += result.hits.length;
|
||||
this.writeProgress(`Records transferred: ${hitsCount}`);
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
browse.on('end', () => resolve('\nDone transferring index.\n'));
|
||||
browse.on('error', err => reject(err));
|
||||
});
|
||||
}
|
||||
|
||||
async start(program) {
|
||||
try {
|
||||
// Validate command; if invalid display help text and exit
|
||||
this.validate(program, this.message, this.params);
|
||||
|
||||
// Config params
|
||||
const options = {
|
||||
sourceAppId: program.sourcealgoliaappid,
|
||||
sourceApiKey: program.sourcealgoliaapikey,
|
||||
sourceIndexName: program.sourcealgoliaindexname,
|
||||
destinationAppId: program.destinationalgoliaappid,
|
||||
destinationApiKey: program.destinationalgoliaapikey,
|
||||
destinationIndexName:
|
||||
program.destinationindexname || program.sourcealgoliaindexname,
|
||||
transformations: program.transformationfilepath || null,
|
||||
excludeReplicas:
|
||||
program.excludereplicas !== undefined
|
||||
? program.excludereplicas === 'true'
|
||||
: false,
|
||||
};
|
||||
|
||||
// Configure Algolia clients/indices
|
||||
const indices = this.getIndices(options);
|
||||
// Configure transformations
|
||||
const formatRecord = this.getTransformations(options);
|
||||
// Transfer index configuration
|
||||
await this.transferIndexConfig(indices, options);
|
||||
// Transfer data
|
||||
const result = await this.transferData(indices, formatRecord);
|
||||
|
||||
return console.log(result);
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const transferIndexScript = new TransferIndexScript();
|
||||
module.exports = transferIndexScript;
|
||||
108
themes/keepit/node_modules/@algolia/cli/commands/TransferIndexConfig.js
generated
vendored
Normal file
108
themes/keepit/node_modules/@algolia/cli/commands/TransferIndexConfig.js
generated
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
const algolia = require('algoliasearch');
|
||||
const Base = require('./Base.js');
|
||||
|
||||
class TransferIndexConfigScript extends Base {
|
||||
constructor() {
|
||||
super();
|
||||
// Bind class methods
|
||||
this.start = this.start.bind(this);
|
||||
this.getIndices = this.getIndices.bind(this);
|
||||
this.getConfigOptions = this.getConfigOptions.bind(this);
|
||||
this.transferIndexConfig = this.transferIndexConfig.bind(this);
|
||||
// Define validation constants
|
||||
this.message =
|
||||
'\nExample: $ algolia transferindexconfig -a sourcealgoliaappid -k sourcealgoliaapikey -n sourcealgoliaindexname -d destinationalgoliaappid -y destinationalgoliaapikey -i destinationindexname -p configParams -e true\n\n';
|
||||
this.params = [
|
||||
'sourcealgoliaappid',
|
||||
'sourcealgoliaapikey',
|
||||
'sourcealgoliaindexname',
|
||||
'destinationalgoliaappid',
|
||||
'destinationalgoliaapikey',
|
||||
];
|
||||
}
|
||||
|
||||
getIndices(options) {
|
||||
// Instantiate Algolia indices
|
||||
const sourceClient = algolia(options.sourceAppId, options.sourceApiKey);
|
||||
const sourceIndex = sourceClient.initIndex(options.sourceIndexName);
|
||||
const destinationClient = algolia(
|
||||
options.destinationAppId,
|
||||
options.destinationApiKey
|
||||
);
|
||||
const destinationIndex = destinationClient.initIndex(
|
||||
options.destinationIndexName
|
||||
);
|
||||
|
||||
return { sourceIndex, destinationIndex };
|
||||
}
|
||||
|
||||
getConfigOptions(options) {
|
||||
// Default config
|
||||
const config = {
|
||||
sOptions: {},
|
||||
rOptions: {},
|
||||
};
|
||||
// No params provided, exit early
|
||||
if (!options.configParams) return config;
|
||||
|
||||
const params = JSON.parse(options.configParams);
|
||||
|
||||
// Set provided batchSynonyms and batchRules options
|
||||
if (params.batchSynonymsParams)
|
||||
config.sOptions = Object.assign({}, params.batchSynonymsParams);
|
||||
if (params.batchRulesParams)
|
||||
config.rOptions = Object.assign({}, params.batchRulesParams);
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
async transferIndexConfig(indices, config, options) {
|
||||
// Transfer settings, synonyms, and query rules
|
||||
const settings = await indices.sourceIndex.getSettings();
|
||||
const synonyms = await indices.sourceIndex.exportSynonyms();
|
||||
const rules = await indices.sourceIndex.exportRules();
|
||||
if (options.excludeReplicas) delete settings.replicas;
|
||||
await indices.destinationIndex.setSettings(settings);
|
||||
await indices.destinationIndex.batchSynonyms(synonyms, config.sOptions);
|
||||
await indices.destinationIndex.batchRules(rules, config.rOptions);
|
||||
}
|
||||
|
||||
async start(program) {
|
||||
try {
|
||||
// Validate command; if invalid display help text and exit
|
||||
this.validate(program, this.message, this.params);
|
||||
|
||||
// Config params
|
||||
const options = {
|
||||
sourceAppId: program.sourcealgoliaappid,
|
||||
sourceApiKey: program.sourcealgoliaapikey,
|
||||
sourceIndexName: program.sourcealgoliaindexname,
|
||||
destinationAppId: program.destinationalgoliaappid,
|
||||
destinationApiKey: program.destinationalgoliaapikey,
|
||||
destinationIndexName:
|
||||
program.destinationindexname || program.sourcealgoliaindexname,
|
||||
configParams: program.params || null,
|
||||
excludeReplicas:
|
||||
program.excludereplicas !== undefined
|
||||
? program.excludereplicas === 'true'
|
||||
: false,
|
||||
};
|
||||
|
||||
// Configure Algolia clients/indices
|
||||
const indices = this.getIndices(options);
|
||||
// Configure batchSynonyms and batchRules options
|
||||
const config = this.getConfigOptions(options);
|
||||
// Transfer index configuration
|
||||
await this.transferIndexConfig(indices, config, options);
|
||||
|
||||
return console.log(
|
||||
'Index settings, synonyms, and query rules transferred successfully.'
|
||||
);
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const transferIndexConfigScript = new TransferIndexConfigScript();
|
||||
module.exports = transferIndexConfigScript;
|
||||
136
themes/keepit/node_modules/@algolia/cli/commands/TransformLines.js
generated
vendored
Normal file
136
themes/keepit/node_modules/@algolia/cli/commands/TransformLines.js
generated
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
const fs = require('fs');
|
||||
const readLine = require('readline');
|
||||
const Base = require('./Base.js');
|
||||
|
||||
class TransformLinesScript extends Base {
|
||||
constructor() {
|
||||
super();
|
||||
// Bind class methods
|
||||
this.defaultLineTransformation = this.defaultLineTransformation.bind(this);
|
||||
this.setOutput = this.setOutput.bind(this);
|
||||
this.setTransformations = this.setTransformations.bind(this);
|
||||
this.transformFile = this.transformFile.bind(this);
|
||||
this.init = this.init.bind(this);
|
||||
this.start = this.start.bind(this);
|
||||
// Define validation constants
|
||||
this.message =
|
||||
'\nExample: $ algolia transformlines -s sourcefilepath -o outputpath -t transformationfilepath \n\n';
|
||||
this.params = ['sourcefilepath'];
|
||||
}
|
||||
|
||||
defaultLineTransformation(line) {
|
||||
// Default line transformation method
|
||||
/* eslint-disable no-control-regex */
|
||||
const newLine = line.match(/\u001e/, 'i')
|
||||
? line.replace(/\u001e/, ',')
|
||||
: line;
|
||||
return newLine;
|
||||
/* eslint-enable no-control-regex */
|
||||
}
|
||||
|
||||
setOutput(outputPath) {
|
||||
this.outputDir =
|
||||
outputPath !== null ? this.normalizePath(outputPath) : process.cwd();
|
||||
|
||||
// Ensure outputpath is a directory
|
||||
if (!fs.lstatSync(this.outputDir).isDirectory())
|
||||
throw new Error('Output path must be a directory.');
|
||||
}
|
||||
|
||||
setTransformations(transformationFilepath) {
|
||||
try {
|
||||
// Set JSON record transformations
|
||||
const transformations = transformationFilepath
|
||||
? require(this.normalizePath(transformationFilepath))
|
||||
: null;
|
||||
// Validate transformations function input param
|
||||
const valid = transformations && typeof transformations === 'function';
|
||||
// Assign our transformations function using provided custom transformations file if exists
|
||||
this.lineTransformation = valid
|
||||
? transformations
|
||||
: this.defaultLineTransformation;
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
// Method to transform an individual file line-by-line
|
||||
transformFile(filename) {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
const writeStream = fs.createWriteStream(
|
||||
`${this.outputDir}/${filename}`
|
||||
);
|
||||
let count = 0;
|
||||
|
||||
if (this.transformationFilepath === null) {
|
||||
writeStream.write('['); // Comment this out to prevent injecting opening bracket at start of new output file
|
||||
}
|
||||
|
||||
const lineReader = readLine.createInterface({
|
||||
input: fs.createReadStream(`${this.directory}/${filename}`),
|
||||
});
|
||||
|
||||
lineReader.on('line', line => {
|
||||
count++;
|
||||
const newLine = this.lineTransformation(line);
|
||||
this.writeProgress(`Line ${count}...`);
|
||||
writeStream.write(newLine);
|
||||
});
|
||||
|
||||
lineReader.on('close', () => {
|
||||
console.log('Done writing!');
|
||||
if (this.transformationFilepath === null) {
|
||||
writeStream.write(']'); // Comment this out to prevent injecting closing bracket at end of new output file
|
||||
}
|
||||
writeStream.end();
|
||||
resolve(true);
|
||||
});
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Start script
|
||||
async init(filenames) {
|
||||
for (const filename of filenames) {
|
||||
try {
|
||||
console.log(`Reading: ${this.directory}/${filename}`);
|
||||
console.log(`Writing to: ${this.outputDir}/${filename}`);
|
||||
await this.transformFile(filename);
|
||||
} catch (e) {
|
||||
console.log(`Error while processing ${filename}`);
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
start(program) {
|
||||
// Script reads a file or directory of files synchronously, line-by-line.
|
||||
// Writes each file synchronously, line-by-line, to an output directory
|
||||
// while optionally applying a provided transformation function to each line.
|
||||
|
||||
// Validate command; if invalid display help text and exit
|
||||
this.validate(program, this.message, this.params);
|
||||
|
||||
// Config params
|
||||
this.sourceFilepath = program.sourcefilepath;
|
||||
this.outputpath = program.outputpath || null;
|
||||
this.transformationFilepath = program.transformationfilepath || null;
|
||||
|
||||
// Configure source paths (this.directory, this.filenames)
|
||||
this.setSource({ sourceFilepath: this.sourceFilepath });
|
||||
// Configure output path (this.outputDir)
|
||||
this.setOutput(this.outputpath);
|
||||
// Configure transformations (this.lineTransformation)
|
||||
this.setTransformations(this.transformationFilepath);
|
||||
|
||||
// Execute line transformations
|
||||
this.init(this.filenames);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const transformLinesScript = new TransformLinesScript();
|
||||
module.exports = transformLinesScript;
|
||||
373
themes/keepit/node_modules/@algolia/cli/index.js
generated
vendored
Executable file
373
themes/keepit/node_modules/@algolia/cli/index.js
generated
vendored
Executable file
@@ -0,0 +1,373 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const program = require('commander');
|
||||
const { version } = require('./package.json');
|
||||
const chalk = require('chalk');
|
||||
const commands = require('./commands.js');
|
||||
|
||||
// DOCS
|
||||
|
||||
const examples = `
|
||||
Examples:
|
||||
|
||||
$ algolia --help
|
||||
$ algolia --version
|
||||
$ algolia interactive
|
||||
$ algolia search -a EXAMPLE_APP_ID -k EXAMPLE_API_KEY -n EXAMPLE_INDEX_NAME -q 'example query' -p '{"filters":["category:book"]}' -o ~/Desktop/results.json
|
||||
$ algolia import -s ~/Desktop/example_data.json -a EXAMPLE_APP_ID -k EXAMPLE_API_KEY -n EXAMPLE_INDEX_NAME -b 5000 -t ~/Desktop/example_transformations.js -m 4 -p '{"delimiter":[":"]}'
|
||||
$ algolia export -a EXAMPLE_APP_ID -k EXAMPLE_API_KEY -n EXAMPLE_INDEX_NAME -o ~/Desktop/output_folder/ -p '{"filters":["category:book"]}'
|
||||
$ algolia getsettings -a EXAMPLE_APP_ID -k EXAMPLE_API_KEY -n EXAMPLE_INDEX_NAME
|
||||
$ algolia setsettings -a EXAMPLE_APP_ID -k EXAMPLE_API_KEY -n EXAMPLE_INDEX_NAME -s ~/Desktop/example_settings.js -p '{"forwardToReplicas":true}'
|
||||
$ algolia addrules -a EXAMPLE_APP_ID -k EXAMPLE_API_KEY -n EXAMPLE_INDEX_NAME -s ~/Desktop/example_rules.json
|
||||
$ algolia addsynonyms -a EXAMPLE_APP_ID -k EXAMPLE_API_KEY -n EXAMPLE_INDEX_NAME -s ~/Desktop/example_synonyms.csv
|
||||
$ algolia exportrules -a EXAMPLE_APP_ID -k EXAMPLE_API_KEY -n EXAMPLE_INDEX_NAME -o ~/Desktop/output_file.json
|
||||
$ algolia exportsynonyms -a EXAMPLE_APP_ID -k EXAMPLE_API_KEY -n EXAMPLE_INDEX_NAME -o ~/Desktop/output_file.json
|
||||
$ algolia transferindex -a EXAMPLE_SOURCE_APP_ID -k EXAMPLE_SOURCE_API_KEY -n EXAMPLE_SOURCE_INDEX_NAME -d EXAMPLE_DESTINATION_APP_ID -y EXAMPLE_DESTINATION_API_KEY -i EXAMPLE_DESTINATION_INDEX_NAME -t ~/Desktop/example_transformations.js -e true
|
||||
$ algolia transferindexconfig -a EXAMPLE_SOURCE_APP_ID -k EXAMPLE_SOURCE_API_KEY -n EXAMPLE_SOURCE_INDEX_NAME -d EXAMPLE_DESTINATION_APP_ID -y EXAMPLE_DESTINATION_API_KEY -i EXAMPLE_DESTINATION_INDEX_NAME -p '{"batchSynonymsParams":{"forwardToReplicas":true}}' -e true
|
||||
$ algolia deleteindicespattern -a EXAMPLE_APP_ID -k EXAMPLE_API_KEY -r '^regex' -x true
|
||||
$ algolia transformlines -s ~/Desktop/example_source.json -o ~/Desktop/example_output.json -t ~/Desktop/example_transformations.js
|
||||
$ algolia examples
|
||||
`;
|
||||
|
||||
// HELPERS
|
||||
|
||||
const registerDefaultProcessEventListeners = () => {
|
||||
// Handle process cancellation
|
||||
process.on('SIGINT', () => {
|
||||
console.log(chalk.white.bgYellow('\nCancelled'));
|
||||
process.exit(1);
|
||||
});
|
||||
// Handle uncaught exceptions
|
||||
process.on('uncaughtException', e => {
|
||||
process.exitCode = 1;
|
||||
console.log(chalk.white.bgRed('\nUncaught Exception'), chalk.red(`\n${e}`));
|
||||
});
|
||||
};
|
||||
|
||||
const defaultCommand = command => {
|
||||
console.error(`Unknown command "${command}".`);
|
||||
console.error('Run "algolia --help" to view options.');
|
||||
process.exit(1);
|
||||
};
|
||||
|
||||
// COMMANDS
|
||||
|
||||
program.version(version, '-v, --version');
|
||||
|
||||
// Search
|
||||
program
|
||||
.command('search')
|
||||
.alias('s')
|
||||
.description('Search an Algolia index')
|
||||
.option('-a, --algoliaappid <algoliaAppId>', 'Required | Algolia app ID')
|
||||
.option('-k, --algoliaapikey <algoliaApiKey>', 'Required | Algolia API key')
|
||||
.option(
|
||||
'-n, --algoliaindexname <algoliaIndexName>',
|
||||
'Required | Algolia index name'
|
||||
)
|
||||
.option('-q, --query <query>', 'Optional | Algolia search query string')
|
||||
.option('-p, --params <params>', 'Optional | Algolia search params')
|
||||
.option('-o, --outputpath <outputPath>', 'Optional | Output filepath')
|
||||
.action(cmd => {
|
||||
commands.search.start(cmd);
|
||||
});
|
||||
|
||||
// Import
|
||||
program
|
||||
.command('import')
|
||||
.alias('i')
|
||||
.description('Import local JSON or CSV data to an Algolia index')
|
||||
.option('-s, --sourcefilepath <sourceFilepath>', 'Required | Source filepath')
|
||||
.option('-a, --algoliaappid <algoliaAppId>', 'Required | Algolia app ID')
|
||||
.option('-k, --algoliaapikey <algoliaApiKey>', 'Required | Algolia API key')
|
||||
.option(
|
||||
'-n, --algoliaindexname <algoliaIndexName>',
|
||||
'Required | Algolia index name'
|
||||
)
|
||||
.option(
|
||||
'-b, --batchsize <batchSize>',
|
||||
'Optional | Number of objects to import per batch'
|
||||
)
|
||||
.option(
|
||||
'-t, --transformationfilepath <transformationFilepath>',
|
||||
'Optional | Transformation filepath'
|
||||
)
|
||||
.option(
|
||||
'-m, --maxconcurrency <maxConcurrency>',
|
||||
'Optional | Maximum number of concurrent filestreams to process'
|
||||
)
|
||||
.option('-p, --params <params>', 'Optional | CsvToJson params')
|
||||
.action(cmd => {
|
||||
commands.import.start(cmd);
|
||||
});
|
||||
|
||||
// Export
|
||||
program
|
||||
.command('export')
|
||||
.alias('e')
|
||||
.description('Export the contents of an Algolia index to local JSON files')
|
||||
.option('-a, --algoliaappid <algoliaAppId>', 'Required | Algolia app ID')
|
||||
.option('-k, --algoliaapikey <algoliaApiKey>', 'Required | Algolia API key')
|
||||
.option(
|
||||
'-n, --algoliaindexname <algoliaIndexName>',
|
||||
'Required | Algolia index name'
|
||||
)
|
||||
.option('-o, --outputpath <outputPath>', 'Optional | Output filepath')
|
||||
.option('-p, --params <params>', 'Optional | Algolia browseAll params')
|
||||
.action(cmd => {
|
||||
commands.export.start(cmd);
|
||||
});
|
||||
|
||||
// Get Settings
|
||||
program
|
||||
.command('getsettings')
|
||||
.alias('gs')
|
||||
.description('Get the settings of an Algolia index as JSON')
|
||||
.option('-a, --algoliaappid <algoliaAppId>', 'Required | Algolia app ID')
|
||||
.option('-k, --algoliaapikey <algoliaApiKey>', 'Required | Algolia API key')
|
||||
.option(
|
||||
'-n, --algoliaindexname <algoliaIndexName>',
|
||||
'Required | Algolia index name'
|
||||
)
|
||||
.action(cmd => {
|
||||
commands.getsettings.start(cmd);
|
||||
});
|
||||
|
||||
// Set Settings
|
||||
program
|
||||
.command('setsettings')
|
||||
.alias('ss')
|
||||
.description('Set the settings of an Algolia index from a JSON file')
|
||||
.option('-a, --algoliaappid <algoliaAppId>', 'Required | Algolia app ID')
|
||||
.option('-k, --algoliaapikey <algoliaApiKey>', 'Required | Algolia API key')
|
||||
.option(
|
||||
'-n, --algoliaindexname <algoliaIndexName>',
|
||||
'Required | Algolia index name'
|
||||
)
|
||||
.option('-s, --sourcefilepath <sourceFilepath>', 'Required | Source filepath')
|
||||
.option('-p, --params <params>', 'Optional | Algolia setSettings params')
|
||||
.action(cmd => {
|
||||
commands.setsettings.start(cmd);
|
||||
});
|
||||
|
||||
// Add Rules
|
||||
program
|
||||
.command('addrules')
|
||||
.alias('ar')
|
||||
.description('Add query rules to an Algolia index from a JSON file')
|
||||
.option('-a, --algoliaappid <algoliaAppId>', 'Required | Algolia app ID')
|
||||
.option('-k, --algoliaapikey <algoliaApiKey>', 'Required | Algolia API key')
|
||||
.option(
|
||||
'-n, --algoliaindexname <algoliaIndexName>',
|
||||
'Required | Algolia index name'
|
||||
)
|
||||
.option('-s, --sourcefilepath <sourceFilepath>', 'Required | Source filepath')
|
||||
.option('-p, --params <params>', 'Optional | Algolia batchRules params')
|
||||
.action(cmd => {
|
||||
commands.addrules.start(cmd);
|
||||
});
|
||||
|
||||
// Add Synonyms
|
||||
program
|
||||
.command('addsynonyms')
|
||||
.alias('as')
|
||||
.description('Add synonyms to an Algolia index from a CSV or JSON file')
|
||||
.option('-a, --algoliaappid <algoliaAppId>', 'Required | Algolia app ID')
|
||||
.option('-k, --algoliaapikey <algoliaApiKey>', 'Required | Algolia API key')
|
||||
.option(
|
||||
'-n, --algoliaindexname <algoliaIndexName>',
|
||||
'Required | Algolia index name'
|
||||
)
|
||||
.option('-s, --sourcefilepath <sourceFilepath>', 'Required | Source filepath')
|
||||
.option('-p, --params <params>', 'Optional | Algolia batchSynonyms params')
|
||||
.action(cmd => {
|
||||
commands.addsynonyms.start(cmd);
|
||||
});
|
||||
|
||||
// Export Rules
|
||||
program
|
||||
.command('exportrules')
|
||||
.alias('er')
|
||||
.description('Export the query rules of an Algolia index to local JSON file')
|
||||
.option('-a, --algoliaappid <algoliaAppId>', 'Required | Algolia app ID')
|
||||
.option('-k, --algoliaapikey <algoliaApiKey>', 'Required | Algolia API key')
|
||||
.option(
|
||||
'-n, --algoliaindexname <algoliaIndexName>',
|
||||
'Required | Algolia index name'
|
||||
)
|
||||
.option('-o, --outputpath <outputPath>', 'Optional | Output filepath')
|
||||
.action(cmd => {
|
||||
commands.exportrules.start(cmd);
|
||||
});
|
||||
|
||||
// Export Synonyms
|
||||
program
|
||||
.command('exportsynonyms')
|
||||
.alias('es')
|
||||
.description('Export the synonyms of an Algolia index to local JSON file')
|
||||
.option('-a, --algoliaappid <algoliaAppId>', 'Required | Algolia app ID')
|
||||
.option('-k, --algoliaapikey <algoliaApiKey>', 'Required | Algolia API key')
|
||||
.option(
|
||||
'-n, --algoliaindexname <algoliaIndexName>',
|
||||
'Required | Algolia index name'
|
||||
)
|
||||
.option('-o, --outputpath <outputPath>', 'Optional | Output filepath')
|
||||
.action(cmd => {
|
||||
commands.exportsynonyms.start(cmd);
|
||||
});
|
||||
|
||||
// Transfer Index
|
||||
program
|
||||
.command('transferindex')
|
||||
.alias('ti')
|
||||
.description(
|
||||
'Duplicate the data and settings of an index from one Algolia App to another'
|
||||
)
|
||||
.option(
|
||||
'-a, --sourcealgoliaappid <algoliaAppId>',
|
||||
'Required | Algolia app ID'
|
||||
)
|
||||
.option(
|
||||
'-k, --sourcealgoliaapikey <algoliaApiKey>',
|
||||
'Required | Algolia API key'
|
||||
)
|
||||
.option(
|
||||
'-n, --sourcealgoliaindexname <algoliaIndexName>',
|
||||
'Required | Algolia index name'
|
||||
)
|
||||
.option(
|
||||
'-d, --destinationalgoliaappid <algoliaAppId>',
|
||||
'Required | Algolia app ID'
|
||||
)
|
||||
.option(
|
||||
'-y, --destinationalgoliaapikey <algoliaApiKey>',
|
||||
'Required | Algolia API key'
|
||||
)
|
||||
.option(
|
||||
'-i, --destinationindexname <algoliaIndexName>',
|
||||
'Optional | Algolia index name'
|
||||
)
|
||||
.option(
|
||||
'-t, --transformationfilepath <transformationFilepath>',
|
||||
'Optional | Transformation filepath'
|
||||
)
|
||||
.option(
|
||||
'-e, --excludereplicas <boolean>',
|
||||
'Optional | Exclude replicas property of settings object'
|
||||
)
|
||||
.action(cmd => {
|
||||
commands.transferindex.start(cmd);
|
||||
});
|
||||
|
||||
// Transfer Index Config
|
||||
program
|
||||
.command('transferindexconfig')
|
||||
.alias('tig')
|
||||
.description(
|
||||
'Duplicate the settings, synonyms, and query rules of an index from one Algolia App to another'
|
||||
)
|
||||
.option(
|
||||
'-a, --sourcealgoliaappid <algoliaAppId>',
|
||||
'Required | Algolia app ID'
|
||||
)
|
||||
.option(
|
||||
'-k, --sourcealgoliaapikey <algoliaApiKey>',
|
||||
'Required | Algolia API key'
|
||||
)
|
||||
.option(
|
||||
'-n, --sourcealgoliaindexname <algoliaIndexName>',
|
||||
'Required | Algolia index name'
|
||||
)
|
||||
.option(
|
||||
'-d, --destinationalgoliaappid <algoliaAppId>',
|
||||
'Required | Algolia app ID'
|
||||
)
|
||||
.option(
|
||||
'-y, --destinationalgoliaapikey <algoliaApiKey>',
|
||||
'Required | Algolia API key'
|
||||
)
|
||||
.option(
|
||||
'-i, --destinationindexname <algoliaIndexName>',
|
||||
'Optional | Algolia index name'
|
||||
)
|
||||
.option(
|
||||
'-p, --params <params>',
|
||||
'Optional | Algolia batchSynonyms and batchRules params'
|
||||
)
|
||||
.option(
|
||||
'-e, --excludereplicas <boolean>',
|
||||
'Optional | Exclude replicas property of settings object'
|
||||
)
|
||||
.action(cmd => {
|
||||
commands.transferindexconfig.start(cmd);
|
||||
});
|
||||
|
||||
// Delete Indices
|
||||
|
||||
program
|
||||
.command('deleteindicespattern')
|
||||
.alias('dip')
|
||||
.description('Delete multiple indices using a regular expression')
|
||||
.option('-a, --algoliaappid <algoliaAppId>', 'Required | Algolia app ID')
|
||||
.option('-k, --algoliaapikey <algoliaApiKey>', 'Required | Algolia API key')
|
||||
.option('-r, --regexp <regexp>', 'Required | Regexp to use for filtering')
|
||||
.option(
|
||||
'-x, --dryrun <boolean>',
|
||||
'Required | Dry run, will only output what would be done'
|
||||
)
|
||||
.action(cmd => {
|
||||
commands.deleteindicespattern.start(cmd);
|
||||
});
|
||||
|
||||
// Transform Lines
|
||||
program
|
||||
.command('transformlines')
|
||||
.alias('tl')
|
||||
.description(
|
||||
'Apply a custom transformation to each line of a file saving output lines to a new file'
|
||||
)
|
||||
.option('-s, --sourcefilepath <sourceFilepath>', 'Required | Source filepath')
|
||||
.option('-o, --outputpath <outputPath>', 'Optional | Output filepath')
|
||||
.option(
|
||||
'-t, --transformationfilepath <transformationFilepath>',
|
||||
'Optional | Transformation filepath'
|
||||
)
|
||||
.action(cmd => {
|
||||
commands.transformlines.start(cmd);
|
||||
});
|
||||
|
||||
// Interactive command
|
||||
program
|
||||
.command('interactive')
|
||||
.alias('shell')
|
||||
.description('Run in an interactive mode')
|
||||
.action(cmd => {
|
||||
commands.interactive.start(cmd);
|
||||
});
|
||||
|
||||
// Display command examples
|
||||
program
|
||||
.command('examples')
|
||||
.alias('ex')
|
||||
.description('View command examples')
|
||||
.action(() => {
|
||||
console.log(examples);
|
||||
});
|
||||
|
||||
// Default Command
|
||||
program
|
||||
.command('*')
|
||||
.alias('default')
|
||||
.description('Default command if none input')
|
||||
.action(cmd => {
|
||||
defaultCommand(cmd);
|
||||
});
|
||||
|
||||
// LOGIC
|
||||
|
||||
// Process command
|
||||
program.parse(process.argv);
|
||||
// Register node process event listeners
|
||||
registerDefaultProcessEventListeners();
|
||||
// Handle no-command case
|
||||
if (program.args.length === 0) program.help();
|
||||
419
themes/keepit/node_modules/@algolia/cli/node_modules/commander/CHANGELOG.md
generated
vendored
Normal file
419
themes/keepit/node_modules/@algolia/cli/node_modules/commander/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,419 @@
|
||||
2.20.3 / 2019-10-11
|
||||
==================
|
||||
|
||||
* Support Node.js 0.10 (Revert #1059)
|
||||
* Ran "npm unpublish commander@2.20.2". There is no 2.20.2.
|
||||
|
||||
2.20.1 / 2019-09-29
|
||||
==================
|
||||
|
||||
* Improve executable subcommand tracking
|
||||
* Update dev dependencies
|
||||
|
||||
2.20.0 / 2019-04-02
|
||||
==================
|
||||
|
||||
* fix: resolve symbolic links completely when hunting for subcommands (#935)
|
||||
* Update index.d.ts (#930)
|
||||
* Update Readme.md (#924)
|
||||
* Remove --save option as it isn't required anymore (#918)
|
||||
* Add link to the license file (#900)
|
||||
* Added example of receiving args from options (#858)
|
||||
* Added missing semicolon (#882)
|
||||
* Add extension to .eslintrc (#876)
|
||||
|
||||
2.19.0 / 2018-10-02
|
||||
==================
|
||||
|
||||
* Removed newline after Options and Commands headers (#864)
|
||||
* Bugfix - Error output (#862)
|
||||
* Fix to change default value to string (#856)
|
||||
|
||||
2.18.0 / 2018-09-07
|
||||
==================
|
||||
|
||||
* Standardize help output (#853)
|
||||
* chmod 644 travis.yml (#851)
|
||||
* add support for execute typescript subcommand via ts-node (#849)
|
||||
|
||||
2.17.1 / 2018-08-07
|
||||
==================
|
||||
|
||||
* Fix bug in command emit (#844)
|
||||
|
||||
2.17.0 / 2018-08-03
|
||||
==================
|
||||
|
||||
* fixed newline output after help information (#833)
|
||||
* Fix to emit the action even without command (#778)
|
||||
* npm update (#823)
|
||||
|
||||
2.16.0 / 2018-06-29
|
||||
==================
|
||||
|
||||
* Remove Makefile and `test/run` (#821)
|
||||
* Make 'npm test' run on Windows (#820)
|
||||
* Add badge to display install size (#807)
|
||||
* chore: cache node_modules (#814)
|
||||
* chore: remove Node.js 4 (EOL), add Node.js 10 (#813)
|
||||
* fixed typo in readme (#812)
|
||||
* Fix types (#804)
|
||||
* Update eslint to resolve vulnerabilities in lodash (#799)
|
||||
* updated readme with custom event listeners. (#791)
|
||||
* fix tests (#794)
|
||||
|
||||
2.15.0 / 2018-03-07
|
||||
==================
|
||||
|
||||
* Update downloads badge to point to graph of downloads over time instead of duplicating link to npm
|
||||
* Arguments description
|
||||
|
||||
2.14.1 / 2018-02-07
|
||||
==================
|
||||
|
||||
* Fix typing of help function
|
||||
|
||||
2.14.0 / 2018-02-05
|
||||
==================
|
||||
|
||||
* only register the option:version event once
|
||||
* Fixes issue #727: Passing empty string for option on command is set to undefined
|
||||
* enable eqeqeq rule
|
||||
* resolves #754 add linter configuration to project
|
||||
* resolves #560 respect custom name for version option
|
||||
* document how to override the version flag
|
||||
* document using options per command
|
||||
|
||||
2.13.0 / 2018-01-09
|
||||
==================
|
||||
|
||||
* Do not print default for --no-
|
||||
* remove trailing spaces in command help
|
||||
* Update CI's Node.js to LTS and latest version
|
||||
* typedefs: Command and Option types added to commander namespace
|
||||
|
||||
2.12.2 / 2017-11-28
|
||||
==================
|
||||
|
||||
* fix: typings are not shipped
|
||||
|
||||
2.12.1 / 2017-11-23
|
||||
==================
|
||||
|
||||
* Move @types/node to dev dependency
|
||||
|
||||
2.12.0 / 2017-11-22
|
||||
==================
|
||||
|
||||
* add attributeName() method to Option objects
|
||||
* Documentation updated for options with --no prefix
|
||||
* typings: `outputHelp` takes a string as the first parameter
|
||||
* typings: use overloads
|
||||
* feat(typings): update to match js api
|
||||
* Print default value in option help
|
||||
* Fix translation error
|
||||
* Fail when using same command and alias (#491)
|
||||
* feat(typings): add help callback
|
||||
* fix bug when description is add after command with options (#662)
|
||||
* Format js code
|
||||
* Rename History.md to CHANGELOG.md (#668)
|
||||
* feat(typings): add typings to support TypeScript (#646)
|
||||
* use current node
|
||||
|
||||
2.11.0 / 2017-07-03
|
||||
==================
|
||||
|
||||
* Fix help section order and padding (#652)
|
||||
* feature: support for signals to subcommands (#632)
|
||||
* Fixed #37, --help should not display first (#447)
|
||||
* Fix translation errors. (#570)
|
||||
* Add package-lock.json
|
||||
* Remove engines
|
||||
* Upgrade package version
|
||||
* Prefix events to prevent conflicts between commands and options (#494)
|
||||
* Removing dependency on graceful-readlink
|
||||
* Support setting name in #name function and make it chainable
|
||||
* Add .vscode directory to .gitignore (Visual Studio Code metadata)
|
||||
* Updated link to ruby commander in readme files
|
||||
|
||||
2.10.0 / 2017-06-19
|
||||
==================
|
||||
|
||||
* Update .travis.yml. drop support for older node.js versions.
|
||||
* Fix require arguments in README.md
|
||||
* On SemVer you do not start from 0.0.1
|
||||
* Add missing semi colon in readme
|
||||
* Add save param to npm install
|
||||
* node v6 travis test
|
||||
* Update Readme_zh-CN.md
|
||||
* Allow literal '--' to be passed-through as an argument
|
||||
* Test subcommand alias help
|
||||
* link build badge to master branch
|
||||
* Support the alias of Git style sub-command
|
||||
* added keyword commander for better search result on npm
|
||||
* Fix Sub-Subcommands
|
||||
* test node.js stable
|
||||
* Fixes TypeError when a command has an option called `--description`
|
||||
* Update README.md to make it beginner friendly and elaborate on the difference between angled and square brackets.
|
||||
* Add chinese Readme file
|
||||
|
||||
2.9.0 / 2015-10-13
|
||||
==================
|
||||
|
||||
* Add option `isDefault` to set default subcommand #415 @Qix-
|
||||
* Add callback to allow filtering or post-processing of help text #434 @djulien
|
||||
* Fix `undefined` text in help information close #414 #416 @zhiyelee
|
||||
|
||||
2.8.1 / 2015-04-22
|
||||
==================
|
||||
|
||||
* Back out `support multiline description` Close #396 #397
|
||||
|
||||
2.8.0 / 2015-04-07
|
||||
==================
|
||||
|
||||
* Add `process.execArg` support, execution args like `--harmony` will be passed to sub-commands #387 @DigitalIO @zhiyelee
|
||||
* Fix bug in Git-style sub-commands #372 @zhiyelee
|
||||
* Allow commands to be hidden from help #383 @tonylukasavage
|
||||
* When git-style sub-commands are in use, yet none are called, display help #382 @claylo
|
||||
* Add ability to specify arguments syntax for top-level command #258 @rrthomas
|
||||
* Support multiline descriptions #208 @zxqfox
|
||||
|
||||
2.7.1 / 2015-03-11
|
||||
==================
|
||||
|
||||
* Revert #347 (fix collisions when option and first arg have same name) which causes a bug in #367.
|
||||
|
||||
2.7.0 / 2015-03-09
|
||||
==================
|
||||
|
||||
* Fix git-style bug when installed globally. Close #335 #349 @zhiyelee
|
||||
* Fix collisions when option and first arg have same name. Close #346 #347 @tonylukasavage
|
||||
* Add support for camelCase on `opts()`. Close #353 @nkzawa
|
||||
* Add node.js 0.12 and io.js to travis.yml
|
||||
* Allow RegEx options. #337 @palanik
|
||||
* Fixes exit code when sub-command failing. Close #260 #332 @pirelenito
|
||||
* git-style `bin` files in $PATH make sense. Close #196 #327 @zhiyelee
|
||||
|
||||
2.6.0 / 2014-12-30
|
||||
==================
|
||||
|
||||
* added `Command#allowUnknownOption` method. Close #138 #318 @doozr @zhiyelee
|
||||
* Add application description to the help msg. Close #112 @dalssoft
|
||||
|
||||
2.5.1 / 2014-12-15
|
||||
==================
|
||||
|
||||
* fixed two bugs incurred by variadic arguments. Close #291 @Quentin01 #302 @zhiyelee
|
||||
|
||||
2.5.0 / 2014-10-24
|
||||
==================
|
||||
|
||||
* add support for variadic arguments. Closes #277 @whitlockjc
|
||||
|
||||
2.4.0 / 2014-10-17
|
||||
==================
|
||||
|
||||
* fixed a bug on executing the coercion function of subcommands option. Closes #270
|
||||
* added `Command.prototype.name` to retrieve command name. Closes #264 #266 @tonylukasavage
|
||||
* added `Command.prototype.opts` to retrieve all the options as a simple object of key-value pairs. Closes #262 @tonylukasavage
|
||||
* fixed a bug on subcommand name. Closes #248 @jonathandelgado
|
||||
* fixed function normalize doesn’t honor option terminator. Closes #216 @abbr
|
||||
|
||||
2.3.0 / 2014-07-16
|
||||
==================
|
||||
|
||||
* add command alias'. Closes PR #210
|
||||
* fix: Typos. Closes #99
|
||||
* fix: Unused fs module. Closes #217
|
||||
|
||||
2.2.0 / 2014-03-29
|
||||
==================
|
||||
|
||||
* add passing of previous option value
|
||||
* fix: support subcommands on windows. Closes #142
|
||||
* Now the defaultValue passed as the second argument of the coercion function.
|
||||
|
||||
2.1.0 / 2013-11-21
|
||||
==================
|
||||
|
||||
* add: allow cflag style option params, unit test, fixes #174
|
||||
|
||||
2.0.0 / 2013-07-18
|
||||
==================
|
||||
|
||||
* remove input methods (.prompt, .confirm, etc)
|
||||
|
||||
1.3.2 / 2013-07-18
|
||||
==================
|
||||
|
||||
* add support for sub-commands to co-exist with the original command
|
||||
|
||||
1.3.1 / 2013-07-18
|
||||
==================
|
||||
|
||||
* add quick .runningCommand hack so you can opt-out of other logic when running a sub command
|
||||
|
||||
1.3.0 / 2013-07-09
|
||||
==================
|
||||
|
||||
* add EACCES error handling
|
||||
* fix sub-command --help
|
||||
|
||||
1.2.0 / 2013-06-13
|
||||
==================
|
||||
|
||||
* allow "-" hyphen as an option argument
|
||||
* support for RegExp coercion
|
||||
|
||||
1.1.1 / 2012-11-20
|
||||
==================
|
||||
|
||||
* add more sub-command padding
|
||||
* fix .usage() when args are present. Closes #106
|
||||
|
||||
1.1.0 / 2012-11-16
|
||||
==================
|
||||
|
||||
* add git-style executable subcommand support. Closes #94
|
||||
|
||||
1.0.5 / 2012-10-09
|
||||
==================
|
||||
|
||||
* fix `--name` clobbering. Closes #92
|
||||
* fix examples/help. Closes #89
|
||||
|
||||
1.0.4 / 2012-09-03
|
||||
==================
|
||||
|
||||
* add `outputHelp()` method.
|
||||
|
||||
1.0.3 / 2012-08-30
|
||||
==================
|
||||
|
||||
* remove invalid .version() defaulting
|
||||
|
||||
1.0.2 / 2012-08-24
|
||||
==================
|
||||
|
||||
* add `--foo=bar` support [arv]
|
||||
* fix password on node 0.8.8. Make backward compatible with 0.6 [focusaurus]
|
||||
|
||||
1.0.1 / 2012-08-03
|
||||
==================
|
||||
|
||||
* fix issue #56
|
||||
* fix tty.setRawMode(mode) was moved to tty.ReadStream#setRawMode() (i.e. process.stdin.setRawMode())
|
||||
|
||||
1.0.0 / 2012-07-05
|
||||
==================
|
||||
|
||||
* add support for optional option descriptions
|
||||
* add defaulting of `.version()` to package.json's version
|
||||
|
||||
0.6.1 / 2012-06-01
|
||||
==================
|
||||
|
||||
* Added: append (yes or no) on confirmation
|
||||
* Added: allow node.js v0.7.x
|
||||
|
||||
0.6.0 / 2012-04-10
|
||||
==================
|
||||
|
||||
* Added `.prompt(obj, callback)` support. Closes #49
|
||||
* Added default support to .choose(). Closes #41
|
||||
* Fixed the choice example
|
||||
|
||||
0.5.1 / 2011-12-20
|
||||
==================
|
||||
|
||||
* Fixed `password()` for recent nodes. Closes #36
|
||||
|
||||
0.5.0 / 2011-12-04
|
||||
==================
|
||||
|
||||
* Added sub-command option support [itay]
|
||||
|
||||
0.4.3 / 2011-12-04
|
||||
==================
|
||||
|
||||
* Fixed custom help ordering. Closes #32
|
||||
|
||||
0.4.2 / 2011-11-24
|
||||
==================
|
||||
|
||||
* Added travis support
|
||||
* Fixed: line-buffered input automatically trimmed. Closes #31
|
||||
|
||||
0.4.1 / 2011-11-18
|
||||
==================
|
||||
|
||||
* Removed listening for "close" on --help
|
||||
|
||||
0.4.0 / 2011-11-15
|
||||
==================
|
||||
|
||||
* Added support for `--`. Closes #24
|
||||
|
||||
0.3.3 / 2011-11-14
|
||||
==================
|
||||
|
||||
* Fixed: wait for close event when writing help info [Jerry Hamlet]
|
||||
|
||||
0.3.2 / 2011-11-01
|
||||
==================
|
||||
|
||||
* Fixed long flag definitions with values [felixge]
|
||||
|
||||
0.3.1 / 2011-10-31
|
||||
==================
|
||||
|
||||
* Changed `--version` short flag to `-V` from `-v`
|
||||
* Changed `.version()` so it's configurable [felixge]
|
||||
|
||||
0.3.0 / 2011-10-31
|
||||
==================
|
||||
|
||||
* Added support for long flags only. Closes #18
|
||||
|
||||
0.2.1 / 2011-10-24
|
||||
==================
|
||||
|
||||
* "node": ">= 0.4.x < 0.7.0". Closes #20
|
||||
|
||||
0.2.0 / 2011-09-26
|
||||
==================
|
||||
|
||||
* Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs]
|
||||
|
||||
0.1.0 / 2011-08-24
|
||||
==================
|
||||
|
||||
* Added support for custom `--help` output
|
||||
|
||||
0.0.5 / 2011-08-18
|
||||
==================
|
||||
|
||||
* Changed: when the user enters nothing prompt for password again
|
||||
* Fixed issue with passwords beginning with numbers [NuckChorris]
|
||||
|
||||
0.0.4 / 2011-08-15
|
||||
==================
|
||||
|
||||
* Fixed `Commander#args`
|
||||
|
||||
0.0.3 / 2011-08-15
|
||||
==================
|
||||
|
||||
* Added default option value support
|
||||
|
||||
0.0.2 / 2011-08-15
|
||||
==================
|
||||
|
||||
* Added mask support to `Command#password(str[, mask], fn)`
|
||||
* Added `Command#password(str, fn)`
|
||||
|
||||
0.0.1 / 2010-01-03
|
||||
==================
|
||||
|
||||
* Initial release
|
||||
22
themes/keepit/node_modules/@algolia/cli/node_modules/commander/LICENSE
generated
vendored
Normal file
22
themes/keepit/node_modules/@algolia/cli/node_modules/commander/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
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.
|
||||
428
themes/keepit/node_modules/@algolia/cli/node_modules/commander/Readme.md
generated
vendored
Normal file
428
themes/keepit/node_modules/@algolia/cli/node_modules/commander/Readme.md
generated
vendored
Normal file
@@ -0,0 +1,428 @@
|
||||
# Commander.js
|
||||
|
||||
|
||||
[](http://travis-ci.org/tj/commander.js)
|
||||
[](https://www.npmjs.org/package/commander)
|
||||
[](https://npmcharts.com/compare/commander?minimal=true)
|
||||
[](https://packagephobia.now.sh/result?p=commander)
|
||||
[](https://gitter.im/tj/commander.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/commander-rb/commander).
|
||||
[API documentation](http://tj.github.com/commander.js/)
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
$ npm install commander
|
||||
|
||||
## Option parsing
|
||||
|
||||
Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.
|
||||
|
||||
```js
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var program = require('commander');
|
||||
|
||||
program
|
||||
.version('0.1.0')
|
||||
.option('-p, --peppers', 'Add peppers')
|
||||
.option('-P, --pineapple', 'Add pineapple')
|
||||
.option('-b, --bbq-sauce', 'Add bbq sauce')
|
||||
.option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')
|
||||
.parse(process.argv);
|
||||
|
||||
console.log('you ordered a pizza with:');
|
||||
if (program.peppers) console.log(' - peppers');
|
||||
if (program.pineapple) console.log(' - pineapple');
|
||||
if (program.bbqSauce) console.log(' - bbq');
|
||||
console.log(' - %s cheese', program.cheese);
|
||||
```
|
||||
|
||||
Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc.
|
||||
|
||||
Note that multi-word options starting with `--no` prefix negate the boolean value of the following word. For example, `--no-sauce` sets the value of `program.sauce` to false.
|
||||
|
||||
```js
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var program = require('commander');
|
||||
|
||||
program
|
||||
.option('--no-sauce', 'Remove sauce')
|
||||
.parse(process.argv);
|
||||
|
||||
console.log('you ordered a pizza');
|
||||
if (program.sauce) console.log(' with sauce');
|
||||
else console.log(' without sauce');
|
||||
```
|
||||
|
||||
To get string arguments from options you will need to use angle brackets <> for required inputs or square brackets [] for optional inputs.
|
||||
|
||||
e.g. ```.option('-m --myarg [myVar]', 'my super cool description')```
|
||||
|
||||
Then to access the input if it was passed in.
|
||||
|
||||
e.g. ```var myInput = program.myarg```
|
||||
|
||||
**NOTE**: If you pass a argument without using brackets the example above will return true and not the value passed in.
|
||||
|
||||
|
||||
## Version option
|
||||
|
||||
Calling the `version` implicitly adds the `-V` and `--version` options to the command.
|
||||
When either of these options is present, the command prints the version number and exits.
|
||||
|
||||
$ ./examples/pizza -V
|
||||
0.0.1
|
||||
|
||||
If you want your program to respond to the `-v` option instead of the `-V` option, simply pass custom flags to the `version` method using the same syntax as the `option` method.
|
||||
|
||||
```js
|
||||
program
|
||||
.version('0.0.1', '-v, --version')
|
||||
```
|
||||
|
||||
The version flags can be named anything, but the long option is required.
|
||||
|
||||
## Command-specific options
|
||||
|
||||
You can attach options to a command.
|
||||
|
||||
```js
|
||||
#!/usr/bin/env node
|
||||
|
||||
var program = require('commander');
|
||||
|
||||
program
|
||||
.command('rm <dir>')
|
||||
.option('-r, --recursive', 'Remove recursively')
|
||||
.action(function (dir, cmd) {
|
||||
console.log('remove ' + dir + (cmd.recursive ? ' recursively' : ''))
|
||||
})
|
||||
|
||||
program.parse(process.argv)
|
||||
```
|
||||
|
||||
A command's options are validated when the command is used. Any unknown options will be reported as an error. However, if an action-based command does not define an action, then the options are not validated.
|
||||
|
||||
## Coercion
|
||||
|
||||
```js
|
||||
function range(val) {
|
||||
return val.split('..').map(Number);
|
||||
}
|
||||
|
||||
function list(val) {
|
||||
return val.split(',');
|
||||
}
|
||||
|
||||
function collect(val, memo) {
|
||||
memo.push(val);
|
||||
return memo;
|
||||
}
|
||||
|
||||
function increaseVerbosity(v, total) {
|
||||
return total + 1;
|
||||
}
|
||||
|
||||
program
|
||||
.version('0.1.0')
|
||||
.usage('[options] <file ...>')
|
||||
.option('-i, --integer <n>', 'An integer argument', parseInt)
|
||||
.option('-f, --float <n>', 'A float argument', parseFloat)
|
||||
.option('-r, --range <a>..<b>', 'A range', range)
|
||||
.option('-l, --list <items>', 'A list', list)
|
||||
.option('-o, --optional [value]', 'An optional value')
|
||||
.option('-c, --collect [value]', 'A repeatable value', collect, [])
|
||||
.option('-v, --verbose', 'A value that can be increased', increaseVerbosity, 0)
|
||||
.parse(process.argv);
|
||||
|
||||
console.log(' int: %j', program.integer);
|
||||
console.log(' float: %j', program.float);
|
||||
console.log(' optional: %j', program.optional);
|
||||
program.range = program.range || [];
|
||||
console.log(' range: %j..%j', program.range[0], program.range[1]);
|
||||
console.log(' list: %j', program.list);
|
||||
console.log(' collect: %j', program.collect);
|
||||
console.log(' verbosity: %j', program.verbose);
|
||||
console.log(' args: %j', program.args);
|
||||
```
|
||||
|
||||
## Regular Expression
|
||||
```js
|
||||
program
|
||||
.version('0.1.0')
|
||||
.option('-s --size <size>', 'Pizza size', /^(large|medium|small)$/i, 'medium')
|
||||
.option('-d --drink [drink]', 'Drink', /^(coke|pepsi|izze)$/i)
|
||||
.parse(process.argv);
|
||||
|
||||
console.log(' size: %j', program.size);
|
||||
console.log(' drink: %j', program.drink);
|
||||
```
|
||||
|
||||
## Variadic arguments
|
||||
|
||||
The last argument of a command can be variadic, and only the last argument. To make an argument variadic you have to
|
||||
append `...` to the argument name. Here is an example:
|
||||
|
||||
```js
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var program = require('commander');
|
||||
|
||||
program
|
||||
.version('0.1.0')
|
||||
.command('rmdir <dir> [otherDirs...]')
|
||||
.action(function (dir, otherDirs) {
|
||||
console.log('rmdir %s', dir);
|
||||
if (otherDirs) {
|
||||
otherDirs.forEach(function (oDir) {
|
||||
console.log('rmdir %s', oDir);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
```
|
||||
|
||||
An `Array` is used for the value of a variadic argument. This applies to `program.args` as well as the argument passed
|
||||
to your action as demonstrated above.
|
||||
|
||||
## Specify the argument syntax
|
||||
|
||||
```js
|
||||
#!/usr/bin/env node
|
||||
|
||||
var program = require('commander');
|
||||
|
||||
program
|
||||
.version('0.1.0')
|
||||
.arguments('<cmd> [env]')
|
||||
.action(function (cmd, env) {
|
||||
cmdValue = cmd;
|
||||
envValue = env;
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
|
||||
if (typeof cmdValue === 'undefined') {
|
||||
console.error('no command given!');
|
||||
process.exit(1);
|
||||
}
|
||||
console.log('command:', cmdValue);
|
||||
console.log('environment:', envValue || "no environment given");
|
||||
```
|
||||
Angled brackets (e.g. `<cmd>`) indicate required input. Square brackets (e.g. `[env]`) indicate optional input.
|
||||
|
||||
## Git-style sub-commands
|
||||
|
||||
```js
|
||||
// file: ./examples/pm
|
||||
var program = require('commander');
|
||||
|
||||
program
|
||||
.version('0.1.0')
|
||||
.command('install [name]', 'install one or more packages')
|
||||
.command('search [query]', 'search with optional query')
|
||||
.command('list', 'list packages installed', {isDefault: true})
|
||||
.parse(process.argv);
|
||||
```
|
||||
|
||||
When `.command()` is invoked with a description argument, no `.action(callback)` should be called to handle sub-commands, otherwise there will be an error. This tells commander that you're going to use separate executables for sub-commands, much like `git(1)` and other popular tools.
|
||||
The commander will try to search the executables in the directory of the entry script (like `./examples/pm`) with the name `program-command`, like `pm-install`, `pm-search`.
|
||||
|
||||
Options can be passed with the call to `.command()`. Specifying `true` for `opts.noHelp` will remove the subcommand from the generated help output. Specifying `true` for `opts.isDefault` will run the subcommand if no other subcommand is specified.
|
||||
|
||||
If the program is designed to be installed globally, make sure the executables have proper modes, like `755`.
|
||||
|
||||
### `--harmony`
|
||||
|
||||
You can enable `--harmony` option in two ways:
|
||||
* Use `#! /usr/bin/env node --harmony` in the sub-commands scripts. Note some os version don’t support this pattern.
|
||||
* Use the `--harmony` option when call the command, like `node --harmony examples/pm publish`. The `--harmony` option will be preserved when spawning sub-command process.
|
||||
|
||||
## Automated --help
|
||||
|
||||
The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:
|
||||
|
||||
```
|
||||
$ ./examples/pizza --help
|
||||
Usage: pizza [options]
|
||||
|
||||
An application for pizzas ordering
|
||||
|
||||
Options:
|
||||
-h, --help output usage information
|
||||
-V, --version output the version number
|
||||
-p, --peppers Add peppers
|
||||
-P, --pineapple Add pineapple
|
||||
-b, --bbq Add bbq sauce
|
||||
-c, --cheese <type> Add the specified type of cheese [marble]
|
||||
-C, --no-cheese You do not want any cheese
|
||||
```
|
||||
|
||||
## Custom help
|
||||
|
||||
You can display arbitrary `-h, --help` information
|
||||
by listening for "--help". Commander will automatically
|
||||
exit once you are done so that the remainder of your program
|
||||
does not execute causing undesired behaviors, for example
|
||||
in the following executable "stuff" will not output when
|
||||
`--help` is used.
|
||||
|
||||
```js
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var program = require('commander');
|
||||
|
||||
program
|
||||
.version('0.1.0')
|
||||
.option('-f, --foo', 'enable some foo')
|
||||
.option('-b, --bar', 'enable some bar')
|
||||
.option('-B, --baz', 'enable some baz');
|
||||
|
||||
// must be before .parse() since
|
||||
// node's emit() is immediate
|
||||
|
||||
program.on('--help', function(){
|
||||
console.log('')
|
||||
console.log('Examples:');
|
||||
console.log(' $ custom-help --help');
|
||||
console.log(' $ custom-help -h');
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
|
||||
console.log('stuff');
|
||||
```
|
||||
|
||||
Yields the following help output when `node script-name.js -h` or `node script-name.js --help` are run:
|
||||
|
||||
```
|
||||
Usage: custom-help [options]
|
||||
|
||||
Options:
|
||||
-h, --help output usage information
|
||||
-V, --version output the version number
|
||||
-f, --foo enable some foo
|
||||
-b, --bar enable some bar
|
||||
-B, --baz enable some baz
|
||||
|
||||
Examples:
|
||||
$ custom-help --help
|
||||
$ custom-help -h
|
||||
```
|
||||
|
||||
## .outputHelp(cb)
|
||||
|
||||
Output help information without exiting.
|
||||
Optional callback cb allows post-processing of help text before it is displayed.
|
||||
|
||||
If you want to display help by default (e.g. if no command was provided), you can use something like:
|
||||
|
||||
```js
|
||||
var program = require('commander');
|
||||
var colors = require('colors');
|
||||
|
||||
program
|
||||
.version('0.1.0')
|
||||
.command('getstream [url]', 'get stream URL')
|
||||
.parse(process.argv);
|
||||
|
||||
if (!process.argv.slice(2).length) {
|
||||
program.outputHelp(make_red);
|
||||
}
|
||||
|
||||
function make_red(txt) {
|
||||
return colors.red(txt); //display the help text in red on the console
|
||||
}
|
||||
```
|
||||
|
||||
## .help(cb)
|
||||
|
||||
Output help information and exit immediately.
|
||||
Optional callback cb allows post-processing of help text before it is displayed.
|
||||
|
||||
|
||||
## Custom event listeners
|
||||
You can execute custom actions by listening to command and option events.
|
||||
|
||||
```js
|
||||
program.on('option:verbose', function () {
|
||||
process.env.VERBOSE = this.verbose;
|
||||
});
|
||||
|
||||
// error on unknown commands
|
||||
program.on('command:*', function () {
|
||||
console.error('Invalid command: %s\nSee --help for a list of available commands.', program.args.join(' '));
|
||||
process.exit(1);
|
||||
});
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
```js
|
||||
var program = require('commander');
|
||||
|
||||
program
|
||||
.version('0.1.0')
|
||||
.option('-C, --chdir <path>', 'change the working directory')
|
||||
.option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
|
||||
.option('-T, --no-tests', 'ignore test hook');
|
||||
|
||||
program
|
||||
.command('setup [env]')
|
||||
.description('run setup commands for all envs')
|
||||
.option("-s, --setup_mode [mode]", "Which setup mode to use")
|
||||
.action(function(env, options){
|
||||
var mode = options.setup_mode || "normal";
|
||||
env = env || 'all';
|
||||
console.log('setup for %s env(s) with %s mode', env, mode);
|
||||
});
|
||||
|
||||
program
|
||||
.command('exec <cmd>')
|
||||
.alias('ex')
|
||||
.description('execute the given remote cmd')
|
||||
.option("-e, --exec_mode <mode>", "Which exec mode to use")
|
||||
.action(function(cmd, options){
|
||||
console.log('exec "%s" using %s mode', cmd, options.exec_mode);
|
||||
}).on('--help', function() {
|
||||
console.log('');
|
||||
console.log('Examples:');
|
||||
console.log('');
|
||||
console.log(' $ deploy exec sequential');
|
||||
console.log(' $ deploy exec async');
|
||||
});
|
||||
|
||||
program
|
||||
.command('*')
|
||||
.action(function(env){
|
||||
console.log('deploying "%s"', env);
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
```
|
||||
|
||||
More Demos can be found in the [examples](https://github.com/tj/commander.js/tree/master/examples) directory.
|
||||
|
||||
## License
|
||||
|
||||
[MIT](https://github.com/tj/commander.js/blob/master/LICENSE)
|
||||
1224
themes/keepit/node_modules/@algolia/cli/node_modules/commander/index.js
generated
vendored
Normal file
1224
themes/keepit/node_modules/@algolia/cli/node_modules/commander/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
38
themes/keepit/node_modules/@algolia/cli/node_modules/commander/package.json
generated
vendored
Normal file
38
themes/keepit/node_modules/@algolia/cli/node_modules/commander/package.json
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "commander",
|
||||
"version": "2.20.3",
|
||||
"description": "the complete solution for node.js command-line programs",
|
||||
"keywords": [
|
||||
"commander",
|
||||
"command",
|
||||
"option",
|
||||
"parser"
|
||||
],
|
||||
"author": "TJ Holowaychuk <tj@vision-media.ca>",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/tj/commander.js.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint index.js",
|
||||
"test": "node test/run.js && npm run test-typings",
|
||||
"test-typings": "tsc -p tsconfig.json"
|
||||
},
|
||||
"main": "index",
|
||||
"files": [
|
||||
"index.js",
|
||||
"typings/index.d.ts"
|
||||
],
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.7.8",
|
||||
"eslint": "^6.4.0",
|
||||
"should": "^13.2.3",
|
||||
"sinon": "^7.5.0",
|
||||
"standard": "^14.3.1",
|
||||
"ts-node": "^8.4.1",
|
||||
"typescript": "^3.6.3"
|
||||
},
|
||||
"typings": "typings/index.d.ts"
|
||||
}
|
||||
310
themes/keepit/node_modules/@algolia/cli/node_modules/commander/typings/index.d.ts
generated
vendored
Normal file
310
themes/keepit/node_modules/@algolia/cli/node_modules/commander/typings/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,310 @@
|
||||
// Type definitions for commander 2.11
|
||||
// Project: https://github.com/visionmedia/commander.js
|
||||
// Definitions by: Alan Agius <https://github.com/alan-agius4>, Marcelo Dezem <https://github.com/mdezem>, vvakame <https://github.com/vvakame>, Jules Randolph <https://github.com/sveinburne>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace local {
|
||||
|
||||
class Option {
|
||||
flags: string;
|
||||
required: boolean;
|
||||
optional: boolean;
|
||||
bool: boolean;
|
||||
short?: string;
|
||||
long: string;
|
||||
description: string;
|
||||
|
||||
/**
|
||||
* Initialize a new `Option` with the given `flags` and `description`.
|
||||
*
|
||||
* @param {string} flags
|
||||
* @param {string} [description]
|
||||
*/
|
||||
constructor(flags: string, description?: string);
|
||||
}
|
||||
|
||||
class Command extends NodeJS.EventEmitter {
|
||||
[key: string]: any;
|
||||
|
||||
args: string[];
|
||||
|
||||
/**
|
||||
* Initialize a new `Command`.
|
||||
*
|
||||
* @param {string} [name]
|
||||
*/
|
||||
constructor(name?: string);
|
||||
|
||||
/**
|
||||
* Set the program version to `str`.
|
||||
*
|
||||
* This method auto-registers the "-V, --version" flag
|
||||
* which will print the version number when passed.
|
||||
*
|
||||
* @param {string} str
|
||||
* @param {string} [flags]
|
||||
* @returns {Command} for chaining
|
||||
*/
|
||||
version(str: string, flags?: string): Command;
|
||||
|
||||
/**
|
||||
* Add command `name`.
|
||||
*
|
||||
* The `.action()` callback is invoked when the
|
||||
* command `name` is specified via __ARGV__,
|
||||
* and the remaining arguments are applied to the
|
||||
* function for access.
|
||||
*
|
||||
* When the `name` is "*" an un-matched command
|
||||
* will be passed as the first arg, followed by
|
||||
* the rest of __ARGV__ remaining.
|
||||
*
|
||||
* @example
|
||||
* program
|
||||
* .version('0.0.1')
|
||||
* .option('-C, --chdir <path>', 'change the working directory')
|
||||
* .option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
|
||||
* .option('-T, --no-tests', 'ignore test hook')
|
||||
*
|
||||
* program
|
||||
* .command('setup')
|
||||
* .description('run remote setup commands')
|
||||
* .action(function() {
|
||||
* console.log('setup');
|
||||
* });
|
||||
*
|
||||
* program
|
||||
* .command('exec <cmd>')
|
||||
* .description('run the given remote command')
|
||||
* .action(function(cmd) {
|
||||
* console.log('exec "%s"', cmd);
|
||||
* });
|
||||
*
|
||||
* program
|
||||
* .command('teardown <dir> [otherDirs...]')
|
||||
* .description('run teardown commands')
|
||||
* .action(function(dir, otherDirs) {
|
||||
* console.log('dir "%s"', dir);
|
||||
* if (otherDirs) {
|
||||
* otherDirs.forEach(function (oDir) {
|
||||
* console.log('dir "%s"', oDir);
|
||||
* });
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* program
|
||||
* .command('*')
|
||||
* .description('deploy the given env')
|
||||
* .action(function(env) {
|
||||
* console.log('deploying "%s"', env);
|
||||
* });
|
||||
*
|
||||
* program.parse(process.argv);
|
||||
*
|
||||
* @param {string} name
|
||||
* @param {string} [desc] for git-style sub-commands
|
||||
* @param {CommandOptions} [opts] command options
|
||||
* @returns {Command} the new command
|
||||
*/
|
||||
command(name: string, desc?: string, opts?: commander.CommandOptions): Command;
|
||||
|
||||
/**
|
||||
* Define argument syntax for the top-level command.
|
||||
*
|
||||
* @param {string} desc
|
||||
* @returns {Command} for chaining
|
||||
*/
|
||||
arguments(desc: string): Command;
|
||||
|
||||
/**
|
||||
* Parse expected `args`.
|
||||
*
|
||||
* For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`.
|
||||
*
|
||||
* @param {string[]} args
|
||||
* @returns {Command} for chaining
|
||||
*/
|
||||
parseExpectedArgs(args: string[]): Command;
|
||||
|
||||
/**
|
||||
* Register callback `fn` for the command.
|
||||
*
|
||||
* @example
|
||||
* program
|
||||
* .command('help')
|
||||
* .description('display verbose help')
|
||||
* .action(function() {
|
||||
* // output help here
|
||||
* });
|
||||
*
|
||||
* @param {(...args: any[]) => void} fn
|
||||
* @returns {Command} for chaining
|
||||
*/
|
||||
action(fn: (...args: any[]) => void): Command;
|
||||
|
||||
/**
|
||||
* Define option with `flags`, `description` and optional
|
||||
* coercion `fn`.
|
||||
*
|
||||
* The `flags` string should contain both the short and long flags,
|
||||
* separated by comma, a pipe or space. The following are all valid
|
||||
* all will output this way when `--help` is used.
|
||||
*
|
||||
* "-p, --pepper"
|
||||
* "-p|--pepper"
|
||||
* "-p --pepper"
|
||||
*
|
||||
* @example
|
||||
* // simple boolean defaulting to false
|
||||
* program.option('-p, --pepper', 'add pepper');
|
||||
*
|
||||
* --pepper
|
||||
* program.pepper
|
||||
* // => Boolean
|
||||
*
|
||||
* // simple boolean defaulting to true
|
||||
* program.option('-C, --no-cheese', 'remove cheese');
|
||||
*
|
||||
* program.cheese
|
||||
* // => true
|
||||
*
|
||||
* --no-cheese
|
||||
* program.cheese
|
||||
* // => false
|
||||
*
|
||||
* // required argument
|
||||
* program.option('-C, --chdir <path>', 'change the working directory');
|
||||
*
|
||||
* --chdir /tmp
|
||||
* program.chdir
|
||||
* // => "/tmp"
|
||||
*
|
||||
* // optional argument
|
||||
* program.option('-c, --cheese [type]', 'add cheese [marble]');
|
||||
*
|
||||
* @param {string} flags
|
||||
* @param {string} [description]
|
||||
* @param {((arg1: any, arg2: any) => void) | RegExp} [fn] function or default
|
||||
* @param {*} [defaultValue]
|
||||
* @returns {Command} for chaining
|
||||
*/
|
||||
option(flags: string, description?: string, fn?: ((arg1: any, arg2: any) => void) | RegExp, defaultValue?: any): Command;
|
||||
option(flags: string, description?: string, defaultValue?: any): Command;
|
||||
|
||||
/**
|
||||
* Allow unknown options on the command line.
|
||||
*
|
||||
* @param {boolean} [arg] if `true` or omitted, no error will be thrown for unknown options.
|
||||
* @returns {Command} for chaining
|
||||
*/
|
||||
allowUnknownOption(arg?: boolean): Command;
|
||||
|
||||
/**
|
||||
* Parse `argv`, settings options and invoking commands when defined.
|
||||
*
|
||||
* @param {string[]} argv
|
||||
* @returns {Command} for chaining
|
||||
*/
|
||||
parse(argv: string[]): Command;
|
||||
|
||||
/**
|
||||
* Parse options from `argv` returning `argv` void of these options.
|
||||
*
|
||||
* @param {string[]} argv
|
||||
* @returns {ParseOptionsResult}
|
||||
*/
|
||||
parseOptions(argv: string[]): commander.ParseOptionsResult;
|
||||
|
||||
/**
|
||||
* Return an object containing options as key-value pairs
|
||||
*
|
||||
* @returns {{[key: string]: any}}
|
||||
*/
|
||||
opts(): { [key: string]: any };
|
||||
|
||||
/**
|
||||
* Set the description to `str`.
|
||||
*
|
||||
* @param {string} str
|
||||
* @param {{[argName: string]: string}} argsDescription
|
||||
* @return {(Command | string)}
|
||||
*/
|
||||
description(str: string, argsDescription?: {[argName: string]: string}): Command;
|
||||
description(): string;
|
||||
|
||||
/**
|
||||
* Set an alias for the command.
|
||||
*
|
||||
* @param {string} alias
|
||||
* @return {(Command | string)}
|
||||
*/
|
||||
alias(alias: string): Command;
|
||||
alias(): string;
|
||||
|
||||
/**
|
||||
* Set or get the command usage.
|
||||
*
|
||||
* @param {string} str
|
||||
* @return {(Command | string)}
|
||||
*/
|
||||
usage(str: string): Command;
|
||||
usage(): string;
|
||||
|
||||
/**
|
||||
* Set the name of the command.
|
||||
*
|
||||
* @param {string} str
|
||||
* @return {Command}
|
||||
*/
|
||||
name(str: string): Command;
|
||||
|
||||
/**
|
||||
* Get the name of the command.
|
||||
*
|
||||
* @return {string}
|
||||
*/
|
||||
name(): string;
|
||||
|
||||
/**
|
||||
* Output help information for this command.
|
||||
*
|
||||
* @param {(str: string) => string} [cb]
|
||||
*/
|
||||
outputHelp(cb?: (str: string) => string): void;
|
||||
|
||||
/** Output help information and exit.
|
||||
*
|
||||
* @param {(str: string) => string} [cb]
|
||||
*/
|
||||
help(cb?: (str: string) => string): never;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
declare namespace commander {
|
||||
|
||||
type Command = local.Command
|
||||
|
||||
type Option = local.Option
|
||||
|
||||
interface CommandOptions {
|
||||
noHelp?: boolean;
|
||||
isDefault?: boolean;
|
||||
}
|
||||
|
||||
interface ParseOptionsResult {
|
||||
args: string[];
|
||||
unknown: string[];
|
||||
}
|
||||
|
||||
interface CommanderStatic extends Command {
|
||||
Command: typeof local.Command;
|
||||
Option: typeof local.Option;
|
||||
CommandOptions: CommandOptions;
|
||||
ParseOptionsResult: ParseOptionsResult;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
declare const commander: commander.CommanderStatic;
|
||||
export = commander;
|
||||
90
themes/keepit/node_modules/@algolia/cli/package.json
generated
vendored
Normal file
90
themes/keepit/node_modules/@algolia/cli/package.json
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
{
|
||||
"name": "@algolia/cli",
|
||||
"version": "4.0.8",
|
||||
"description": "A Node CLI tools for manipulating data. Handy for day-to-day Algolia SE work.",
|
||||
"license": "ISC",
|
||||
"author": "Algolia, Inc. (https://www.algolia.com)",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/algolia/algolia-cli.git"
|
||||
},
|
||||
"bin": {
|
||||
"algolia": "./index.js"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest --runInBand",
|
||||
"test:unit": "jest commands/",
|
||||
"test:unit:watch": "jest --watch commands/",
|
||||
"test:integration": "jest --runInBand tests/integration/",
|
||||
"lint": "eslint .",
|
||||
"lint:fix": "npm run lint -- --fix"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.9.1",
|
||||
"yarn": ">=1.10.1"
|
||||
},
|
||||
"files": [
|
||||
"commands",
|
||||
"commands.js",
|
||||
"index.js",
|
||||
"!commands/*.test.js"
|
||||
],
|
||||
"renovate": {
|
||||
"extends": [
|
||||
"config:js-app"
|
||||
]
|
||||
},
|
||||
"keywords": [
|
||||
"data",
|
||||
"json",
|
||||
"csv",
|
||||
"manipulate",
|
||||
"transform",
|
||||
"process",
|
||||
"parse",
|
||||
"import",
|
||||
"index",
|
||||
"solutions",
|
||||
"se",
|
||||
"cli"
|
||||
],
|
||||
"dependencies": {
|
||||
"JSONStream": "^1.3.5",
|
||||
"algoliasearch": "^3.31.0",
|
||||
"async": "^2.6.0",
|
||||
"batch-stream": "^0.1.3",
|
||||
"chalk": "^2.4.1",
|
||||
"commander": "^2.19.0",
|
||||
"csvtojson": "^2.0.8",
|
||||
"inquirer": "^6.2.2",
|
||||
"regex-parser": "^2.2.10",
|
||||
"speedtest-net": "^1.5.1",
|
||||
"stream-transform": "^1.0.7",
|
||||
"through": "^2.3.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-eslint": "^10.0.1",
|
||||
"babel-jest": "^23.6.0",
|
||||
"dotenv": "^6.2.0",
|
||||
"eslint": "^5.9.0",
|
||||
"eslint-config-algolia": "^13.2.3",
|
||||
"eslint-config-prettier": "^3.3.0",
|
||||
"eslint-plugin-import": "^2.14.0",
|
||||
"eslint-plugin-jest": "^22.1.2",
|
||||
"eslint-plugin-prettier": "^3.0.0",
|
||||
"jest": "^23.6.0",
|
||||
"prettier": "^1.15.3",
|
||||
"randomatic": "^3.1.1",
|
||||
"rimraf": "^2.6.2",
|
||||
"striptags": "^3.1.1"
|
||||
},
|
||||
"jest": {
|
||||
"testEnvironment": "node",
|
||||
"verbose": true,
|
||||
"testURL": "http://localhost/",
|
||||
"setupFiles": [
|
||||
"./tests/config.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
656
themes/keepit/node_modules/@algolia/cli/readme.md
generated
vendored
Normal file
656
themes/keepit/node_modules/@algolia/cli/readme.md
generated
vendored
Normal file
@@ -0,0 +1,656 @@
|
||||
# Algolia CLI
|
||||
|
||||
A Node CLI tool that makes it easy to perform common data manipulations and interactions with your Algolia app or indices.
|
||||
|
||||
- [Requirements](#requirements)
|
||||
- [Install](#install)
|
||||
- [Usage](#usage)
|
||||
- [Commands](#commands)
|
||||
- [Examples](#examples)
|
||||
- [Contribute](#contribute)
|
||||
|
||||
# Requirements
|
||||
|
||||
- [Node.js](https://nodejs.org/)
|
||||
|
||||
# Install
|
||||
|
||||
- `npm install -g @algolia/cli`
|
||||
|
||||
# Usage
|
||||
|
||||
##### 📌 `algolia <COMMAND NAME> [OPTIONS]` 📌
|
||||
|
||||
|
||||
```bash
|
||||
$ algolia --help
|
||||
|
||||
$ algolia --version
|
||||
|
||||
$ algolia interactive
|
||||
|
||||
$ algolia search -a <algoliaAppId> -k <algoliaApiKey> -n <algoliaIndexName> -q <query> -p <searchParams> -o <outputPath>
|
||||
|
||||
$ algolia import -s <sourceFilepath> -a <algoliaAppId> -k <algoliaApiKey> -n <algoliaIndexName> -b <batchSize> -t <transformationFilepath> -m <maxconcurrency> -p <csvToJsonParams>
|
||||
|
||||
$ algolia export -a <algoliaAppId> -k <algoliaApiKey> -n <algoliaIndexName> -o <outputPath> -p <algoliaParams>
|
||||
|
||||
$ algolia getsettings -a <algoliaAppId> -k <algoliaApiKey> -n <algoliaIndexName>
|
||||
|
||||
$ algolia setsettings -a <algoliaAppId> -k <algoliaApiKey> -n <algoliaIndexName> -s <sourceFilepath> -p <setSettingsParams>
|
||||
|
||||
$ algolia addrules -a <algoliaAppId> -k <algoliaApiKey> -n <algoliaIndexName> -s <sourceFilepath> -p <batchRulesParams>
|
||||
|
||||
$ algolia exportrules -a <algoliaAppId> -k <algoliaApiKey> -n <algoliaIndexName> -o <outputPath>
|
||||
|
||||
$ algolia addsynonyms -a <algoliaAppId> -k <algoliaApiKey> -n <algoliaIndexName> -s <sourceFilepath> -p <batchSynonymsParams>
|
||||
|
||||
$ algolia exportsynonyms -a <algoliaAppId> -k <algoliaApiKey> -n <algoliaIndexName> -o <outputPath>
|
||||
|
||||
$ algolia transferindex -a <sourcealgoliaAppId> -k <sourcealgoliaApiKey> -n <sourcealgoliaIndexName> -d <destinationAlgoliaAppId> -y <destinationAlgoliaApiKey> -i <destinationIndexName> -t <transformationFilepath> -e <true|false>
|
||||
|
||||
$ algolia transferindexconfig -a <sourcealgoliaAppId> -k <sourcealgoliaApiKey> -n <sourcealgoliaIndexName> -d <destinationAlgoliaAppId> -y <destinationAlgoliaApiKey> -i <destinationIndexName> -p <configParams> -e <true|false>
|
||||
|
||||
$ algolia deleteindicespattern -a <algoliaAppId> -k <algoliaApiKey> -r '<regexp>' -x <true|false>
|
||||
|
||||
$ algolia transformlines -s <sourceFilepath> -o <outputPath> -t <transformationFilepath>
|
||||
|
||||
$ algolia examples
|
||||
```
|
||||
|
||||
See also [additional examples](#examples).
|
||||
|
||||
# Commands
|
||||
|
||||
### 1. Help | `--help`
|
||||
|
||||
##### Description:
|
||||
|
||||
Get basic usage info for all provided CLI scripts.
|
||||
|
||||
##### Usage:
|
||||
|
||||
```shell
|
||||
algolia --help
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```
|
||||
algolia -h
|
||||
```
|
||||
|
||||
### 2. Version | `--version`
|
||||
|
||||
##### Description:
|
||||
|
||||
Get version info for npm package.
|
||||
|
||||
##### Usage:
|
||||
|
||||
```shell
|
||||
algolia --version
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```
|
||||
algolia -v
|
||||
```
|
||||
|
||||
### 3. Interactive | `interactive`
|
||||
|
||||
##### Description:
|
||||
|
||||
Use Algolia CLI in interactive mode. Get command and argument prompts.
|
||||
|
||||
##### Usage:
|
||||
|
||||
```shell
|
||||
algolia interactive
|
||||
```
|
||||
|
||||
### 4. Search | `search`
|
||||
|
||||
##### Description:
|
||||
|
||||
Search an Algolia index.
|
||||
|
||||
##### Usage:
|
||||
|
||||
```shell
|
||||
algolia search -a <algoliaAppId> -k <algoliaApiKey> -n <algoliaIndexName> -q <query> -p <searchParams> -o <outputPath>
|
||||
```
|
||||
|
||||
##### Options:
|
||||
|
||||
- `<algoliaAppId>` | Required
|
||||
- `<algoliaApiKey>` | Required
|
||||
- `<algoliaIndexName>` | Required
|
||||
- `<query>` | Optional | Search query string to send to Algolia index. Defaults to `''`.
|
||||
- `<searchParams>` | Optional | JSON params to be passed to Algolia `.search()` [method](https://www.algolia.com/doc/api-reference/api-methods/search/?language=javascript).
|
||||
- `<outputPath>` | Optional | Local path where search results file will be saved.
|
||||
|
||||
##### Notes:
|
||||
|
||||
- If no `<outputPath>` is provided, command will simply console.log() the response.
|
||||
- If an `<outputPath>` is provided, command will write a JSON file to that location.
|
||||
- Provided `<outputPath>` path must include file name.
|
||||
- See [search parameters](https://www.algolia.com/doc/api-reference/search-api-parameters/) for more documentation about search options.
|
||||
|
||||
### 5. Import | `import`
|
||||
|
||||
##### Description:
|
||||
|
||||
Import JSON or CSV data into Algolia index, from a file or directory of files.
|
||||
|
||||
You may also optionally apply custom transformations to each object indexed. CSV files will automatically be converted to JSON before transformations are applied.
|
||||
|
||||
Will handle arbitrarily large files without performance issues.
|
||||
|
||||
##### Usage:
|
||||
|
||||
```shell
|
||||
algolia import -s <sourceFilepath> -a <algoliaAppId> -k <algoliaApiKey> -n <algoliaIndexName> -b <batchSize> -t <transformationFilepath> -m <maxConcurrency> -p <csvToJsonParams>
|
||||
```
|
||||
|
||||
##### Options:
|
||||
|
||||
- `<sourceFilepath>` | Required | Path to a JSON or CSV file, or to a directory of such files.
|
||||
- `<algoliaAppId>` | Required
|
||||
- `<algoliaApiKey>` | Required
|
||||
- `<algoliaIndexName>` | Required
|
||||
- `<batchSize>` | Optional | Number of JSON objects to be included in each batch for indexing. Default is `5000`.
|
||||
- `<transformationFilepath>` | Optional | The path to any file that exports a function which (1) takes 2 arguments; an object and a callback, then (2) ends by calling said callback with the 2 arguments `null` and `<YOUR_TRANSFORMED_OBJECT>`.
|
||||
- `<maxConcurrency>` | Optional | Maximum number of concurrent filestreams to process. Default is `2`.
|
||||
- `<csvToJsonParams>` | Optional | Stringified [Parser parameters](https://github.com/Keyang/node-csvtojson#parameters) object passed to [csvtojson](https://www.npmjs.com/package/csvtojson) module.
|
||||
|
||||
##### Example Transformation File:
|
||||
|
||||
See `transformations/example-transformations.js` for an extensive JSON object transformation example.
|
||||
|
||||
Simple transformation file example:
|
||||
```javascript
|
||||
module.exports = (data,cb) => {
|
||||
try {
|
||||
const record = Object.assign({}, data);
|
||||
record.objectID = data.product_id;
|
||||
record.score = Math.floor(Math.random() * 100);
|
||||
record.formattedNumber = parseInt(data.integer_formatted_as_string, 10);
|
||||
cb(null, record);
|
||||
} catch (e) {
|
||||
console.log('Transformation error:', e.message, e.stack);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
##### Notes:
|
||||
|
||||
- `<sourceFilepath>` may target a file or a directory of files.
|
||||
- JSON files must contain an array of objects.
|
||||
- CSV files must have a `.csv` extension.
|
||||
- `<transformationFilepath>` requires a path to a transformation file. See [example file](transformations/example-transformations.js).
|
||||
- Make sure you only import JSON or CSV files. Don't accidentally try to import hidden files like `.DS_Store`, log files, etc. as they will throw an error.
|
||||
- Command assumes each file contains an array of JSON objects unless the file extension ends with `.csv`.
|
||||
- CSV to JSON conversion performed using [csvtojson](https://www.npmjs.com/package/csvtojson) package.
|
||||
- If no `<batchSize>` is explicitly provided, command will try to determine optimal batch size by estimating average record size, estimating network speed, and calculating a size that should work well given the concurrency.
|
||||
- If command outputs a `AlgoliaSearchRequestTimeoutError` error, this means a batch of records failed to import. This typically occurs when attempting to import too much data over too slow a network connection. Command will automatically attempt to reduce `<batchSize>` to compensate, and re-try. If issues persist, consider reducing `<maxConcurrency>` and/or `<batchSize>`.
|
||||
- If command outputs a `High memory usage` warning, it means the process is consuming a very high percentage of the estimated system heap allocation for the node process. Command will automatically attempt to reduce `<batchSize>` to compensate. If issues persist, consider reducing `<maxConcurrency>` and/or `<batchSize>`.
|
||||
|
||||
### 6. Export | `export`
|
||||
|
||||
##### Description:
|
||||
|
||||
Download all JSON records from a specific Algolia index.
|
||||
|
||||
##### Usage:
|
||||
|
||||
```shell
|
||||
algolia export -a <algoliaAppId> -k <algoliaApiKey> -n <algoliaIndexName> -o <outputPath> -p <algoliaParams>
|
||||
```
|
||||
|
||||
##### Options:
|
||||
|
||||
- `<algoliaAppId>` | Required
|
||||
- `<algoliaApiKey>` | Required
|
||||
- `<algoliaIndexName>` | Required
|
||||
- `<outputPath>` | Optional | Path to an existing local directory where output files will be saved (filenames are autogenerated). If no output path is provided, defaults to current working directory.
|
||||
- `<algoliaParams>` | Optional | JSON [Search params](https://www.algolia.com/doc/api-reference/search-api-parameters/) object passed to `browseAll()` [method](https://www.algolia.com/doc/api-reference/api-methods/browse/).
|
||||
|
||||
##### Notes:
|
||||
|
||||
- `<outputPath>` must be a directory.
|
||||
|
||||
### 7. Get Settings | `getsettings`
|
||||
|
||||
##### Description:
|
||||
|
||||
Get settings for a specific Algolia index.
|
||||
|
||||
##### Usage:
|
||||
|
||||
```shell
|
||||
algolia getsettings -a <algoliaAppId> -k <algoliaApiKey> -n <algoliaIndexName>
|
||||
```
|
||||
|
||||
##### Options:
|
||||
|
||||
- `<algoliaAppId>` | Required
|
||||
- `<algoliaApiKey>` | Required
|
||||
- `<algoliaIndexName>` | Required
|
||||
|
||||
##### Notes:
|
||||
|
||||
- To write settings JSON locally, just redirect the output to a file. For example:
|
||||
`$ algolia getsettings -a EXAMPLE_APP_ID -k EXAMPLE_API_KEY -n EXAMPLE_INDEX_NAME > ~/Desktop/EXAMPLE_FILE_NAME.json`
|
||||
|
||||
### 8. Set Settings | `setsettings`
|
||||
|
||||
##### Description:
|
||||
|
||||
Set settings for a specific Algolia index.
|
||||
|
||||
##### Usage:
|
||||
|
||||
```shell
|
||||
algolia setsettings -a <algoliaAppId> -k <algoliaApiKey> -n <algoliaIndexName> -s <sourceFilepath> -p <setSettingsParams>
|
||||
```
|
||||
|
||||
##### Options:
|
||||
|
||||
- `<algoliaAppId>` | Required
|
||||
- `<algoliaApiKey>` | Required
|
||||
- `<algoliaIndexName>` | Required
|
||||
- `<sourceFilepath>` | Required | Path to a JSON file containing a settings object.
|
||||
- `<setSettingsParams>` | Optional | JSON object containing options passed to `setSettings()` [method](https://www.algolia.com/doc/api-reference/api-methods/set-settings/).
|
||||
|
||||
##### Example settings file:
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
minWordSizefor1Typo: 4,
|
||||
minWordSizefor2Typos: 8,
|
||||
hitsPerPage: 20,
|
||||
maxValuesPerFacet: 100,
|
||||
version: 2,
|
||||
attributesToIndex: null,
|
||||
numericAttributesToIndex: null,
|
||||
attributesToRetrieve: null,
|
||||
unretrievableAttributes: null,
|
||||
optionalWords: null,
|
||||
attributesForFaceting: null,
|
||||
attributesToSnippet: null,
|
||||
attributesToHighlight: null,
|
||||
paginationLimitedTo: 1000,
|
||||
attributeForDistinct: null,
|
||||
exactOnSingleWordQuery: 'attribute',
|
||||
ranking:
|
||||
[ 'typo',
|
||||
'geo',
|
||||
'words',
|
||||
'filters',
|
||||
'proximity',
|
||||
'attribute',
|
||||
'exact',
|
||||
'custom' ],
|
||||
customRanking: null,
|
||||
separatorsToIndex: '',
|
||||
removeWordsIfNoResults: 'none',
|
||||
queryType: 'prefixLast',
|
||||
highlightPreTag: '<em>',
|
||||
highlightPostTag: '</em>',
|
||||
snippetEllipsisText: '',
|
||||
alternativesAsExact: [ 'ignorePlurals', 'singleWordSynonym' ]
|
||||
};
|
||||
```
|
||||
|
||||
##### Example setSettings params:
|
||||
|
||||
```
|
||||
'{"forwardToReplicas":true}'
|
||||
```
|
||||
##### Notes:
|
||||
- Any index setting parameter needs to be added directly in the file containing the settings object. See [Settings API paraameters documentation](https://www.algolia.com/doc/api-reference/settings-api-parameters/) to find the full list of index settings parameters.
|
||||
- forwardToReplicas is currently the only option that can be passed to the settings method as an optional <setSettingsParams> argument.
|
||||
|
||||
### 9. Add Rules | `addrules`
|
||||
|
||||
##### Description:
|
||||
|
||||
Import a local JSON file of query rules to an Algolia index.
|
||||
|
||||
##### Usage:
|
||||
|
||||
```shell
|
||||
algolia addrules -a <algoliaAppId> -k <algoliaApiKey> -n <algoliaIndexName> -s <sourceFilepath> -p <batchRulesParams>
|
||||
```
|
||||
|
||||
##### Options:
|
||||
|
||||
- `<algoliaAppId>` | Required
|
||||
- `<algoliaApiKey>` | Required
|
||||
- `<algoliaIndexName>` | Required
|
||||
- `<sourceFilepath>` | Required | Path to a JSON file containing an array of query rule objects.
|
||||
- `<batchRulesParams>` | Optional | JSON object containing options passed to `batchRules()` [method](https://www.algolia.com/doc/api-reference/api-methods/batch-rules/).
|
||||
|
||||
##### Notes:
|
||||
|
||||
- See [batchRules documentation](https://www.algolia.com/doc/api-reference/api-methods/batch-rules/) and [implementing query rules documentation](https://www.algolia.com/doc/guides/managing-results/refine-results/merchandising-and-promoting/in-depth/implementing-query-rules/) for more info.
|
||||
|
||||
### 10. Export Rules | `exportrules`
|
||||
|
||||
##### Description:
|
||||
|
||||
Download all query rules from a specific Algolia index.
|
||||
|
||||
##### Usage:
|
||||
|
||||
```shell
|
||||
algolia exportrules -a <algoliaAppId> -k <algoliaApiKey> -n <algoliaIndexName> -o <outputPath>
|
||||
```
|
||||
|
||||
##### Options:
|
||||
|
||||
- `<algoliaAppId>` | Required
|
||||
- `<algoliaApiKey>` | Required
|
||||
- `<algoliaIndexName>` | Required
|
||||
- `<outputPath>` | Optional | Local path where query rules file will be saved. If no output path is provided, defaults to current working directory.
|
||||
|
||||
##### Notes:
|
||||
|
||||
- `<outputPath>`path must include file name.
|
||||
|
||||
### 11. Add Synonyms | `addsynonyms`
|
||||
|
||||
##### Description:
|
||||
|
||||
Import a local CSV or JSON file of synonyms to an Algolia index. Some public synonym files can be downloaded from [this repository](https://github.com/algolia/synonym-dictionaries). Disclaimer: These are not intended to be all encompassing -- edits may be needed for your use case.
|
||||
|
||||
Note that if importing a CSV file, the expected format is file with no headers and with each row of comma-separated values being a group of synonyms for each other. For more information, read our [documentation](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/how-to/managing-synonyms-from-the-dashboard/#csv) on the topic.
|
||||
|
||||
##### Usage:
|
||||
|
||||
```shell
|
||||
algolia addsynonyms -a <algoliaAppId> -k <algoliaApiKey> -n <algoliaIndexName> -s <sourceFilepath> -p <batchSynonymsParams>
|
||||
```
|
||||
|
||||
##### Options:
|
||||
|
||||
- `<algoliaAppId>` | Required
|
||||
- `<algoliaApiKey>` | Required
|
||||
- `<algoliaIndexName>` | Required
|
||||
- `<sourceFilepath>` | Required | Path to a CSV or JSON file containing an array of synonyms objects.
|
||||
- `<batchSynonymsParams>` | Optional | JSON object containing options passed to `batchSynonyms()` [method](https://www.algolia.com/doc/api-reference/api-methods/batch-synonyms/).
|
||||
|
||||
##### Notes:
|
||||
|
||||
- See [batchSynonyms documentation](https://www.algolia.com/doc/api-reference/api-methods/batch-synonyms/) and [adding synonyms documentation](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/) for more info.
|
||||
|
||||
### 12. Export Synonyms | `exportsynonyms`
|
||||
|
||||
##### Description:
|
||||
|
||||
Download all synonyms from a specific Algolia index.
|
||||
|
||||
##### Usage:
|
||||
|
||||
```shell
|
||||
algolia exportsynonyms -a <algoliaAppId> -k <algoliaApiKey> -n <algoliaIndexName> -o <outputPath>
|
||||
```
|
||||
|
||||
##### Options:
|
||||
|
||||
- `<algoliaAppId>` | Required
|
||||
- `<algoliaApiKey>` | Required
|
||||
- `<algoliaIndexName>` | Required
|
||||
- `<outputPath>` | Optional | Local path where synonyms file will be saved. If no output path is provided, defaults to current working directory.
|
||||
|
||||
##### Notes:
|
||||
|
||||
- `<outputPath>`path must include file name.
|
||||
|
||||
### 13. Transfer Index | `transferindex`
|
||||
|
||||
##### Description:
|
||||
|
||||
Transfer all data and settings (including synonyms and query rules) from one Algolia app/index to another.
|
||||
|
||||
##### Usage:
|
||||
|
||||
```shell
|
||||
algolia transferindex -a <sourceAlgoliaAppId> -k <sourceAlgoliaApiKey> -n <sourceAlgoliaIndexName> -d <destinationAlgoliaAppId> -y <destinationAlgoliaApiKey> -i <destinationIndexName> -t <transformationFilepath> -e <excludeReplicas>
|
||||
```
|
||||
|
||||
##### Options:
|
||||
|
||||
- `<sourceAlgoliaAppId>` | Required
|
||||
- `<sourceAlgoliaApiKey>` | Required
|
||||
- `<sourceAlgoliaIndexName>` | Required
|
||||
- `<destinationAlgoliaAppId>` | Required
|
||||
- `<destinationAlgoliaApiKey>` | Required
|
||||
- `<destinationIndexName>` | Optional | If no destination index name is specified, script will default to creating a new index with the same name as the source index.
|
||||
- `<transformationFilepath>` | Optional | The path to any file that exports a function which (1) takes a single object as argument, then (2) returns a transformed object.
|
||||
- `<excludeReplicas>` | Optional | This is a boolean. When `true`, it will exclude the `replicas` setting when copying settings to the destination index. When `false`, it will copy the full settings object. Defaults to `false`.
|
||||
|
||||
##### Example Transformation File:
|
||||
|
||||
Simple transformation file for transferring an index:
|
||||
|
||||
```javascript
|
||||
module.exports = (obj) => {
|
||||
try {
|
||||
const record = {};
|
||||
record.objectID = obj.product_id;
|
||||
record.score = Math.floor(Math.random() * 100);
|
||||
record.formattedNumber = parseInt(obj.integer_formatted_as_string, 10);
|
||||
} catch (e) {
|
||||
console.log('Transformation error:', e.message, e.stack);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
##### Notes:
|
||||
|
||||
- Command duplicates data and copies settings, synonyms, and rules; does not delete or affect source index.
|
||||
- Command does NOT forward settings or synonyms to replicas.
|
||||
|
||||
### 14. Transfer Index Config | `transferindexconfig`
|
||||
|
||||
##### Description:
|
||||
|
||||
Transfer an index's settings, synonyms, and query rules to another index. Works even across indices in different Algolia applications.
|
||||
|
||||
##### Usage:
|
||||
|
||||
```shell
|
||||
algolia transferindexconfig -a <sourceAlgoliaAppId> -k <sourceAlgoliaApiKey> -n <sourceAlgoliaIndexName> -d <destinationAlgoliaAppId> -y <destinationAlgoliaApiKey> -i <destinationIndexName> -p <configParams> -e <excludeReplicas>
|
||||
```
|
||||
|
||||
##### Options:
|
||||
|
||||
- `<sourceAlgoliaAppId>` | Required
|
||||
- `<sourceAlgoliaApiKey>` | Required
|
||||
- `<sourceAlgoliaIndexName>` | Required
|
||||
- `<destinationAlgoliaAppId>` | Required
|
||||
- `<destinationAlgoliaApiKey>` | Required
|
||||
- `<destinationIndexName>` | Optional | If no destination index name is specified, script will default to targetting an existing index with the same name as the source index.
|
||||
- `<configParams>` | Optional | JSON object containing one or both of the following two properties: `batchSynonymsParams` and `batchRulesParams`. Each of those property values may contain a parameters object to be passed to the [batchSynonyms](https://www.algolia.com/doc/api-reference/api-methods/batch-synonyms/) and [batchRules](https://www.algolia.com/doc/api-reference/api-methods/batch-rules/) respectively.
|
||||
- `<excludeReplicas>` | Optional | This is a boolean. When `true`, it will exclude the `replicas` setting when copying settings to the destination index. When `false`, it will copy the full settings object. Defaults to `false`.
|
||||
|
||||
##### Notes:
|
||||
|
||||
- When transferring synonyms and query rules, `forwardToReplicas`, `replaceExistingSynonyms`, and `clearExistingRules` params will default to false, unless you specify `<configParams>`.
|
||||
|
||||
### 15. Delete Indices Pattern | `deleteindicespattern`
|
||||
|
||||
##### Description:
|
||||
|
||||
Delete multiple indices at once (main or replica indices included) using a regular expression.
|
||||
|
||||
##### Usage:
|
||||
|
||||
```shell
|
||||
algolia deleteindicespattern -a <algoliaAppId> -k <algoliaApiKey> -r '<regexp>' -x <dryrun>
|
||||
```
|
||||
|
||||
##### Options:
|
||||
|
||||
- `<algoliaAppId>` | Required
|
||||
- `<algoliaApiKey>` | Required
|
||||
- `<regexp>` | Required | Provide regexes without the leading and trailing slashes
|
||||
- `<dryrun>` | Required | This is a boolean. When `true` it will run in dry mode and show what will be deleted, when `false` it will really delete the indices. Careful!
|
||||
|
||||
##### Notes:
|
||||
|
||||
- The command handles replicas. First it update the settings of all main indices removing any replica that will match the regular expression. Then it will delete all matching indices (main and replica indices).
|
||||
|
||||
##### Example:
|
||||
|
||||
```shell
|
||||
algolia deleteindicespattern -a someAppId -k someApiKey -r '^staging__' -x false
|
||||
```
|
||||
|
||||
This will delete all indices of the application that are starting with "staging__".
|
||||
|
||||
### 16. Transform Lines | `transformlines`
|
||||
|
||||
##### Description:
|
||||
|
||||
Transform a file line-by-line.
|
||||
|
||||
##### Usage:
|
||||
|
||||
```shell
|
||||
algolia transformlines -s <sourceFilepath> -o <outputPath> -t <transformationFilepath>
|
||||
```
|
||||
|
||||
##### Options:
|
||||
|
||||
- `<sourceFilepath>` | Required | Path to a single `.js` or `.json` file OR a directory of such files.
|
||||
- `<outputPath>` | Optional | Path to an existing local directory where output files will be saved (saved output filenames will match corresponding source filenames). If no output path is provided, defaults to current working directory.
|
||||
- `<transformationFilepath>` | Optional | Path to file that exports a function which (1) takes a line string, and (2) returns a transformed line string.
|
||||
|
||||
##### Example use case:
|
||||
|
||||
Mapping each line of input file to a new output file.
|
||||
|
||||
Originally designed for converting `.json-seq` files to regular comma separated JSON arrays, in order to index them with the `import` cli tool.
|
||||
|
||||
##### Example Transformation File:
|
||||
|
||||
Let's say we had this source JSON file:
|
||||
```json
|
||||
[
|
||||
{"id":1,"color":"blue"},
|
||||
{"id":2,"color":"red"},
|
||||
{"id":3,"color":"green"}
|
||||
]
|
||||
```
|
||||
and we wanted to filter out any objects that didn't have a "color" value of "blue". In this case, our transformations function could be something like this:
|
||||
```javascript
|
||||
module.exports = (line) => {
|
||||
if (line === '[' || line === ']') {
|
||||
return line;
|
||||
} else if (line.includes('"color":"blue"')) {
|
||||
return line;
|
||||
} else {
|
||||
return '\n';
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
##### Notes:
|
||||
|
||||
- `<outputPath>` must be a directory.
|
||||
- Running `transformlines` command without providing optional `<transformationFilepath>` param will cause it to assume it's parsing a `.json-seq` file; thus, it will apply the `defaultLineTransformation` method in `transformLines.js` to each line. This checks each line for the ASCII Record Separator character `\u001e` and replaces it with a `,`. It will _also_ cause it to enclose the whole file in "[" and "]" square brackets to make it a valid JS array. Providing a custom transformation method via the optional `<transformationFilepath>` param will make it exclusively run your transformation function instead of the default one (and in this case it will also omit adding enclosing square brackets).
|
||||
|
||||
### 14. Examples | `examples`
|
||||
|
||||
##### Description:
|
||||
|
||||
Display command usage examples.
|
||||
|
||||
##### Usage:
|
||||
|
||||
```shell
|
||||
algolia examples
|
||||
```
|
||||
|
||||
##### Notes:
|
||||
|
||||
- See equivalent list of [examples below](#examples).
|
||||
|
||||
# Examples
|
||||
```bash
|
||||
$ algolia --help
|
||||
|
||||
$ algolia --version
|
||||
|
||||
$ algolia interactive
|
||||
|
||||
$ algolia search -a EXAMPLE_APP_ID -k EXAMPLE_API_KEY -n EXAMPLE_INDEX_NAME -q 'example query' -p '{"facetFilters":["category:book"]}' -o ~/Desktop/results.json
|
||||
|
||||
$ algolia import -s ~/Desktop/example_source_directory/ -a EXAMPLE_APP_ID -k EXAMPLE_API_KEY -n EXAMPLE_INDEX_NAME -b 5000 -t ~/Desktop/example_transformations.js -m 4 -p '{"delimiter":[":"]}'
|
||||
|
||||
$ algolia export -a EXAMPLE_APP_ID -k EXAMPLE_API_KEY -n EXAMPLE_INDEX_NAME -o ~/Desktop/example_output_folder/ -p '{"filters":["category:book"]}'
|
||||
|
||||
$ algolia getsettings -a EXAMPLE_APP_ID -k EXAMPLE_API_KEY -n EXAMPLE_INDEX_NAME
|
||||
|
||||
$ algolia setsettings -a EXAMPLE_APP_ID -k EXAMPLE_API_KEY -n EXAMPLE_INDEX_NAME -s ~/Desktop/example_settings.json -p '{"forwardToReplicas":true}'
|
||||
|
||||
$ algolia addrules -a EXAMPLE_APP_ID -k EXAMPLE_API_KEY -n EXAMPLE_INDEX_NAME -s ~/Desktop/example_rules.json -p '{"forwardToReplicas":false,"clearExistingRules":true}'
|
||||
|
||||
$ algolia exportrules -a EXAMPLE_APP_ID -k EXAMPLE_API_KEY -n EXAMPLE_INDEX_NAME -o ~/Desktop/example_rules.json
|
||||
|
||||
$ algolia addsynonyms -a EXAMPLE_APP_ID -k EXAMPLE_API_KEY -n EXAMPLE_INDEX_NAME -s ~/Desktop/example_synonyms.json -p '{"forwardToReplicas":true,"clearExistingSynonyms":true}'
|
||||
|
||||
$ algolia exportsynonyms -a EXAMPLE_APP_ID -k EXAMPLE_API_KEY -n EXAMPLE_INDEX_NAME -o ~/Desktop/example_synonyms.json
|
||||
|
||||
$ algolia transferindex -a EXAMPLE_SOURCE_APP_ID -k EXAMPLE_SOURCE_API_KEY -n EXAMPLE_SOURCE_INDEX_NAME -d EXAMPLE_DESTINATION_APP_ID -y EXAMPLE_DESTINATION_API_KEY -i EXAMPLE_DESTINATION_INDEX_NAME -t ~/Desktop/example_transformations.js -e true
|
||||
|
||||
$ algolia transferindexconfig -a EXAMPLE_SOURCE_APP_ID -k EXAMPLE_SOURCE_API_KEY -n EXAMPLE_SOURCE_INDEX_NAME -d EXAMPLE_DESTINATION_APP_ID -y EXAMPLE_DESTINATION_API_KEY -i EXAMPLE_DESTINATION_INDEX_NAME -p '{"batchSynonymsParams":{"forwardToReplicas":true,"replaceExistingSynonyms":true},"batchRulesParams":{"forwardToReplicas":true,"clearExistingRules":true}}' -e true
|
||||
|
||||
$ algolia deleteindicespattern -a EXAMPLE_APP_ID -k EXAMPLE_API_KEY -r '^regex' -x true
|
||||
|
||||
$ algolia transformlines -s ~/Desktop/example_source_file.json -o ~/Desktop/example_output_folder/ -t ~/Desktop/example_transformations.js
|
||||
|
||||
$ algolia examples
|
||||
```
|
||||
|
||||
# Contribute
|
||||
|
||||
## Requirements
|
||||
|
||||
- Node: `brew install node` or [Node docs](https://nodejs.org/en/)
|
||||
- Yarn: `brew install yarn` or [Yarn docs](https://yarnpkg.com/lang/en/)
|
||||
|
||||
## Install
|
||||
|
||||
- Clone repo.
|
||||
- `yarn install`
|
||||
- Create `.env` file in project root and assign environment variables as listed [below](#environment-variables).
|
||||
|
||||
## Environment variables
|
||||
|
||||
- `ALGOLIA_TEST_APP_ID`
|
||||
- `ALGOLIA_TEST_API_KEY`
|
||||
- `ALGOLIA_TEST_INDEX_NAME`
|
||||
- `ALGOLIA_TEST_ALT_APP_ID`
|
||||
- `ALGOLIA_TEST_ALT_API_KEY`
|
||||
|
||||
## Develop
|
||||
- Run `node index.js <command_name> [options]` to test various commands/options.
|
||||
- Write code!
|
||||
- Please use [git-flow](https://github.com/nvie/gitflow) and commit your changes on a feature branch, rebase it on develop branch before finishing the feature, then issue pull request to develop branch
|
||||
|
||||
## Tests
|
||||
- `yarn test` to run full test suite locally
|
||||
- `yarn test:unit` to run unit test suite only
|
||||
- `yarn test:unit:watch` to run unit test suite with interactive `--watch` flag
|
||||
- `yarn test:integration` to run integration test suite only
|
||||
|
||||
## Lint
|
||||
- `yarn lint` to run eslint
|
||||
- `yarn lint:fix` to run eslint with --fix flag
|
||||
202
themes/keepit/node_modules/@ampproject/remapping/LICENSE
generated
vendored
Normal file
202
themes/keepit/node_modules/@ampproject/remapping/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2019 Google LLC
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
218
themes/keepit/node_modules/@ampproject/remapping/README.md
generated
vendored
Normal file
218
themes/keepit/node_modules/@ampproject/remapping/README.md
generated
vendored
Normal file
@@ -0,0 +1,218 @@
|
||||
# @ampproject/remapping
|
||||
|
||||
> Remap sequential sourcemaps through transformations to point at the original source code
|
||||
|
||||
Remapping allows you to take the sourcemaps generated through transforming your code and "remap"
|
||||
them to the original source locations. Think "my minified code, transformed with babel and bundled
|
||||
with webpack", all pointing to the correct location in your original source code.
|
||||
|
||||
With remapping, none of your source code transformations need to be aware of the input's sourcemap,
|
||||
they only need to generate an output sourcemap. This greatly simplifies building custom
|
||||
transformations (think a find-and-replace).
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install @ampproject/remapping
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```typescript
|
||||
function remapping(
|
||||
map: SourceMap | SourceMap[],
|
||||
loader: (file: string, ctx: LoaderContext) => (SourceMap | null | undefined),
|
||||
options?: { excludeContent: boolean, decodedMappings: boolean }
|
||||
): SourceMap;
|
||||
|
||||
// LoaderContext gives the loader the importing sourcemap, tree depth, the ability to override the
|
||||
// "source" location (where child sources are resolved relative to, or the location of original
|
||||
// source), and the ability to override the "content" of an original source for inclusion in the
|
||||
// output sourcemap.
|
||||
type LoaderContext = {
|
||||
readonly importer: string;
|
||||
readonly depth: number;
|
||||
source: string;
|
||||
content: string | null | undefined;
|
||||
}
|
||||
```
|
||||
|
||||
`remapping` takes the final output sourcemap, and a `loader` function. For every source file pointer
|
||||
in the sourcemap, the `loader` will be called with the resolved path. If the path itself represents
|
||||
a transformed file (it has a sourcmap associated with it), then the `loader` should return that
|
||||
sourcemap. If not, the path will be treated as an original, untransformed source code.
|
||||
|
||||
```js
|
||||
// Babel transformed "helloworld.js" into "transformed.js"
|
||||
const transformedMap = JSON.stringify({
|
||||
file: 'transformed.js',
|
||||
// 1st column of 2nd line of output file translates into the 1st source
|
||||
// file, line 3, column 2
|
||||
mappings: ';CAEE',
|
||||
sources: ['helloworld.js'],
|
||||
version: 3,
|
||||
});
|
||||
|
||||
// Uglify minified "transformed.js" into "transformed.min.js"
|
||||
const minifiedTransformedMap = JSON.stringify({
|
||||
file: 'transformed.min.js',
|
||||
// 0th column of 1st line of output file translates into the 1st source
|
||||
// file, line 2, column 1.
|
||||
mappings: 'AACC',
|
||||
names: [],
|
||||
sources: ['transformed.js'],
|
||||
version: 3,
|
||||
});
|
||||
|
||||
const remapped = remapping(
|
||||
minifiedTransformedMap,
|
||||
(file, ctx) => {
|
||||
|
||||
// The "transformed.js" file is an transformed file.
|
||||
if (file === 'transformed.js') {
|
||||
// The root importer is empty.
|
||||
console.assert(ctx.importer === '');
|
||||
// The depth in the sourcemap tree we're currently loading.
|
||||
// The root `minifiedTransformedMap` is depth 0, and its source children are depth 1, etc.
|
||||
console.assert(ctx.depth === 1);
|
||||
|
||||
return transformedMap;
|
||||
}
|
||||
|
||||
// Loader will be called to load transformedMap's source file pointers as well.
|
||||
console.assert(file === 'helloworld.js');
|
||||
// `transformed.js`'s sourcemap points into `helloworld.js`.
|
||||
console.assert(ctx.importer === 'transformed.js');
|
||||
// This is a source child of `transformed`, which is a source child of `minifiedTransformedMap`.
|
||||
console.assert(ctx.depth === 2);
|
||||
return null;
|
||||
}
|
||||
);
|
||||
|
||||
console.log(remapped);
|
||||
// {
|
||||
// file: 'transpiled.min.js',
|
||||
// mappings: 'AAEE',
|
||||
// sources: ['helloworld.js'],
|
||||
// version: 3,
|
||||
// };
|
||||
```
|
||||
|
||||
In this example, `loader` will be called twice:
|
||||
|
||||
1. `"transformed.js"`, the first source file pointer in the `minifiedTransformedMap`. We return the
|
||||
associated sourcemap for it (its a transformed file, after all) so that sourcemap locations can
|
||||
be traced through it into the source files it represents.
|
||||
2. `"helloworld.js"`, our original, unmodified source code. This file does not have a sourcemap, so
|
||||
we return `null`.
|
||||
|
||||
The `remapped` sourcemap now points from `transformed.min.js` into locations in `helloworld.js`. If
|
||||
you were to read the `mappings`, it says "0th column of the first line output line points to the 1st
|
||||
column of the 2nd line of the file `helloworld.js`".
|
||||
|
||||
### Multiple transformations of a file
|
||||
|
||||
As a convenience, if you have multiple single-source transformations of a file, you may pass an
|
||||
array of sourcemap files in the order of most-recent transformation sourcemap first. Note that this
|
||||
changes the `importer` and `depth` of each call to our loader. So our above example could have been
|
||||
written as:
|
||||
|
||||
```js
|
||||
const remapped = remapping(
|
||||
[minifiedTransformedMap, transformedMap],
|
||||
() => null
|
||||
);
|
||||
|
||||
console.log(remapped);
|
||||
// {
|
||||
// file: 'transpiled.min.js',
|
||||
// mappings: 'AAEE',
|
||||
// sources: ['helloworld.js'],
|
||||
// version: 3,
|
||||
// };
|
||||
```
|
||||
|
||||
### Advanced control of the loading graph
|
||||
|
||||
#### `source`
|
||||
|
||||
The `source` property can overridden to any value to change the location of the current load. Eg,
|
||||
for an original source file, it allows us to change the location to the original source regardless
|
||||
of what the sourcemap source entry says. And for transformed files, it allows us to change the
|
||||
relative resolving location for child sources of the loaded sourcemap.
|
||||
|
||||
```js
|
||||
const remapped = remapping(
|
||||
minifiedTransformedMap,
|
||||
(file, ctx) => {
|
||||
|
||||
if (file === 'transformed.js') {
|
||||
// We pretend the transformed.js file actually exists in the 'src/' directory. When the nested
|
||||
// source files are loaded, they will now be relative to `src/`.
|
||||
ctx.source = 'src/transformed.js';
|
||||
return transformedMap;
|
||||
}
|
||||
|
||||
console.assert(file === 'src/helloworld.js');
|
||||
// We could futher change the source of this original file, eg, to be inside a nested directory
|
||||
// itself. This will be reflected in the remapped sourcemap.
|
||||
ctx.source = 'src/nested/transformed.js';
|
||||
return null;
|
||||
}
|
||||
);
|
||||
|
||||
console.log(remapped);
|
||||
// {
|
||||
// …,
|
||||
// sources: ['src/nested/helloworld.js'],
|
||||
// };
|
||||
```
|
||||
|
||||
|
||||
#### `content`
|
||||
|
||||
The `content` property can be overridden when we encounter an original source file. Eg, this allows
|
||||
you to manually provide the source content of the original file regardless of whether the
|
||||
`sourcesContent` field is present in the parent sourcemap. It can also be set to `null` to remove
|
||||
the source content.
|
||||
|
||||
```js
|
||||
const remapped = remapping(
|
||||
minifiedTransformedMap,
|
||||
(file, ctx) => {
|
||||
|
||||
if (file === 'transformed.js') {
|
||||
// transformedMap does not include a `sourcesContent` field, so usually the remapped sourcemap
|
||||
// would not include any `sourcesContent` values.
|
||||
return transformedMap;
|
||||
}
|
||||
|
||||
console.assert(file === 'helloworld.js');
|
||||
// We can read the file to provide the source content.
|
||||
ctx.content = fs.readFileSync(file, 'utf8');
|
||||
return null;
|
||||
}
|
||||
);
|
||||
|
||||
console.log(remapped);
|
||||
// {
|
||||
// …,
|
||||
// sourcesContent: [
|
||||
// 'console.log("Hello world!")',
|
||||
// ],
|
||||
// };
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
#### excludeContent
|
||||
|
||||
By default, `excludeContent` is `false`. Passing `{ excludeContent: true }` will exclude the
|
||||
`sourcesContent` field from the returned sourcemap. This is mainly useful when you want to reduce
|
||||
the size out the sourcemap.
|
||||
|
||||
#### decodedMappings
|
||||
|
||||
By default, `decodedMappings` is `false`. Passing `{ decodedMappings: true }` will leave the
|
||||
`mappings` field in a [decoded state](https://github.com/rich-harris/sourcemap-codec) instead of
|
||||
encoding into a VLQ string.
|
||||
204
themes/keepit/node_modules/@ampproject/remapping/dist/remapping.mjs
generated
vendored
Normal file
204
themes/keepit/node_modules/@ampproject/remapping/dist/remapping.mjs
generated
vendored
Normal file
@@ -0,0 +1,204 @@
|
||||
import { decodedMappings, traceSegment, TraceMap } from '@jridgewell/trace-mapping';
|
||||
import { GenMapping, addSegment, setSourceContent, decodedMap, encodedMap } from '@jridgewell/gen-mapping';
|
||||
|
||||
const SOURCELESS_MAPPING = {
|
||||
source: null,
|
||||
column: null,
|
||||
line: null,
|
||||
name: null,
|
||||
content: null,
|
||||
};
|
||||
const EMPTY_SOURCES = [];
|
||||
function Source(map, sources, source, content) {
|
||||
return {
|
||||
map,
|
||||
sources,
|
||||
source,
|
||||
content,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* MapSource represents a single sourcemap, with the ability to trace mappings into its child nodes
|
||||
* (which may themselves be SourceMapTrees).
|
||||
*/
|
||||
function MapSource(map, sources) {
|
||||
return Source(map, sources, '', null);
|
||||
}
|
||||
/**
|
||||
* A "leaf" node in the sourcemap tree, representing an original, unmodified source file. Recursive
|
||||
* segment tracing ends at the `OriginalSource`.
|
||||
*/
|
||||
function OriginalSource(source, content) {
|
||||
return Source(null, EMPTY_SOURCES, source, content);
|
||||
}
|
||||
/**
|
||||
* traceMappings is only called on the root level SourceMapTree, and begins the process of
|
||||
* resolving each mapping in terms of the original source files.
|
||||
*/
|
||||
function traceMappings(tree) {
|
||||
const gen = new GenMapping({ file: tree.map.file });
|
||||
const { sources: rootSources, map } = tree;
|
||||
const rootNames = map.names;
|
||||
const rootMappings = decodedMappings(map);
|
||||
for (let i = 0; i < rootMappings.length; i++) {
|
||||
const segments = rootMappings[i];
|
||||
let lastSource = null;
|
||||
let lastSourceLine = null;
|
||||
let lastSourceColumn = null;
|
||||
for (let j = 0; j < segments.length; j++) {
|
||||
const segment = segments[j];
|
||||
const genCol = segment[0];
|
||||
let traced = SOURCELESS_MAPPING;
|
||||
// 1-length segments only move the current generated column, there's no source information
|
||||
// to gather from it.
|
||||
if (segment.length !== 1) {
|
||||
const source = rootSources[segment[1]];
|
||||
traced = originalPositionFor(source, segment[2], segment[3], segment.length === 5 ? rootNames[segment[4]] : '');
|
||||
// If the trace is invalid, then the trace ran into a sourcemap that doesn't contain a
|
||||
// respective segment into an original source.
|
||||
if (traced == null)
|
||||
continue;
|
||||
}
|
||||
// So we traced a segment down into its original source file. Now push a
|
||||
// new segment pointing to this location.
|
||||
const { column, line, name, content, source } = traced;
|
||||
if (line === lastSourceLine && column === lastSourceColumn && source === lastSource) {
|
||||
continue;
|
||||
}
|
||||
lastSourceLine = line;
|
||||
lastSourceColumn = column;
|
||||
lastSource = source;
|
||||
// Sigh, TypeScript can't figure out source/line/column are either all null, or all non-null...
|
||||
addSegment(gen, i, genCol, source, line, column, name);
|
||||
if (content != null)
|
||||
setSourceContent(gen, source, content);
|
||||
}
|
||||
}
|
||||
return gen;
|
||||
}
|
||||
/**
|
||||
* originalPositionFor is only called on children SourceMapTrees. It recurses down into its own
|
||||
* child SourceMapTrees, until we find the original source map.
|
||||
*/
|
||||
function originalPositionFor(source, line, column, name) {
|
||||
if (!source.map) {
|
||||
return { column, line, name, source: source.source, content: source.content };
|
||||
}
|
||||
const segment = traceSegment(source.map, line, column);
|
||||
// If we couldn't find a segment, then this doesn't exist in the sourcemap.
|
||||
if (segment == null)
|
||||
return null;
|
||||
// 1-length segments only move the current generated column, there's no source information
|
||||
// to gather from it.
|
||||
if (segment.length === 1)
|
||||
return SOURCELESS_MAPPING;
|
||||
return originalPositionFor(source.sources[segment[1]], segment[2], segment[3], segment.length === 5 ? source.map.names[segment[4]] : name);
|
||||
}
|
||||
|
||||
function asArray(value) {
|
||||
if (Array.isArray(value))
|
||||
return value;
|
||||
return [value];
|
||||
}
|
||||
/**
|
||||
* Recursively builds a tree structure out of sourcemap files, with each node
|
||||
* being either an `OriginalSource` "leaf" or a `SourceMapTree` composed of
|
||||
* `OriginalSource`s and `SourceMapTree`s.
|
||||
*
|
||||
* Every sourcemap is composed of a collection of source files and mappings
|
||||
* into locations of those source files. When we generate a `SourceMapTree` for
|
||||
* the sourcemap, we attempt to load each source file's own sourcemap. If it
|
||||
* does not have an associated sourcemap, it is considered an original,
|
||||
* unmodified source file.
|
||||
*/
|
||||
function buildSourceMapTree(input, loader) {
|
||||
const maps = asArray(input).map((m) => new TraceMap(m, ''));
|
||||
const map = maps.pop();
|
||||
for (let i = 0; i < maps.length; i++) {
|
||||
if (maps[i].sources.length > 1) {
|
||||
throw new Error(`Transformation map ${i} must have exactly one source file.\n` +
|
||||
'Did you specify these with the most recent transformation maps first?');
|
||||
}
|
||||
}
|
||||
let tree = build(map, loader, '', 0);
|
||||
for (let i = maps.length - 1; i >= 0; i--) {
|
||||
tree = MapSource(maps[i], [tree]);
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
function build(map, loader, importer, importerDepth) {
|
||||
const { resolvedSources, sourcesContent } = map;
|
||||
const depth = importerDepth + 1;
|
||||
const children = resolvedSources.map((sourceFile, i) => {
|
||||
// The loading context gives the loader more information about why this file is being loaded
|
||||
// (eg, from which importer). It also allows the loader to override the location of the loaded
|
||||
// sourcemap/original source, or to override the content in the sourcesContent field if it's
|
||||
// an unmodified source file.
|
||||
const ctx = {
|
||||
importer,
|
||||
depth,
|
||||
source: sourceFile || '',
|
||||
content: undefined,
|
||||
};
|
||||
// Use the provided loader callback to retrieve the file's sourcemap.
|
||||
// TODO: We should eventually support async loading of sourcemap files.
|
||||
const sourceMap = loader(ctx.source, ctx);
|
||||
const { source, content } = ctx;
|
||||
// If there is a sourcemap, then we need to recurse into it to load its source files.
|
||||
if (sourceMap)
|
||||
return build(new TraceMap(sourceMap, source), loader, source, depth);
|
||||
// Else, it's an an unmodified source file.
|
||||
// The contents of this unmodified source file can be overridden via the loader context,
|
||||
// allowing it to be explicitly null or a string. If it remains undefined, we fall back to
|
||||
// the importing sourcemap's `sourcesContent` field.
|
||||
const sourceContent = content !== undefined ? content : sourcesContent ? sourcesContent[i] : null;
|
||||
return OriginalSource(source, sourceContent);
|
||||
});
|
||||
return MapSource(map, children);
|
||||
}
|
||||
|
||||
/**
|
||||
* A SourceMap v3 compatible sourcemap, which only includes fields that were
|
||||
* provided to it.
|
||||
*/
|
||||
class SourceMap {
|
||||
constructor(map, options) {
|
||||
const out = options.decodedMappings ? decodedMap(map) : encodedMap(map);
|
||||
this.version = out.version; // SourceMap spec says this should be first.
|
||||
this.file = out.file;
|
||||
this.mappings = out.mappings;
|
||||
this.names = out.names;
|
||||
this.sourceRoot = out.sourceRoot;
|
||||
this.sources = out.sources;
|
||||
if (!options.excludeContent) {
|
||||
this.sourcesContent = out.sourcesContent;
|
||||
}
|
||||
}
|
||||
toString() {
|
||||
return JSON.stringify(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Traces through all the mappings in the root sourcemap, through the sources
|
||||
* (and their sourcemaps), all the way back to the original source location.
|
||||
*
|
||||
* `loader` will be called every time we encounter a source file. If it returns
|
||||
* a sourcemap, we will recurse into that sourcemap to continue the trace. If
|
||||
* it returns a falsey value, that source file is treated as an original,
|
||||
* unmodified source file.
|
||||
*
|
||||
* Pass `excludeContent` to exclude any self-containing source file content
|
||||
* from the output sourcemap.
|
||||
*
|
||||
* Pass `decodedMappings` to receive a SourceMap with decoded (instead of
|
||||
* VLQ encoded) mappings.
|
||||
*/
|
||||
function remapping(input, loader, options) {
|
||||
const opts = typeof options === 'object' ? options : { excludeContent: !!options, decodedMappings: false };
|
||||
const tree = buildSourceMapTree(input, loader);
|
||||
return new SourceMap(traceMappings(tree), opts);
|
||||
}
|
||||
|
||||
export { remapping as default };
|
||||
//# sourceMappingURL=remapping.mjs.map
|
||||
1
themes/keepit/node_modules/@ampproject/remapping/dist/remapping.mjs.map
generated
vendored
Normal file
1
themes/keepit/node_modules/@ampproject/remapping/dist/remapping.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
209
themes/keepit/node_modules/@ampproject/remapping/dist/remapping.umd.js
generated
vendored
Normal file
209
themes/keepit/node_modules/@ampproject/remapping/dist/remapping.umd.js
generated
vendored
Normal file
@@ -0,0 +1,209 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@jridgewell/trace-mapping'), require('@jridgewell/gen-mapping')) :
|
||||
typeof define === 'function' && define.amd ? define(['@jridgewell/trace-mapping', '@jridgewell/gen-mapping'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.remapping = factory(global.traceMapping, global.genMapping));
|
||||
})(this, (function (traceMapping, genMapping) { 'use strict';
|
||||
|
||||
const SOURCELESS_MAPPING = {
|
||||
source: null,
|
||||
column: null,
|
||||
line: null,
|
||||
name: null,
|
||||
content: null,
|
||||
};
|
||||
const EMPTY_SOURCES = [];
|
||||
function Source(map, sources, source, content) {
|
||||
return {
|
||||
map,
|
||||
sources,
|
||||
source,
|
||||
content,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* MapSource represents a single sourcemap, with the ability to trace mappings into its child nodes
|
||||
* (which may themselves be SourceMapTrees).
|
||||
*/
|
||||
function MapSource(map, sources) {
|
||||
return Source(map, sources, '', null);
|
||||
}
|
||||
/**
|
||||
* A "leaf" node in the sourcemap tree, representing an original, unmodified source file. Recursive
|
||||
* segment tracing ends at the `OriginalSource`.
|
||||
*/
|
||||
function OriginalSource(source, content) {
|
||||
return Source(null, EMPTY_SOURCES, source, content);
|
||||
}
|
||||
/**
|
||||
* traceMappings is only called on the root level SourceMapTree, and begins the process of
|
||||
* resolving each mapping in terms of the original source files.
|
||||
*/
|
||||
function traceMappings(tree) {
|
||||
const gen = new genMapping.GenMapping({ file: tree.map.file });
|
||||
const { sources: rootSources, map } = tree;
|
||||
const rootNames = map.names;
|
||||
const rootMappings = traceMapping.decodedMappings(map);
|
||||
for (let i = 0; i < rootMappings.length; i++) {
|
||||
const segments = rootMappings[i];
|
||||
let lastSource = null;
|
||||
let lastSourceLine = null;
|
||||
let lastSourceColumn = null;
|
||||
for (let j = 0; j < segments.length; j++) {
|
||||
const segment = segments[j];
|
||||
const genCol = segment[0];
|
||||
let traced = SOURCELESS_MAPPING;
|
||||
// 1-length segments only move the current generated column, there's no source information
|
||||
// to gather from it.
|
||||
if (segment.length !== 1) {
|
||||
const source = rootSources[segment[1]];
|
||||
traced = originalPositionFor(source, segment[2], segment[3], segment.length === 5 ? rootNames[segment[4]] : '');
|
||||
// If the trace is invalid, then the trace ran into a sourcemap that doesn't contain a
|
||||
// respective segment into an original source.
|
||||
if (traced == null)
|
||||
continue;
|
||||
}
|
||||
// So we traced a segment down into its original source file. Now push a
|
||||
// new segment pointing to this location.
|
||||
const { column, line, name, content, source } = traced;
|
||||
if (line === lastSourceLine && column === lastSourceColumn && source === lastSource) {
|
||||
continue;
|
||||
}
|
||||
lastSourceLine = line;
|
||||
lastSourceColumn = column;
|
||||
lastSource = source;
|
||||
// Sigh, TypeScript can't figure out source/line/column are either all null, or all non-null...
|
||||
genMapping.addSegment(gen, i, genCol, source, line, column, name);
|
||||
if (content != null)
|
||||
genMapping.setSourceContent(gen, source, content);
|
||||
}
|
||||
}
|
||||
return gen;
|
||||
}
|
||||
/**
|
||||
* originalPositionFor is only called on children SourceMapTrees. It recurses down into its own
|
||||
* child SourceMapTrees, until we find the original source map.
|
||||
*/
|
||||
function originalPositionFor(source, line, column, name) {
|
||||
if (!source.map) {
|
||||
return { column, line, name, source: source.source, content: source.content };
|
||||
}
|
||||
const segment = traceMapping.traceSegment(source.map, line, column);
|
||||
// If we couldn't find a segment, then this doesn't exist in the sourcemap.
|
||||
if (segment == null)
|
||||
return null;
|
||||
// 1-length segments only move the current generated column, there's no source information
|
||||
// to gather from it.
|
||||
if (segment.length === 1)
|
||||
return SOURCELESS_MAPPING;
|
||||
return originalPositionFor(source.sources[segment[1]], segment[2], segment[3], segment.length === 5 ? source.map.names[segment[4]] : name);
|
||||
}
|
||||
|
||||
function asArray(value) {
|
||||
if (Array.isArray(value))
|
||||
return value;
|
||||
return [value];
|
||||
}
|
||||
/**
|
||||
* Recursively builds a tree structure out of sourcemap files, with each node
|
||||
* being either an `OriginalSource` "leaf" or a `SourceMapTree` composed of
|
||||
* `OriginalSource`s and `SourceMapTree`s.
|
||||
*
|
||||
* Every sourcemap is composed of a collection of source files and mappings
|
||||
* into locations of those source files. When we generate a `SourceMapTree` for
|
||||
* the sourcemap, we attempt to load each source file's own sourcemap. If it
|
||||
* does not have an associated sourcemap, it is considered an original,
|
||||
* unmodified source file.
|
||||
*/
|
||||
function buildSourceMapTree(input, loader) {
|
||||
const maps = asArray(input).map((m) => new traceMapping.TraceMap(m, ''));
|
||||
const map = maps.pop();
|
||||
for (let i = 0; i < maps.length; i++) {
|
||||
if (maps[i].sources.length > 1) {
|
||||
throw new Error(`Transformation map ${i} must have exactly one source file.\n` +
|
||||
'Did you specify these with the most recent transformation maps first?');
|
||||
}
|
||||
}
|
||||
let tree = build(map, loader, '', 0);
|
||||
for (let i = maps.length - 1; i >= 0; i--) {
|
||||
tree = MapSource(maps[i], [tree]);
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
function build(map, loader, importer, importerDepth) {
|
||||
const { resolvedSources, sourcesContent } = map;
|
||||
const depth = importerDepth + 1;
|
||||
const children = resolvedSources.map((sourceFile, i) => {
|
||||
// The loading context gives the loader more information about why this file is being loaded
|
||||
// (eg, from which importer). It also allows the loader to override the location of the loaded
|
||||
// sourcemap/original source, or to override the content in the sourcesContent field if it's
|
||||
// an unmodified source file.
|
||||
const ctx = {
|
||||
importer,
|
||||
depth,
|
||||
source: sourceFile || '',
|
||||
content: undefined,
|
||||
};
|
||||
// Use the provided loader callback to retrieve the file's sourcemap.
|
||||
// TODO: We should eventually support async loading of sourcemap files.
|
||||
const sourceMap = loader(ctx.source, ctx);
|
||||
const { source, content } = ctx;
|
||||
// If there is a sourcemap, then we need to recurse into it to load its source files.
|
||||
if (sourceMap)
|
||||
return build(new traceMapping.TraceMap(sourceMap, source), loader, source, depth);
|
||||
// Else, it's an an unmodified source file.
|
||||
// The contents of this unmodified source file can be overridden via the loader context,
|
||||
// allowing it to be explicitly null or a string. If it remains undefined, we fall back to
|
||||
// the importing sourcemap's `sourcesContent` field.
|
||||
const sourceContent = content !== undefined ? content : sourcesContent ? sourcesContent[i] : null;
|
||||
return OriginalSource(source, sourceContent);
|
||||
});
|
||||
return MapSource(map, children);
|
||||
}
|
||||
|
||||
/**
|
||||
* A SourceMap v3 compatible sourcemap, which only includes fields that were
|
||||
* provided to it.
|
||||
*/
|
||||
class SourceMap {
|
||||
constructor(map, options) {
|
||||
const out = options.decodedMappings ? genMapping.decodedMap(map) : genMapping.encodedMap(map);
|
||||
this.version = out.version; // SourceMap spec says this should be first.
|
||||
this.file = out.file;
|
||||
this.mappings = out.mappings;
|
||||
this.names = out.names;
|
||||
this.sourceRoot = out.sourceRoot;
|
||||
this.sources = out.sources;
|
||||
if (!options.excludeContent) {
|
||||
this.sourcesContent = out.sourcesContent;
|
||||
}
|
||||
}
|
||||
toString() {
|
||||
return JSON.stringify(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Traces through all the mappings in the root sourcemap, through the sources
|
||||
* (and their sourcemaps), all the way back to the original source location.
|
||||
*
|
||||
* `loader` will be called every time we encounter a source file. If it returns
|
||||
* a sourcemap, we will recurse into that sourcemap to continue the trace. If
|
||||
* it returns a falsey value, that source file is treated as an original,
|
||||
* unmodified source file.
|
||||
*
|
||||
* Pass `excludeContent` to exclude any self-containing source file content
|
||||
* from the output sourcemap.
|
||||
*
|
||||
* Pass `decodedMappings` to receive a SourceMap with decoded (instead of
|
||||
* VLQ encoded) mappings.
|
||||
*/
|
||||
function remapping(input, loader, options) {
|
||||
const opts = typeof options === 'object' ? options : { excludeContent: !!options, decodedMappings: false };
|
||||
const tree = buildSourceMapTree(input, loader);
|
||||
return new SourceMap(traceMappings(tree), opts);
|
||||
}
|
||||
|
||||
return remapping;
|
||||
|
||||
}));
|
||||
//# sourceMappingURL=remapping.umd.js.map
|
||||
1
themes/keepit/node_modules/@ampproject/remapping/dist/remapping.umd.js.map
generated
vendored
Normal file
1
themes/keepit/node_modules/@ampproject/remapping/dist/remapping.umd.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
14
themes/keepit/node_modules/@ampproject/remapping/dist/types/build-source-map-tree.d.ts
generated
vendored
Normal file
14
themes/keepit/node_modules/@ampproject/remapping/dist/types/build-source-map-tree.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import type { MapSource as MapSourceType } from './source-map-tree';
|
||||
import type { SourceMapInput, SourceMapLoader } from './types';
|
||||
/**
|
||||
* Recursively builds a tree structure out of sourcemap files, with each node
|
||||
* being either an `OriginalSource` "leaf" or a `SourceMapTree` composed of
|
||||
* `OriginalSource`s and `SourceMapTree`s.
|
||||
*
|
||||
* Every sourcemap is composed of a collection of source files and mappings
|
||||
* into locations of those source files. When we generate a `SourceMapTree` for
|
||||
* the sourcemap, we attempt to load each source file's own sourcemap. If it
|
||||
* does not have an associated sourcemap, it is considered an original,
|
||||
* unmodified source file.
|
||||
*/
|
||||
export default function buildSourceMapTree(input: SourceMapInput | SourceMapInput[], loader: SourceMapLoader): MapSourceType;
|
||||
19
themes/keepit/node_modules/@ampproject/remapping/dist/types/remapping.d.ts
generated
vendored
Normal file
19
themes/keepit/node_modules/@ampproject/remapping/dist/types/remapping.d.ts
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import SourceMap from './source-map';
|
||||
import type { SourceMapInput, SourceMapLoader, Options } from './types';
|
||||
export type { SourceMapSegment, EncodedSourceMap, EncodedSourceMap as RawSourceMap, DecodedSourceMap, SourceMapInput, SourceMapLoader, LoaderContext, Options, } from './types';
|
||||
/**
|
||||
* Traces through all the mappings in the root sourcemap, through the sources
|
||||
* (and their sourcemaps), all the way back to the original source location.
|
||||
*
|
||||
* `loader` will be called every time we encounter a source file. If it returns
|
||||
* a sourcemap, we will recurse into that sourcemap to continue the trace. If
|
||||
* it returns a falsey value, that source file is treated as an original,
|
||||
* unmodified source file.
|
||||
*
|
||||
* Pass `excludeContent` to exclude any self-containing source file content
|
||||
* from the output sourcemap.
|
||||
*
|
||||
* Pass `decodedMappings` to receive a SourceMap with decoded (instead of
|
||||
* VLQ encoded) mappings.
|
||||
*/
|
||||
export default function remapping(input: SourceMapInput | SourceMapInput[], loader: SourceMapLoader, options?: boolean | Options): SourceMap;
|
||||
48
themes/keepit/node_modules/@ampproject/remapping/dist/types/source-map-tree.d.ts
generated
vendored
Normal file
48
themes/keepit/node_modules/@ampproject/remapping/dist/types/source-map-tree.d.ts
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
import { GenMapping } from '@jridgewell/gen-mapping';
|
||||
import type { TraceMap } from '@jridgewell/trace-mapping';
|
||||
export declare type SourceMapSegmentObject = {
|
||||
column: number;
|
||||
line: number;
|
||||
name: string;
|
||||
source: string;
|
||||
content: string | null;
|
||||
} | {
|
||||
column: null;
|
||||
line: null;
|
||||
name: null;
|
||||
source: null;
|
||||
content: null;
|
||||
};
|
||||
export declare type OriginalSource = {
|
||||
map: TraceMap;
|
||||
sources: Sources[];
|
||||
source: string;
|
||||
content: string | null;
|
||||
};
|
||||
export declare type MapSource = {
|
||||
map: TraceMap;
|
||||
sources: Sources[];
|
||||
source: string;
|
||||
content: string | null;
|
||||
};
|
||||
export declare type Sources = OriginalSource | MapSource;
|
||||
/**
|
||||
* MapSource represents a single sourcemap, with the ability to trace mappings into its child nodes
|
||||
* (which may themselves be SourceMapTrees).
|
||||
*/
|
||||
export declare function MapSource(map: TraceMap, sources: Sources[]): MapSource;
|
||||
/**
|
||||
* A "leaf" node in the sourcemap tree, representing an original, unmodified source file. Recursive
|
||||
* segment tracing ends at the `OriginalSource`.
|
||||
*/
|
||||
export declare function OriginalSource(source: string, content: string | null): OriginalSource;
|
||||
/**
|
||||
* traceMappings is only called on the root level SourceMapTree, and begins the process of
|
||||
* resolving each mapping in terms of the original source files.
|
||||
*/
|
||||
export declare function traceMappings(tree: MapSource): GenMapping;
|
||||
/**
|
||||
* originalPositionFor is only called on children SourceMapTrees. It recurses down into its own
|
||||
* child SourceMapTrees, until we find the original source map.
|
||||
*/
|
||||
export declare function originalPositionFor(source: Sources, line: number, column: number, name: string): SourceMapSegmentObject | null;
|
||||
17
themes/keepit/node_modules/@ampproject/remapping/dist/types/source-map.d.ts
generated
vendored
Normal file
17
themes/keepit/node_modules/@ampproject/remapping/dist/types/source-map.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import type { GenMapping } from '@jridgewell/gen-mapping';
|
||||
import type { DecodedSourceMap, EncodedSourceMap, Options } from './types';
|
||||
/**
|
||||
* A SourceMap v3 compatible sourcemap, which only includes fields that were
|
||||
* provided to it.
|
||||
*/
|
||||
export default class SourceMap {
|
||||
file?: string | null;
|
||||
mappings: EncodedSourceMap['mappings'] | DecodedSourceMap['mappings'];
|
||||
sourceRoot?: string;
|
||||
names: string[];
|
||||
sources: (string | null)[];
|
||||
sourcesContent?: (string | null)[];
|
||||
version: 3;
|
||||
constructor(map: GenMapping, options: Options);
|
||||
toString(): string;
|
||||
}
|
||||
14
themes/keepit/node_modules/@ampproject/remapping/dist/types/types.d.ts
generated
vendored
Normal file
14
themes/keepit/node_modules/@ampproject/remapping/dist/types/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import type { SourceMapInput } from '@jridgewell/trace-mapping';
|
||||
export type { SourceMapSegment, DecodedSourceMap, EncodedSourceMap, } from '@jridgewell/trace-mapping';
|
||||
export type { SourceMapInput };
|
||||
export declare type LoaderContext = {
|
||||
readonly importer: string;
|
||||
readonly depth: number;
|
||||
source: string;
|
||||
content: string | null | undefined;
|
||||
};
|
||||
export declare type SourceMapLoader = (file: string, ctx: LoaderContext) => SourceMapInput | null | undefined | void;
|
||||
export declare type Options = {
|
||||
excludeContent?: boolean;
|
||||
decodedMappings?: boolean;
|
||||
};
|
||||
63
themes/keepit/node_modules/@ampproject/remapping/package.json
generated
vendored
Normal file
63
themes/keepit/node_modules/@ampproject/remapping/package.json
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"name": "@ampproject/remapping",
|
||||
"version": "2.2.0",
|
||||
"description": "Remap sequential sourcemaps through transformations to point at the original source code",
|
||||
"keywords": [
|
||||
"source",
|
||||
"map",
|
||||
"remap"
|
||||
],
|
||||
"main": "dist/remapping.umd.js",
|
||||
"module": "dist/remapping.mjs",
|
||||
"typings": "dist/types/remapping.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"author": "Justin Ridgewell <jridgewell@google.com>",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/ampproject/remapping.git"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "run-s -n build:*",
|
||||
"build:rollup": "rollup -c rollup.config.js",
|
||||
"build:ts": "tsc --project tsconfig.build.json",
|
||||
"lint": "run-s -n lint:*",
|
||||
"lint:prettier": "npm run test:lint:prettier -- --write",
|
||||
"lint:ts": "npm run test:lint:ts -- --fix",
|
||||
"prebuild": "rm -rf dist",
|
||||
"prepublishOnly": "npm run preversion",
|
||||
"preversion": "run-s test build",
|
||||
"test": "run-s -n test:lint test:only",
|
||||
"test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
|
||||
"test:lint": "run-s -n test:lint:*",
|
||||
"test:lint:prettier": "prettier --check '{src,test}/**/*.ts'",
|
||||
"test:lint:ts": "eslint '{src,test}/**/*.ts'",
|
||||
"test:only": "jest --coverage",
|
||||
"test:watch": "jest --coverage --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-typescript": "8.3.2",
|
||||
"@types/jest": "27.4.1",
|
||||
"@typescript-eslint/eslint-plugin": "5.20.0",
|
||||
"@typescript-eslint/parser": "5.20.0",
|
||||
"eslint": "8.14.0",
|
||||
"eslint-config-prettier": "8.5.0",
|
||||
"jest": "27.5.1",
|
||||
"jest-config": "27.5.1",
|
||||
"npm-run-all": "4.1.5",
|
||||
"prettier": "2.6.2",
|
||||
"rollup": "2.70.2",
|
||||
"ts-jest": "27.1.4",
|
||||
"tslib": "2.4.0",
|
||||
"typescript": "4.6.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@jridgewell/gen-mapping": "^0.1.0",
|
||||
"@jridgewell/trace-mapping": "^0.3.9"
|
||||
}
|
||||
}
|
||||
22
themes/keepit/node_modules/@babel/cli/LICENSE
generated
vendored
Normal file
22
themes/keepit/node_modules/@babel/cli/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||
|
||||
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.
|
||||
19
themes/keepit/node_modules/@babel/cli/README.md
generated
vendored
Normal file
19
themes/keepit/node_modules/@babel/cli/README.md
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# @babel/cli
|
||||
|
||||
> Babel command line.
|
||||
|
||||
See our website [@babel/cli](https://babeljs.io/docs/en/babel-cli) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20cli%22+is%3Aopen) associated with this package.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/cli
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/cli --dev
|
||||
```
|
||||
3
themes/keepit/node_modules/@babel/cli/bin/babel-external-helpers.js
generated
vendored
Executable file
3
themes/keepit/node_modules/@babel/cli/bin/babel-external-helpers.js
generated
vendored
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
require("../lib/babel-external-helpers");
|
||||
3
themes/keepit/node_modules/@babel/cli/bin/babel.js
generated
vendored
Executable file
3
themes/keepit/node_modules/@babel/cli/bin/babel.js
generated
vendored
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
require("../lib/babel");
|
||||
1
themes/keepit/node_modules/@babel/cli/index.js
generated
vendored
Normal file
1
themes/keepit/node_modules/@babel/cli/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
throw new Error("Use the `@babel/core` package instead of `@babel/cli`.");
|
||||
43
themes/keepit/node_modules/@babel/cli/lib/babel-external-helpers.js
generated
vendored
Normal file
43
themes/keepit/node_modules/@babel/cli/lib/babel-external-helpers.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
|
||||
function _commander() {
|
||||
const data = require("commander");
|
||||
|
||||
_commander = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _core() {
|
||||
const data = require("@babel/core");
|
||||
|
||||
_core = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function collect(value, previousValue) {
|
||||
if (typeof value !== "string") return previousValue;
|
||||
const values = value.split(",");
|
||||
|
||||
if (previousValue) {
|
||||
previousValue.push(...values);
|
||||
return previousValue;
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
_commander().option("-l, --whitelist [whitelist]", "Whitelist of helpers to ONLY include", collect);
|
||||
|
||||
_commander().option("-t, --output-type [type]", "Type of output (global|umd|var)", "global");
|
||||
|
||||
_commander().usage("[options]");
|
||||
|
||||
_commander().parse(process.argv);
|
||||
|
||||
console.log((0, _core().buildExternalHelpers)(_commander().whitelist, _commander().outputType));
|
||||
284
themes/keepit/node_modules/@babel/cli/lib/babel/dir.js
generated
vendored
Normal file
284
themes/keepit/node_modules/@babel/cli/lib/babel/dir.js
generated
vendored
Normal file
@@ -0,0 +1,284 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = _default;
|
||||
|
||||
function _slash() {
|
||||
const data = require("slash");
|
||||
|
||||
_slash = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _path() {
|
||||
const data = require("path");
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _fs() {
|
||||
const data = require("fs");
|
||||
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var util = require("./util");
|
||||
|
||||
var watcher = require("./watcher");
|
||||
|
||||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
||||
|
||||
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
||||
|
||||
const FILE_TYPE = Object.freeze({
|
||||
NON_COMPILABLE: "NON_COMPILABLE",
|
||||
COMPILED: "COMPILED",
|
||||
IGNORED: "IGNORED",
|
||||
ERR_COMPILATION: "ERR_COMPILATION"
|
||||
});
|
||||
|
||||
function outputFileSync(filePath, data) {
|
||||
(((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "10.12") ? _fs().mkdirSync : require("make-dir").sync)(_path().dirname(filePath), {
|
||||
recursive: true
|
||||
});
|
||||
|
||||
_fs().writeFileSync(filePath, data);
|
||||
}
|
||||
|
||||
function _default(_x) {
|
||||
return _ref.apply(this, arguments);
|
||||
}
|
||||
|
||||
function _ref() {
|
||||
_ref = _asyncToGenerator(function* ({
|
||||
cliOptions,
|
||||
babelOptions
|
||||
}) {
|
||||
function write(_x2, _x3) {
|
||||
return _write.apply(this, arguments);
|
||||
}
|
||||
|
||||
function _write() {
|
||||
_write = _asyncToGenerator(function* (src, base) {
|
||||
let relative = _path().relative(base, src);
|
||||
|
||||
if (!util.isCompilableExtension(relative, cliOptions.extensions)) {
|
||||
return FILE_TYPE.NON_COMPILABLE;
|
||||
}
|
||||
|
||||
relative = util.withExtension(relative, cliOptions.keepFileExtension ? _path().extname(relative) : cliOptions.outFileExtension);
|
||||
const dest = getDest(relative, base);
|
||||
|
||||
try {
|
||||
const res = yield util.compile(src, Object.assign({}, babelOptions, {
|
||||
sourceFileName: _slash()(_path().relative(dest + "/..", src))
|
||||
}));
|
||||
if (!res) return FILE_TYPE.IGNORED;
|
||||
|
||||
if (res.map && babelOptions.sourceMaps && babelOptions.sourceMaps !== "inline") {
|
||||
const mapLoc = dest + ".map";
|
||||
res.code = util.addSourceMappingUrl(res.code, mapLoc);
|
||||
res.map.file = _path().basename(relative);
|
||||
outputFileSync(mapLoc, JSON.stringify(res.map));
|
||||
}
|
||||
|
||||
outputFileSync(dest, res.code);
|
||||
util.chmod(src, dest);
|
||||
|
||||
if (cliOptions.verbose) {
|
||||
console.log(_path().relative(process.cwd(), src) + " -> " + dest);
|
||||
}
|
||||
|
||||
return FILE_TYPE.COMPILED;
|
||||
} catch (err) {
|
||||
if (cliOptions.watch) {
|
||||
console.error(err);
|
||||
return FILE_TYPE.ERR_COMPILATION;
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
return _write.apply(this, arguments);
|
||||
}
|
||||
|
||||
function getDest(filename, base) {
|
||||
if (cliOptions.relative) {
|
||||
return _path().join(base, cliOptions.outDir, filename);
|
||||
}
|
||||
|
||||
return _path().join(cliOptions.outDir, filename);
|
||||
}
|
||||
|
||||
function handleFile(_x4, _x5) {
|
||||
return _handleFile.apply(this, arguments);
|
||||
}
|
||||
|
||||
function _handleFile() {
|
||||
_handleFile = _asyncToGenerator(function* (src, base) {
|
||||
const written = yield write(src, base);
|
||||
|
||||
if (cliOptions.copyFiles && written === FILE_TYPE.NON_COMPILABLE || cliOptions.copyIgnored && written === FILE_TYPE.IGNORED) {
|
||||
const filename = _path().relative(base, src);
|
||||
|
||||
const dest = getDest(filename, base);
|
||||
outputFileSync(dest, _fs().readFileSync(src));
|
||||
util.chmod(src, dest);
|
||||
}
|
||||
|
||||
return written === FILE_TYPE.COMPILED;
|
||||
});
|
||||
return _handleFile.apply(this, arguments);
|
||||
}
|
||||
|
||||
function handle(_x6) {
|
||||
return _handle.apply(this, arguments);
|
||||
}
|
||||
|
||||
function _handle() {
|
||||
_handle = _asyncToGenerator(function* (filenameOrDir) {
|
||||
if (!_fs().existsSync(filenameOrDir)) return 0;
|
||||
|
||||
const stat = _fs().statSync(filenameOrDir);
|
||||
|
||||
if (stat.isDirectory()) {
|
||||
const dirname = filenameOrDir;
|
||||
let count = 0;
|
||||
const files = util.readdir(dirname, cliOptions.includeDotfiles);
|
||||
|
||||
for (const filename of files) {
|
||||
const src = _path().join(dirname, filename);
|
||||
|
||||
const written = yield handleFile(src, dirname);
|
||||
if (written) count += 1;
|
||||
}
|
||||
|
||||
return count;
|
||||
} else {
|
||||
const filename = filenameOrDir;
|
||||
const written = yield handleFile(filename, _path().dirname(filename));
|
||||
return written ? 1 : 0;
|
||||
}
|
||||
});
|
||||
return _handle.apply(this, arguments);
|
||||
}
|
||||
|
||||
let compiledFiles = 0;
|
||||
let startTime = null;
|
||||
const logSuccess = util.debounce(function () {
|
||||
if (startTime === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
const diff = process.hrtime(startTime);
|
||||
console.log(`Successfully compiled ${compiledFiles} ${compiledFiles !== 1 ? "files" : "file"} with Babel (${diff[0] * 1e3 + Math.round(diff[1] / 1e6)}ms).`);
|
||||
compiledFiles = 0;
|
||||
startTime = null;
|
||||
}, 100);
|
||||
if (cliOptions.watch) watcher.enable({
|
||||
enableGlobbing: true
|
||||
});
|
||||
|
||||
if (!cliOptions.skipInitialBuild) {
|
||||
if (cliOptions.deleteDirOnStart) {
|
||||
util.deleteDir(cliOptions.outDir);
|
||||
}
|
||||
|
||||
(((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "10.12") ? _fs().mkdirSync : require("make-dir").sync)(cliOptions.outDir, {
|
||||
recursive: true
|
||||
});
|
||||
startTime = process.hrtime();
|
||||
|
||||
for (const filename of cliOptions.filenames) {
|
||||
compiledFiles += yield handle(filename);
|
||||
}
|
||||
|
||||
if (!cliOptions.quiet) {
|
||||
logSuccess();
|
||||
logSuccess.flush();
|
||||
}
|
||||
}
|
||||
|
||||
if (cliOptions.watch) {
|
||||
let processing = 0;
|
||||
const {
|
||||
filenames
|
||||
} = cliOptions;
|
||||
let getBase;
|
||||
|
||||
if (filenames.length === 1) {
|
||||
const base = filenames[0];
|
||||
|
||||
const absoluteBase = _path().resolve(base);
|
||||
|
||||
getBase = filename => {
|
||||
return filename === absoluteBase ? _path().dirname(base) : base;
|
||||
};
|
||||
} else {
|
||||
const filenameToBaseMap = new Map(filenames.map(filename => {
|
||||
const absoluteFilename = _path().resolve(filename);
|
||||
|
||||
return [absoluteFilename, _path().dirname(filename)];
|
||||
}));
|
||||
const absoluteFilenames = new Map(filenames.map(filename => {
|
||||
const absoluteFilename = _path().resolve(filename);
|
||||
|
||||
return [absoluteFilename, filename];
|
||||
}));
|
||||
|
||||
const {
|
||||
sep
|
||||
} = _path();
|
||||
|
||||
getBase = filename => {
|
||||
const base = filenameToBaseMap.get(filename);
|
||||
|
||||
if (base !== undefined) {
|
||||
return base;
|
||||
}
|
||||
|
||||
for (const [absoluteFilenameOrDir, relative] of absoluteFilenames) {
|
||||
if (filename.startsWith(absoluteFilenameOrDir + sep)) {
|
||||
filenameToBaseMap.set(filename, relative);
|
||||
return relative;
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
};
|
||||
}
|
||||
|
||||
filenames.forEach(filenameOrDir => {
|
||||
watcher.watch(filenameOrDir);
|
||||
});
|
||||
watcher.onFilesChange(_asyncToGenerator(function* (filenames) {
|
||||
processing++;
|
||||
if (startTime === null) startTime = process.hrtime();
|
||||
|
||||
try {
|
||||
const written = yield Promise.all(filenames.map(filename => handleFile(filename, getBase(filename))));
|
||||
compiledFiles += written.filter(Boolean).length;
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
processing--;
|
||||
if (processing === 0 && !cliOptions.quiet) logSuccess();
|
||||
}));
|
||||
}
|
||||
});
|
||||
return _ref.apply(this, arguments);
|
||||
}
|
||||
272
themes/keepit/node_modules/@babel/cli/lib/babel/file.js
generated
vendored
Normal file
272
themes/keepit/node_modules/@babel/cli/lib/babel/file.js
generated
vendored
Normal file
@@ -0,0 +1,272 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = _default;
|
||||
|
||||
function _convertSourceMap() {
|
||||
const data = require("convert-source-map");
|
||||
|
||||
_convertSourceMap = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _traceMapping() {
|
||||
const data = require("@jridgewell/trace-mapping");
|
||||
|
||||
_traceMapping = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _slash() {
|
||||
const data = require("slash");
|
||||
|
||||
_slash = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _path() {
|
||||
const data = require("path");
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _fs() {
|
||||
const data = require("fs");
|
||||
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var util = require("./util");
|
||||
|
||||
var watcher = require("./watcher");
|
||||
|
||||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
||||
|
||||
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
||||
|
||||
function _default(_x) {
|
||||
return _ref.apply(this, arguments);
|
||||
}
|
||||
|
||||
function _ref() {
|
||||
_ref = _asyncToGenerator(function* ({
|
||||
cliOptions,
|
||||
babelOptions
|
||||
}) {
|
||||
function buildResult(fileResults) {
|
||||
const mapSections = [];
|
||||
let code = "";
|
||||
let offset = 0;
|
||||
|
||||
for (const result of fileResults) {
|
||||
if (!result) continue;
|
||||
mapSections.push({
|
||||
offset: {
|
||||
line: offset,
|
||||
column: 0
|
||||
},
|
||||
map: result.map || emptyMap()
|
||||
});
|
||||
code += result.code + "\n";
|
||||
offset += countNewlines(result.code) + 1;
|
||||
}
|
||||
|
||||
const map = new (_traceMapping().AnyMap)({
|
||||
version: 3,
|
||||
file: cliOptions.sourceMapTarget || _path().basename(cliOptions.outFile || "") || "stdout",
|
||||
sections: mapSections
|
||||
});
|
||||
map.sourceRoot = babelOptions.sourceRoot;
|
||||
|
||||
if (babelOptions.sourceMaps === "inline" || !cliOptions.outFile && babelOptions.sourceMaps) {
|
||||
code += "\n" + _convertSourceMap().fromObject((0, _traceMapping().encodedMap)(map)).toComment();
|
||||
}
|
||||
|
||||
return {
|
||||
map: map,
|
||||
code: code
|
||||
};
|
||||
}
|
||||
|
||||
function countNewlines(code) {
|
||||
let count = 0;
|
||||
let index = -1;
|
||||
|
||||
while ((index = code.indexOf("\n", index + 1)) !== -1) {
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
function emptyMap() {
|
||||
return {
|
||||
version: 3,
|
||||
names: [],
|
||||
sources: [],
|
||||
mappings: []
|
||||
};
|
||||
}
|
||||
|
||||
function output(fileResults) {
|
||||
const result = buildResult(fileResults);
|
||||
|
||||
if (cliOptions.outFile) {
|
||||
(((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "10.12") ? _fs().mkdirSync : require("make-dir").sync)(_path().dirname(cliOptions.outFile), {
|
||||
recursive: true
|
||||
});
|
||||
|
||||
if (babelOptions.sourceMaps && babelOptions.sourceMaps !== "inline") {
|
||||
const mapLoc = cliOptions.outFile + ".map";
|
||||
result.code = util.addSourceMappingUrl(result.code, mapLoc);
|
||||
|
||||
_fs().writeFileSync(mapLoc, JSON.stringify((0, _traceMapping().encodedMap)(result.map)));
|
||||
}
|
||||
|
||||
_fs().writeFileSync(cliOptions.outFile, result.code);
|
||||
} else {
|
||||
process.stdout.write(result.code + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
function readStdin() {
|
||||
return new Promise((resolve, reject) => {
|
||||
let code = "";
|
||||
process.stdin.setEncoding("utf8");
|
||||
process.stdin.on("readable", function () {
|
||||
const chunk = process.stdin.read();
|
||||
if (chunk !== null) code += chunk;
|
||||
});
|
||||
process.stdin.on("end", function () {
|
||||
resolve(code);
|
||||
});
|
||||
process.stdin.on("error", reject);
|
||||
});
|
||||
}
|
||||
|
||||
function stdin() {
|
||||
return _stdin.apply(this, arguments);
|
||||
}
|
||||
|
||||
function _stdin() {
|
||||
_stdin = _asyncToGenerator(function* () {
|
||||
const code = yield readStdin();
|
||||
const res = yield util.transformRepl(cliOptions.filename, code, Object.assign({}, babelOptions, {
|
||||
sourceFileName: "stdin"
|
||||
}));
|
||||
output([res]);
|
||||
});
|
||||
return _stdin.apply(this, arguments);
|
||||
}
|
||||
|
||||
function walk(_x2) {
|
||||
return _walk.apply(this, arguments);
|
||||
}
|
||||
|
||||
function _walk() {
|
||||
_walk = _asyncToGenerator(function* (filenames) {
|
||||
const _filenames = [];
|
||||
filenames.forEach(function (filename) {
|
||||
if (!_fs().existsSync(filename)) return;
|
||||
|
||||
const stat = _fs().statSync(filename);
|
||||
|
||||
if (stat.isDirectory()) {
|
||||
const dirname = filename;
|
||||
util.readdirForCompilable(filename, cliOptions.includeDotfiles, cliOptions.extensions).forEach(function (filename) {
|
||||
_filenames.push(_path().join(dirname, filename));
|
||||
});
|
||||
} else {
|
||||
_filenames.push(filename);
|
||||
}
|
||||
});
|
||||
const results = yield Promise.all(_filenames.map(_asyncToGenerator(function* (filename) {
|
||||
let sourceFilename = filename;
|
||||
|
||||
if (cliOptions.outFile) {
|
||||
sourceFilename = _path().relative(_path().dirname(cliOptions.outFile), sourceFilename);
|
||||
}
|
||||
|
||||
sourceFilename = _slash()(sourceFilename);
|
||||
|
||||
try {
|
||||
return yield util.compile(filename, Object.assign({}, babelOptions, {
|
||||
sourceFileName: sourceFilename,
|
||||
sourceMaps: babelOptions.sourceMaps === "inline" ? true : babelOptions.sourceMaps
|
||||
}));
|
||||
} catch (err) {
|
||||
if (!cliOptions.watch) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
console.error(err);
|
||||
return null;
|
||||
}
|
||||
})));
|
||||
output(results);
|
||||
});
|
||||
return _walk.apply(this, arguments);
|
||||
}
|
||||
|
||||
function files(_x3) {
|
||||
return _files.apply(this, arguments);
|
||||
}
|
||||
|
||||
function _files() {
|
||||
_files = _asyncToGenerator(function* (filenames) {
|
||||
if (cliOptions.watch) {
|
||||
watcher.enable({
|
||||
enableGlobbing: false
|
||||
});
|
||||
}
|
||||
|
||||
if (!cliOptions.skipInitialBuild) {
|
||||
yield walk(filenames);
|
||||
}
|
||||
|
||||
if (cliOptions.watch) {
|
||||
filenames.forEach(watcher.watch);
|
||||
watcher.onFilesChange((changes, event, cause) => {
|
||||
const actionableChange = changes.some(filename => util.isCompilableExtension(filename, cliOptions.extensions) || filenames.includes(filename));
|
||||
if (!actionableChange) return;
|
||||
|
||||
if (cliOptions.verbose) {
|
||||
console.log(`${event} ${cause}`);
|
||||
}
|
||||
|
||||
walk(filenames).catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
return _files.apply(this, arguments);
|
||||
}
|
||||
|
||||
if (cliOptions.filenames.length) {
|
||||
yield files(cliOptions.filenames);
|
||||
} else {
|
||||
yield stdin();
|
||||
}
|
||||
});
|
||||
return _ref.apply(this, arguments);
|
||||
}
|
||||
20
themes/keepit/node_modules/@babel/cli/lib/babel/index.js
generated
vendored
Normal file
20
themes/keepit/node_modules/@babel/cli/lib/babel/index.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env node
|
||||
"use strict";
|
||||
|
||||
var _options = require("./options");
|
||||
|
||||
var _dir = require("./dir");
|
||||
|
||||
var _file = require("./file");
|
||||
|
||||
const opts = (0, _options.default)(process.argv);
|
||||
|
||||
if (opts) {
|
||||
const fn = opts.cliOptions.outDir ? _dir.default : _file.default;
|
||||
fn(opts).catch(err => {
|
||||
console.error(err);
|
||||
process.exitCode = 1;
|
||||
});
|
||||
} else {
|
||||
process.exitCode = 2;
|
||||
}
|
||||
285
themes/keepit/node_modules/@babel/cli/lib/babel/options.js
generated
vendored
Normal file
285
themes/keepit/node_modules/@babel/cli/lib/babel/options.js
generated
vendored
Normal file
@@ -0,0 +1,285 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = parseArgv;
|
||||
|
||||
function _fs() {
|
||||
const data = require("fs");
|
||||
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _commander() {
|
||||
const data = require("commander");
|
||||
|
||||
_commander = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _core() {
|
||||
const data = require("@babel/core");
|
||||
|
||||
_core = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _glob() {
|
||||
const data = require("glob");
|
||||
|
||||
_glob = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
_commander().option("-f, --filename [filename]", "The filename to use when reading from stdin. This will be used in source-maps, errors etc.");
|
||||
|
||||
_commander().option("--presets [list]", "A comma-separated list of preset names.", collect);
|
||||
|
||||
_commander().option("--plugins [list]", "A comma-separated list of plugin names.", collect);
|
||||
|
||||
_commander().option("--config-file [path]", "Path to a .babelrc file to use.");
|
||||
|
||||
_commander().option("--env-name [name]", "The name of the 'env' to use when loading configs and plugins. " + "Defaults to the value of BABEL_ENV, or else NODE_ENV, or else 'development'.");
|
||||
|
||||
_commander().option("--root-mode [mode]", "The project-root resolution mode. " + "One of 'root' (the default), 'upward', or 'upward-optional'.");
|
||||
|
||||
_commander().option("--source-type [script|module]", "");
|
||||
|
||||
_commander().option("--no-babelrc", "Whether or not to look up .babelrc and .babelignore files.");
|
||||
|
||||
_commander().option("--ignore [list]", "List of glob paths to **not** compile.", collect);
|
||||
|
||||
_commander().option("--only [list]", "List of glob paths to **only** compile.", collect);
|
||||
|
||||
_commander().option("--no-highlight-code", "Enable or disable ANSI syntax highlighting of code frames. (on by default)");
|
||||
|
||||
_commander().option("--no-comments", "Write comments to generated output. (true by default)");
|
||||
|
||||
_commander().option("--retain-lines", "Retain line numbers. This will result in really ugly code.");
|
||||
|
||||
_commander().option("--compact [true|false|auto]", "Do not include superfluous whitespace characters and line terminators.", booleanify);
|
||||
|
||||
_commander().option("--minified", "Save as many bytes when printing. (false by default)");
|
||||
|
||||
_commander().option("--auxiliary-comment-before [string]", "Print a comment before any injected non-user code.");
|
||||
|
||||
_commander().option("--auxiliary-comment-after [string]", "Print a comment after any injected non-user code.");
|
||||
|
||||
_commander().option("-s, --source-maps [true|false|inline|both]", "", booleanify);
|
||||
|
||||
_commander().option("--source-map-target [string]", "Set `file` on returned source map.");
|
||||
|
||||
_commander().option("--source-file-name [string]", "Set `sources[0]` on returned source map.");
|
||||
|
||||
_commander().option("--source-root [filename]", "The root from which all sources are relative.");
|
||||
|
||||
{
|
||||
_commander().option("--module-root [filename]", "Optional prefix for the AMD module formatter that will be prepended to the filename on module definitions.");
|
||||
|
||||
_commander().option("-M, --module-ids", "Insert an explicit id for modules.");
|
||||
|
||||
_commander().option("--module-id [string]", "Specify a custom name for module ids.");
|
||||
}
|
||||
|
||||
_commander().option("-x, --extensions [extensions]", "List of extensions to compile when a directory has been the input. [" + _core().DEFAULT_EXTENSIONS.join() + "]", collect);
|
||||
|
||||
_commander().option("--keep-file-extension", "Preserve the file extensions of the input files.");
|
||||
|
||||
_commander().option("-w, --watch", "Recompile files on changes.");
|
||||
|
||||
_commander().option("--skip-initial-build", "Do not compile files before watching.");
|
||||
|
||||
_commander().option("-o, --out-file [out]", "Compile all input files into a single file.");
|
||||
|
||||
_commander().option("-d, --out-dir [out]", "Compile an input directory of modules into an output directory.");
|
||||
|
||||
_commander().option("--relative", "Compile into an output directory relative to input directory or file. Requires --out-dir [out]");
|
||||
|
||||
_commander().option("-D, --copy-files", "When compiling a directory copy over non-compilable files.");
|
||||
|
||||
_commander().option("--include-dotfiles", "Include dotfiles when compiling and copying non-compilable files.");
|
||||
|
||||
_commander().option("--no-copy-ignored", "Exclude ignored files when copying non-compilable files.");
|
||||
|
||||
_commander().option("--verbose", "Log everything. This option conflicts with --quiet");
|
||||
|
||||
_commander().option("--quiet", "Don't log anything. This option conflicts with --verbose");
|
||||
|
||||
_commander().option("--delete-dir-on-start", "Delete the out directory before compilation.");
|
||||
|
||||
_commander().option("--out-file-extension [string]", "Use a specific extension for the output files");
|
||||
|
||||
_commander().version("7.17.10" + " (@babel/core " + _core().version + ")");
|
||||
|
||||
_commander().usage("[options] <files ...>");
|
||||
|
||||
_commander().action(() => {});
|
||||
|
||||
function parseArgv(args) {
|
||||
_commander().parse(args);
|
||||
|
||||
const errors = [];
|
||||
|
||||
let filenames = _commander().args.reduce(function (globbed, input) {
|
||||
let files = _glob().sync(input);
|
||||
|
||||
if (!files.length) files = [input];
|
||||
globbed.push(...files);
|
||||
return globbed;
|
||||
}, []);
|
||||
|
||||
filenames = Array.from(new Set(filenames));
|
||||
filenames.forEach(function (filename) {
|
||||
if (!_fs().existsSync(filename)) {
|
||||
errors.push(filename + " does not exist");
|
||||
}
|
||||
});
|
||||
|
||||
if (_commander().outDir && !filenames.length) {
|
||||
errors.push("--out-dir requires filenames");
|
||||
}
|
||||
|
||||
if (_commander().outFile && _commander().outDir) {
|
||||
errors.push("--out-file and --out-dir cannot be used together");
|
||||
}
|
||||
|
||||
if (_commander().relative && !_commander().outDir) {
|
||||
errors.push("--relative requires --out-dir usage");
|
||||
}
|
||||
|
||||
if (_commander().watch) {
|
||||
if (!_commander().outFile && !_commander().outDir) {
|
||||
errors.push("--watch requires --out-file or --out-dir");
|
||||
}
|
||||
|
||||
if (!filenames.length) {
|
||||
errors.push("--watch requires filenames");
|
||||
}
|
||||
}
|
||||
|
||||
if (_commander().skipInitialBuild && !_commander().watch) {
|
||||
errors.push("--skip-initial-build requires --watch");
|
||||
}
|
||||
|
||||
if (_commander().deleteDirOnStart && !_commander().outDir) {
|
||||
errors.push("--delete-dir-on-start requires --out-dir");
|
||||
}
|
||||
|
||||
if (_commander().verbose && _commander().quiet) {
|
||||
errors.push("--verbose and --quiet cannot be used together");
|
||||
}
|
||||
|
||||
if (!_commander().outDir && filenames.length === 0 && typeof _commander().filename !== "string" && _commander().babelrc !== false) {
|
||||
errors.push("stdin compilation requires either -f/--filename [filename] or --no-babelrc");
|
||||
}
|
||||
|
||||
if (_commander().keepFileExtension && _commander().outFileExtension) {
|
||||
errors.push("--out-file-extension cannot be used with --keep-file-extension");
|
||||
}
|
||||
|
||||
if (errors.length) {
|
||||
console.error("babel:");
|
||||
errors.forEach(function (e) {
|
||||
console.error(" " + e);
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
const opts = _commander().opts();
|
||||
|
||||
const babelOptions = {
|
||||
presets: opts.presets,
|
||||
plugins: opts.plugins,
|
||||
rootMode: opts.rootMode,
|
||||
configFile: opts.configFile,
|
||||
envName: opts.envName,
|
||||
sourceType: opts.sourceType,
|
||||
ignore: opts.ignore,
|
||||
only: opts.only,
|
||||
retainLines: opts.retainLines,
|
||||
compact: opts.compact,
|
||||
minified: opts.minified,
|
||||
auxiliaryCommentBefore: opts.auxiliaryCommentBefore,
|
||||
auxiliaryCommentAfter: opts.auxiliaryCommentAfter,
|
||||
sourceMaps: opts.sourceMaps,
|
||||
sourceFileName: opts.sourceFileName,
|
||||
sourceRoot: opts.sourceRoot,
|
||||
babelrc: opts.babelrc === true ? undefined : opts.babelrc,
|
||||
highlightCode: opts.highlightCode === true ? undefined : opts.highlightCode,
|
||||
comments: opts.comments === true ? undefined : opts.comments
|
||||
};
|
||||
{
|
||||
Object.assign(babelOptions, {
|
||||
moduleRoot: opts.moduleRoot,
|
||||
moduleIds: opts.moduleIds,
|
||||
moduleId: opts.moduleId
|
||||
});
|
||||
}
|
||||
|
||||
for (const key of Object.keys(babelOptions)) {
|
||||
if (babelOptions[key] === undefined) {
|
||||
delete babelOptions[key];
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
babelOptions,
|
||||
cliOptions: {
|
||||
filename: opts.filename,
|
||||
filenames,
|
||||
extensions: opts.extensions,
|
||||
keepFileExtension: opts.keepFileExtension,
|
||||
outFileExtension: opts.outFileExtension,
|
||||
watch: opts.watch,
|
||||
skipInitialBuild: opts.skipInitialBuild,
|
||||
outFile: opts.outFile,
|
||||
outDir: opts.outDir,
|
||||
relative: opts.relative,
|
||||
copyFiles: opts.copyFiles,
|
||||
copyIgnored: opts.copyFiles && opts.copyIgnored,
|
||||
includeDotfiles: opts.includeDotfiles,
|
||||
verbose: opts.verbose,
|
||||
quiet: opts.quiet,
|
||||
deleteDirOnStart: opts.deleteDirOnStart,
|
||||
sourceMapTarget: opts.sourceMapTarget
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function booleanify(val) {
|
||||
if (val === "true" || val == 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (val === "false" || val == 0 || !val) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
function collect(value, previousValue) {
|
||||
if (typeof value !== "string") return previousValue;
|
||||
const values = value.split(",");
|
||||
|
||||
if (previousValue) {
|
||||
previousValue.push(...values);
|
||||
return previousValue;
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
181
themes/keepit/node_modules/@babel/cli/lib/babel/util.js
generated
vendored
Normal file
181
themes/keepit/node_modules/@babel/cli/lib/babel/util.js
generated
vendored
Normal file
@@ -0,0 +1,181 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.addSourceMappingUrl = addSourceMappingUrl;
|
||||
exports.chmod = chmod;
|
||||
exports.compile = compile;
|
||||
exports.debounce = debounce;
|
||||
exports.deleteDir = deleteDir;
|
||||
exports.isCompilableExtension = isCompilableExtension;
|
||||
exports.readdir = readdir;
|
||||
exports.readdirForCompilable = readdirForCompilable;
|
||||
exports.transformRepl = transformRepl;
|
||||
exports.withExtension = withExtension;
|
||||
|
||||
function _fsReaddirRecursive() {
|
||||
const data = require("fs-readdir-recursive");
|
||||
|
||||
_fsReaddirRecursive = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function babel() {
|
||||
const data = require("@babel/core");
|
||||
|
||||
babel = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _path() {
|
||||
const data = require("path");
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _fs() {
|
||||
const data = require("fs");
|
||||
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var watcher = require("./watcher");
|
||||
|
||||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
||||
|
||||
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
||||
|
||||
function chmod(src, dest) {
|
||||
try {
|
||||
_fs().chmodSync(dest, _fs().statSync(src).mode);
|
||||
} catch (err) {
|
||||
console.warn(`Cannot change permissions of ${dest}`);
|
||||
}
|
||||
}
|
||||
|
||||
function readdir(dirname, includeDotfiles, filter) {
|
||||
return _fsReaddirRecursive()(dirname, (filename, _index, currentDirectory) => {
|
||||
const stat = _fs().statSync(_path().join(currentDirectory, filename));
|
||||
|
||||
if (stat.isDirectory()) return true;
|
||||
return (includeDotfiles || filename[0] !== ".") && (!filter || filter(filename));
|
||||
});
|
||||
}
|
||||
|
||||
function readdirForCompilable(dirname, includeDotfiles, altExts) {
|
||||
return readdir(dirname, includeDotfiles, function (filename) {
|
||||
return isCompilableExtension(filename, altExts);
|
||||
});
|
||||
}
|
||||
|
||||
function isCompilableExtension(filename, altExts) {
|
||||
const exts = altExts || babel().DEFAULT_EXTENSIONS;
|
||||
|
||||
const ext = _path().extname(filename);
|
||||
|
||||
return exts.includes(ext);
|
||||
}
|
||||
|
||||
function addSourceMappingUrl(code, loc) {
|
||||
return code + "\n//# sourceMappingURL=" + _path().basename(loc);
|
||||
}
|
||||
|
||||
const CALLER = {
|
||||
name: "@babel/cli"
|
||||
};
|
||||
|
||||
function transformRepl(filename, code, opts) {
|
||||
opts = Object.assign({}, opts, {
|
||||
caller: CALLER,
|
||||
filename
|
||||
});
|
||||
return new Promise((resolve, reject) => {
|
||||
babel().transform(code, opts, (err, result) => {
|
||||
if (err) reject(err);else resolve(result);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function compile(_x, _x2) {
|
||||
return _compile.apply(this, arguments);
|
||||
}
|
||||
|
||||
function _compile() {
|
||||
_compile = _asyncToGenerator(function* (filename, opts) {
|
||||
opts = Object.assign({}, opts, {
|
||||
caller: CALLER
|
||||
});
|
||||
const result = yield new Promise((resolve, reject) => {
|
||||
babel().transformFile(filename, opts, (err, result) => {
|
||||
if (err) reject(err);else resolve(result);
|
||||
});
|
||||
});
|
||||
|
||||
if (result) {
|
||||
{
|
||||
if (!result.externalDependencies) return result;
|
||||
}
|
||||
watcher.updateExternalDependencies(filename, result.externalDependencies);
|
||||
}
|
||||
|
||||
return result;
|
||||
});
|
||||
return _compile.apply(this, arguments);
|
||||
}
|
||||
|
||||
function deleteDir(path) {
|
||||
if (_fs().existsSync(path)) {
|
||||
_fs().readdirSync(path).forEach(function (file) {
|
||||
const curPath = path + "/" + file;
|
||||
|
||||
if (_fs().lstatSync(curPath).isDirectory()) {
|
||||
deleteDir(curPath);
|
||||
} else {
|
||||
_fs().unlinkSync(curPath);
|
||||
}
|
||||
});
|
||||
|
||||
_fs().rmdirSync(path);
|
||||
}
|
||||
}
|
||||
|
||||
process.on("uncaughtException", function (err) {
|
||||
console.error(err);
|
||||
process.exitCode = 1;
|
||||
});
|
||||
|
||||
function withExtension(filename, ext = ".js") {
|
||||
const newBasename = _path().basename(filename, _path().extname(filename)) + ext;
|
||||
return _path().join(_path().dirname(filename), newBasename);
|
||||
}
|
||||
|
||||
function debounce(fn, time) {
|
||||
let timer;
|
||||
|
||||
function debounced() {
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(fn, time);
|
||||
}
|
||||
|
||||
debounced.flush = () => {
|
||||
clearTimeout(timer);
|
||||
fn();
|
||||
};
|
||||
|
||||
return debounced;
|
||||
}
|
||||
132
themes/keepit/node_modules/@babel/cli/lib/babel/watcher.js
generated
vendored
Normal file
132
themes/keepit/node_modules/@babel/cli/lib/babel/watcher.js
generated
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.enable = enable;
|
||||
exports.onFilesChange = onFilesChange;
|
||||
exports.updateExternalDependencies = updateExternalDependencies;
|
||||
exports.watch = watch;
|
||||
|
||||
function _module() {
|
||||
const data = require("module");
|
||||
|
||||
_module = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _path() {
|
||||
const data = require("path");
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
const fileToDeps = new Map();
|
||||
const depToFiles = new Map();
|
||||
let isWatchMode = false;
|
||||
let watcher;
|
||||
|
||||
function enable({
|
||||
enableGlobbing
|
||||
}) {
|
||||
isWatchMode = true;
|
||||
const {
|
||||
FSWatcher
|
||||
} = requireChokidar();
|
||||
watcher = new FSWatcher({
|
||||
disableGlobbing: !enableGlobbing,
|
||||
persistent: true,
|
||||
ignoreInitial: true,
|
||||
awaitWriteFinish: {
|
||||
stabilityThreshold: 50,
|
||||
pollInterval: 10
|
||||
}
|
||||
});
|
||||
watcher.on("unlink", unwatchFile);
|
||||
}
|
||||
|
||||
function watch(filename) {
|
||||
if (!isWatchMode) {
|
||||
throw new Error("Internal Babel error: .watch called when not in watch mode.");
|
||||
}
|
||||
|
||||
watcher.add(_path().resolve(filename));
|
||||
}
|
||||
|
||||
function onFilesChange(callback) {
|
||||
if (!isWatchMode) {
|
||||
throw new Error("Internal Babel error: .onFilesChange called when not in watch mode.");
|
||||
}
|
||||
|
||||
watcher.on("all", (event, filename) => {
|
||||
var _depToFiles$get;
|
||||
|
||||
if (event !== "change" && event !== "add") return;
|
||||
|
||||
const absoluteFile = _path().resolve(filename);
|
||||
|
||||
callback([absoluteFile, ...((_depToFiles$get = depToFiles.get(absoluteFile)) != null ? _depToFiles$get : [])], event, absoluteFile);
|
||||
});
|
||||
}
|
||||
|
||||
function updateExternalDependencies(filename, dependencies) {
|
||||
if (!isWatchMode) return;
|
||||
|
||||
const absFilename = _path().resolve(filename);
|
||||
|
||||
const absDependencies = new Set(Array.from(dependencies, dep => _path().resolve(dep)));
|
||||
|
||||
if (fileToDeps.has(absFilename)) {
|
||||
for (const dep of fileToDeps.get(absFilename)) {
|
||||
if (!absDependencies.has(dep)) {
|
||||
removeFileDependency(absFilename, dep);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const dep of absDependencies) {
|
||||
if (!depToFiles.has(dep)) {
|
||||
depToFiles.set(dep, new Set());
|
||||
watcher.add(dep);
|
||||
}
|
||||
|
||||
depToFiles.get(dep).add(absFilename);
|
||||
}
|
||||
|
||||
fileToDeps.set(absFilename, absDependencies);
|
||||
}
|
||||
|
||||
function removeFileDependency(filename, dep) {
|
||||
depToFiles.get(dep).delete(filename);
|
||||
|
||||
if (depToFiles.get(dep).size === 0) {
|
||||
depToFiles.delete(dep);
|
||||
watcher.unwatch(dep);
|
||||
}
|
||||
}
|
||||
|
||||
function unwatchFile(filename) {
|
||||
if (!fileToDeps.has(filename)) return;
|
||||
|
||||
for (const dep of fileToDeps.get(filename)) {
|
||||
removeFileDependency(filename, dep);
|
||||
}
|
||||
|
||||
fileToDeps.delete(filename);
|
||||
}
|
||||
|
||||
function requireChokidar() {
|
||||
try {
|
||||
return parseInt(process.versions.node) >= 8 ? require("chokidar") : require("@nicolo-ribaudo/chokidar-2");
|
||||
} catch (err) {
|
||||
console.error("The optional dependency chokidar failed to install and is required for " + "--watch. Chokidar is likely not supported on your platform.");
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
54
themes/keepit/node_modules/@babel/cli/package.json
generated
vendored
Normal file
54
themes/keepit/node_modules/@babel/cli/package.json
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"name": "@babel/cli",
|
||||
"version": "7.17.10",
|
||||
"description": "Babel command line.",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-cli",
|
||||
"bugs": "https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20cli%22+is%3Aopen",
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-cli"
|
||||
},
|
||||
"keywords": [
|
||||
"6to5",
|
||||
"babel",
|
||||
"es6",
|
||||
"transpile",
|
||||
"transpiler",
|
||||
"babel-cli",
|
||||
"compiler"
|
||||
],
|
||||
"dependencies": {
|
||||
"@jridgewell/trace-mapping": "^0.3.8",
|
||||
"commander": "^4.0.1",
|
||||
"convert-source-map": "^1.1.0",
|
||||
"fs-readdir-recursive": "^1.1.0",
|
||||
"glob": "^7.0.0",
|
||||
"make-dir": "^2.1.0",
|
||||
"slash": "^2.0.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@nicolo-ribaudo/chokidar-2": "2.1.8-no-fsevents.3",
|
||||
"chokidar": "^3.4.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0-0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.17.10",
|
||||
"@babel/helper-fixtures": "^7.17.10",
|
||||
"rimraf": "^3.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"babel": "./bin/babel.js",
|
||||
"babel-external-helpers": "./bin/babel-external-helpers.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
}
|
||||
22
themes/keepit/node_modules/@babel/code-frame/LICENSE
generated
vendored
Normal file
22
themes/keepit/node_modules/@babel/code-frame/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||
|
||||
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.
|
||||
19
themes/keepit/node_modules/@babel/code-frame/README.md
generated
vendored
Normal file
19
themes/keepit/node_modules/@babel/code-frame/README.md
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# @babel/code-frame
|
||||
|
||||
> Generate errors that contain a code frame that point to source locations.
|
||||
|
||||
See our website [@babel/code-frame](https://babeljs.io/docs/en/babel-code-frame) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/code-frame
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/code-frame --dev
|
||||
```
|
||||
163
themes/keepit/node_modules/@babel/code-frame/lib/index.js
generated
vendored
Normal file
163
themes/keepit/node_modules/@babel/code-frame/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.codeFrameColumns = codeFrameColumns;
|
||||
exports.default = _default;
|
||||
|
||||
var _highlight = require("@babel/highlight");
|
||||
|
||||
let deprecationWarningShown = false;
|
||||
|
||||
function getDefs(chalk) {
|
||||
return {
|
||||
gutter: chalk.grey,
|
||||
marker: chalk.red.bold,
|
||||
message: chalk.red.bold
|
||||
};
|
||||
}
|
||||
|
||||
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
||||
|
||||
function getMarkerLines(loc, source, opts) {
|
||||
const startLoc = Object.assign({
|
||||
column: 0,
|
||||
line: -1
|
||||
}, loc.start);
|
||||
const endLoc = Object.assign({}, startLoc, loc.end);
|
||||
const {
|
||||
linesAbove = 2,
|
||||
linesBelow = 3
|
||||
} = opts || {};
|
||||
const startLine = startLoc.line;
|
||||
const startColumn = startLoc.column;
|
||||
const endLine = endLoc.line;
|
||||
const endColumn = endLoc.column;
|
||||
let start = Math.max(startLine - (linesAbove + 1), 0);
|
||||
let end = Math.min(source.length, endLine + linesBelow);
|
||||
|
||||
if (startLine === -1) {
|
||||
start = 0;
|
||||
}
|
||||
|
||||
if (endLine === -1) {
|
||||
end = source.length;
|
||||
}
|
||||
|
||||
const lineDiff = endLine - startLine;
|
||||
const markerLines = {};
|
||||
|
||||
if (lineDiff) {
|
||||
for (let i = 0; i <= lineDiff; i++) {
|
||||
const lineNumber = i + startLine;
|
||||
|
||||
if (!startColumn) {
|
||||
markerLines[lineNumber] = true;
|
||||
} else if (i === 0) {
|
||||
const sourceLength = source[lineNumber - 1].length;
|
||||
markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
|
||||
} else if (i === lineDiff) {
|
||||
markerLines[lineNumber] = [0, endColumn];
|
||||
} else {
|
||||
const sourceLength = source[lineNumber - i].length;
|
||||
markerLines[lineNumber] = [0, sourceLength];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (startColumn === endColumn) {
|
||||
if (startColumn) {
|
||||
markerLines[startLine] = [startColumn, 0];
|
||||
} else {
|
||||
markerLines[startLine] = true;
|
||||
}
|
||||
} else {
|
||||
markerLines[startLine] = [startColumn, endColumn - startColumn];
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
start,
|
||||
end,
|
||||
markerLines
|
||||
};
|
||||
}
|
||||
|
||||
function codeFrameColumns(rawLines, loc, opts = {}) {
|
||||
const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts);
|
||||
const chalk = (0, _highlight.getChalk)(opts);
|
||||
const defs = getDefs(chalk);
|
||||
|
||||
const maybeHighlight = (chalkFn, string) => {
|
||||
return highlighted ? chalkFn(string) : string;
|
||||
};
|
||||
|
||||
const lines = rawLines.split(NEWLINE);
|
||||
const {
|
||||
start,
|
||||
end,
|
||||
markerLines
|
||||
} = getMarkerLines(loc, lines, opts);
|
||||
const hasColumns = loc.start && typeof loc.start.column === "number";
|
||||
const numberMaxWidth = String(end).length;
|
||||
const highlightedLines = highlighted ? (0, _highlight.default)(rawLines, opts) : rawLines;
|
||||
let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line, index) => {
|
||||
const number = start + 1 + index;
|
||||
const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
|
||||
const gutter = ` ${paddedNumber} |`;
|
||||
const hasMarker = markerLines[number];
|
||||
const lastMarkerLine = !markerLines[number + 1];
|
||||
|
||||
if (hasMarker) {
|
||||
let markerLine = "";
|
||||
|
||||
if (Array.isArray(hasMarker)) {
|
||||
const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
|
||||
const numberOfMarkers = hasMarker[1] || 1;
|
||||
markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), " ", markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
|
||||
|
||||
if (lastMarkerLine && opts.message) {
|
||||
markerLine += " " + maybeHighlight(defs.message, opts.message);
|
||||
}
|
||||
}
|
||||
|
||||
return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line.length > 0 ? ` ${line}` : "", markerLine].join("");
|
||||
} else {
|
||||
return ` ${maybeHighlight(defs.gutter, gutter)}${line.length > 0 ? ` ${line}` : ""}`;
|
||||
}
|
||||
}).join("\n");
|
||||
|
||||
if (opts.message && !hasColumns) {
|
||||
frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`;
|
||||
}
|
||||
|
||||
if (highlighted) {
|
||||
return chalk.reset(frame);
|
||||
} else {
|
||||
return frame;
|
||||
}
|
||||
}
|
||||
|
||||
function _default(rawLines, lineNumber, colNumber, opts = {}) {
|
||||
if (!deprecationWarningShown) {
|
||||
deprecationWarningShown = true;
|
||||
const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
|
||||
|
||||
if (process.emitWarning) {
|
||||
process.emitWarning(message, "DeprecationWarning");
|
||||
} else {
|
||||
const deprecationError = new Error(message);
|
||||
deprecationError.name = "DeprecationWarning";
|
||||
console.warn(new Error(message));
|
||||
}
|
||||
}
|
||||
|
||||
colNumber = Math.max(colNumber, 0);
|
||||
const location = {
|
||||
start: {
|
||||
column: colNumber,
|
||||
line: lineNumber
|
||||
}
|
||||
};
|
||||
return codeFrameColumns(rawLines, location, opts);
|
||||
}
|
||||
29
themes/keepit/node_modules/@babel/code-frame/package.json
generated
vendored
Normal file
29
themes/keepit/node_modules/@babel/code-frame/package.json
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "@babel/code-frame",
|
||||
"version": "7.16.7",
|
||||
"description": "Generate errors that contain a code frame that point to source locations.",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-code-frame",
|
||||
"bugs": "https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen",
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-code-frame"
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/highlight": "^7.16.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/chalk": "^2.0.0",
|
||||
"chalk": "^2.0.0",
|
||||
"strip-ansi": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
}
|
||||
22
themes/keepit/node_modules/@babel/compat-data/LICENSE
generated
vendored
Normal file
22
themes/keepit/node_modules/@babel/compat-data/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||
|
||||
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.
|
||||
19
themes/keepit/node_modules/@babel/compat-data/README.md
generated
vendored
Normal file
19
themes/keepit/node_modules/@babel/compat-data/README.md
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# @babel/compat-data
|
||||
|
||||
>
|
||||
|
||||
See our website [@babel/compat-data](https://babeljs.io/docs/en/babel-compat-data) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save @babel/compat-data
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/compat-data
|
||||
```
|
||||
1
themes/keepit/node_modules/@babel/compat-data/corejs2-built-ins.js
generated
vendored
Normal file
1
themes/keepit/node_modules/@babel/compat-data/corejs2-built-ins.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./data/corejs2-built-ins.json");
|
||||
1
themes/keepit/node_modules/@babel/compat-data/corejs3-shipped-proposals.js
generated
vendored
Normal file
1
themes/keepit/node_modules/@babel/compat-data/corejs3-shipped-proposals.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./data/corejs3-shipped-proposals.json");
|
||||
1789
themes/keepit/node_modules/@babel/compat-data/data/corejs2-built-ins.json
generated
vendored
Normal file
1789
themes/keepit/node_modules/@babel/compat-data/data/corejs2-built-ins.json
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
5
themes/keepit/node_modules/@babel/compat-data/data/corejs3-shipped-proposals.json
generated
vendored
Normal file
5
themes/keepit/node_modules/@babel/compat-data/data/corejs3-shipped-proposals.json
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
[
|
||||
"esnext.global-this",
|
||||
"esnext.promise.all-settled",
|
||||
"esnext.string.match-all"
|
||||
]
|
||||
18
themes/keepit/node_modules/@babel/compat-data/data/native-modules.json
generated
vendored
Normal file
18
themes/keepit/node_modules/@babel/compat-data/data/native-modules.json
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"es6.module": {
|
||||
"chrome": "61",
|
||||
"and_chr": "61",
|
||||
"edge": "16",
|
||||
"firefox": "60",
|
||||
"and_ff": "60",
|
||||
"node": "13.2.0",
|
||||
"opera": "48",
|
||||
"op_mob": "48",
|
||||
"safari": "10.1",
|
||||
"ios": "10.3",
|
||||
"samsung": "8.2",
|
||||
"android": "61",
|
||||
"electron": "2.0",
|
||||
"ios_saf": "10.3"
|
||||
}
|
||||
}
|
||||
22
themes/keepit/node_modules/@babel/compat-data/data/overlapping-plugins.json
generated
vendored
Normal file
22
themes/keepit/node_modules/@babel/compat-data/data/overlapping-plugins.json
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"transform-async-to-generator": [
|
||||
"bugfix/transform-async-arrows-in-class"
|
||||
],
|
||||
"transform-parameters": [
|
||||
"bugfix/transform-edge-default-parameters",
|
||||
"bugfix/transform-safari-id-destructuring-collision-in-function-expression"
|
||||
],
|
||||
"transform-function-name": [
|
||||
"bugfix/transform-edge-function-name"
|
||||
],
|
||||
"transform-block-scoping": [
|
||||
"bugfix/transform-safari-block-shadowing",
|
||||
"bugfix/transform-safari-for-shadowing"
|
||||
],
|
||||
"transform-template-literals": [
|
||||
"bugfix/transform-tagged-template-caching"
|
||||
],
|
||||
"proposal-optional-chaining": [
|
||||
"bugfix/transform-v8-spread-parameters-in-optional-chaining"
|
||||
]
|
||||
}
|
||||
157
themes/keepit/node_modules/@babel/compat-data/data/plugin-bugfixes.json
generated
vendored
Normal file
157
themes/keepit/node_modules/@babel/compat-data/data/plugin-bugfixes.json
generated
vendored
Normal file
@@ -0,0 +1,157 @@
|
||||
{
|
||||
"bugfix/transform-async-arrows-in-class": {
|
||||
"chrome": "55",
|
||||
"opera": "42",
|
||||
"edge": "15",
|
||||
"firefox": "52",
|
||||
"safari": "11",
|
||||
"node": "7.6",
|
||||
"ios": "11",
|
||||
"samsung": "6",
|
||||
"electron": "1.6"
|
||||
},
|
||||
"bugfix/transform-edge-default-parameters": {
|
||||
"chrome": "49",
|
||||
"opera": "36",
|
||||
"edge": "18",
|
||||
"firefox": "52",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"electron": "0.37"
|
||||
},
|
||||
"bugfix/transform-edge-function-name": {
|
||||
"chrome": "51",
|
||||
"opera": "38",
|
||||
"edge": "79",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"bugfix/transform-safari-block-shadowing": {
|
||||
"chrome": "49",
|
||||
"opera": "36",
|
||||
"edge": "12",
|
||||
"firefox": "44",
|
||||
"safari": "11",
|
||||
"node": "6",
|
||||
"ie": "11",
|
||||
"ios": "11",
|
||||
"samsung": "5",
|
||||
"electron": "0.37"
|
||||
},
|
||||
"bugfix/transform-safari-for-shadowing": {
|
||||
"chrome": "49",
|
||||
"opera": "36",
|
||||
"edge": "12",
|
||||
"firefox": "4",
|
||||
"safari": "11",
|
||||
"node": "6",
|
||||
"ie": "11",
|
||||
"ios": "11",
|
||||
"samsung": "5",
|
||||
"rhino": "1.7.13",
|
||||
"electron": "0.37"
|
||||
},
|
||||
"bugfix/transform-safari-id-destructuring-collision-in-function-expression": {
|
||||
"chrome": "49",
|
||||
"opera": "36",
|
||||
"edge": "14",
|
||||
"firefox": "2",
|
||||
"node": "6",
|
||||
"samsung": "5",
|
||||
"electron": "0.37"
|
||||
},
|
||||
"bugfix/transform-tagged-template-caching": {
|
||||
"chrome": "41",
|
||||
"opera": "28",
|
||||
"edge": "12",
|
||||
"firefox": "34",
|
||||
"safari": "13",
|
||||
"node": "4",
|
||||
"ios": "13",
|
||||
"samsung": "3.4",
|
||||
"rhino": "1.7.14",
|
||||
"electron": "0.21"
|
||||
},
|
||||
"bugfix/transform-v8-spread-parameters-in-optional-chaining": {
|
||||
"chrome": "91",
|
||||
"opera": "77",
|
||||
"edge": "91",
|
||||
"firefox": "74",
|
||||
"safari": "13.1",
|
||||
"node": "16.9",
|
||||
"ios": "13.4",
|
||||
"electron": "13.0"
|
||||
},
|
||||
"proposal-optional-chaining": {
|
||||
"chrome": "80",
|
||||
"opera": "67",
|
||||
"edge": "80",
|
||||
"firefox": "74",
|
||||
"safari": "13.1",
|
||||
"node": "14",
|
||||
"ios": "13.4",
|
||||
"samsung": "13",
|
||||
"electron": "8.0"
|
||||
},
|
||||
"transform-parameters": {
|
||||
"chrome": "49",
|
||||
"opera": "36",
|
||||
"edge": "15",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"electron": "0.37"
|
||||
},
|
||||
"transform-async-to-generator": {
|
||||
"chrome": "55",
|
||||
"opera": "42",
|
||||
"edge": "15",
|
||||
"firefox": "52",
|
||||
"safari": "10.1",
|
||||
"node": "7.6",
|
||||
"ios": "10.3",
|
||||
"samsung": "6",
|
||||
"electron": "1.6"
|
||||
},
|
||||
"transform-template-literals": {
|
||||
"chrome": "41",
|
||||
"opera": "28",
|
||||
"edge": "13",
|
||||
"firefox": "34",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"samsung": "3.4",
|
||||
"electron": "0.21"
|
||||
},
|
||||
"transform-function-name": {
|
||||
"chrome": "51",
|
||||
"opera": "38",
|
||||
"edge": "14",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"transform-block-scoping": {
|
||||
"chrome": "49",
|
||||
"opera": "36",
|
||||
"edge": "14",
|
||||
"firefox": "51",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"electron": "0.37"
|
||||
}
|
||||
}
|
||||
478
themes/keepit/node_modules/@babel/compat-data/data/plugins.json
generated
vendored
Normal file
478
themes/keepit/node_modules/@babel/compat-data/data/plugins.json
generated
vendored
Normal file
@@ -0,0 +1,478 @@
|
||||
{
|
||||
"proposal-class-static-block": {
|
||||
"chrome": "94",
|
||||
"opera": "80",
|
||||
"edge": "94",
|
||||
"firefox": "93",
|
||||
"node": "16.11",
|
||||
"electron": "15.0"
|
||||
},
|
||||
"proposal-private-property-in-object": {
|
||||
"chrome": "91",
|
||||
"opera": "77",
|
||||
"edge": "91",
|
||||
"firefox": "90",
|
||||
"safari": "15",
|
||||
"node": "16.9",
|
||||
"ios": "15",
|
||||
"electron": "13.0"
|
||||
},
|
||||
"proposal-class-properties": {
|
||||
"chrome": "74",
|
||||
"opera": "62",
|
||||
"edge": "79",
|
||||
"firefox": "90",
|
||||
"safari": "14.1",
|
||||
"node": "12",
|
||||
"ios": "15",
|
||||
"samsung": "11",
|
||||
"electron": "6.0"
|
||||
},
|
||||
"proposal-private-methods": {
|
||||
"chrome": "84",
|
||||
"opera": "70",
|
||||
"edge": "84",
|
||||
"firefox": "90",
|
||||
"safari": "15",
|
||||
"node": "14.6",
|
||||
"ios": "15",
|
||||
"samsung": "14",
|
||||
"electron": "10.0"
|
||||
},
|
||||
"proposal-numeric-separator": {
|
||||
"chrome": "75",
|
||||
"opera": "62",
|
||||
"edge": "79",
|
||||
"firefox": "70",
|
||||
"safari": "13",
|
||||
"node": "12.5",
|
||||
"ios": "13",
|
||||
"samsung": "11",
|
||||
"rhino": "1.7.14",
|
||||
"electron": "6.0"
|
||||
},
|
||||
"proposal-logical-assignment-operators": {
|
||||
"chrome": "85",
|
||||
"opera": "71",
|
||||
"edge": "85",
|
||||
"firefox": "79",
|
||||
"safari": "14",
|
||||
"node": "15",
|
||||
"ios": "14",
|
||||
"samsung": "14",
|
||||
"electron": "10.0"
|
||||
},
|
||||
"proposal-nullish-coalescing-operator": {
|
||||
"chrome": "80",
|
||||
"opera": "67",
|
||||
"edge": "80",
|
||||
"firefox": "72",
|
||||
"safari": "13.1",
|
||||
"node": "14",
|
||||
"ios": "13.4",
|
||||
"samsung": "13",
|
||||
"electron": "8.0"
|
||||
},
|
||||
"proposal-optional-chaining": {
|
||||
"chrome": "91",
|
||||
"opera": "77",
|
||||
"edge": "91",
|
||||
"firefox": "74",
|
||||
"safari": "13.1",
|
||||
"node": "16.9",
|
||||
"ios": "13.4",
|
||||
"electron": "13.0"
|
||||
},
|
||||
"proposal-json-strings": {
|
||||
"chrome": "66",
|
||||
"opera": "53",
|
||||
"edge": "79",
|
||||
"firefox": "62",
|
||||
"safari": "12",
|
||||
"node": "10",
|
||||
"ios": "12",
|
||||
"samsung": "9",
|
||||
"rhino": "1.7.14",
|
||||
"electron": "3.0"
|
||||
},
|
||||
"proposal-optional-catch-binding": {
|
||||
"chrome": "66",
|
||||
"opera": "53",
|
||||
"edge": "79",
|
||||
"firefox": "58",
|
||||
"safari": "11.1",
|
||||
"node": "10",
|
||||
"ios": "11.3",
|
||||
"samsung": "9",
|
||||
"electron": "3.0"
|
||||
},
|
||||
"transform-parameters": {
|
||||
"chrome": "49",
|
||||
"opera": "36",
|
||||
"edge": "18",
|
||||
"firefox": "53",
|
||||
"node": "6",
|
||||
"samsung": "5",
|
||||
"electron": "0.37"
|
||||
},
|
||||
"proposal-async-generator-functions": {
|
||||
"chrome": "63",
|
||||
"opera": "50",
|
||||
"edge": "79",
|
||||
"firefox": "57",
|
||||
"safari": "12",
|
||||
"node": "10",
|
||||
"ios": "12",
|
||||
"samsung": "8",
|
||||
"electron": "3.0"
|
||||
},
|
||||
"proposal-object-rest-spread": {
|
||||
"chrome": "60",
|
||||
"opera": "47",
|
||||
"edge": "79",
|
||||
"firefox": "55",
|
||||
"safari": "11.1",
|
||||
"node": "8.3",
|
||||
"ios": "11.3",
|
||||
"samsung": "8",
|
||||
"electron": "2.0"
|
||||
},
|
||||
"transform-dotall-regex": {
|
||||
"chrome": "62",
|
||||
"opera": "49",
|
||||
"edge": "79",
|
||||
"firefox": "78",
|
||||
"safari": "11.1",
|
||||
"node": "8.10",
|
||||
"ios": "11.3",
|
||||
"samsung": "8",
|
||||
"electron": "3.0"
|
||||
},
|
||||
"proposal-unicode-property-regex": {
|
||||
"chrome": "64",
|
||||
"opera": "51",
|
||||
"edge": "79",
|
||||
"firefox": "78",
|
||||
"safari": "11.1",
|
||||
"node": "10",
|
||||
"ios": "11.3",
|
||||
"samsung": "9",
|
||||
"electron": "3.0"
|
||||
},
|
||||
"transform-named-capturing-groups-regex": {
|
||||
"chrome": "64",
|
||||
"opera": "51",
|
||||
"edge": "79",
|
||||
"firefox": "78",
|
||||
"safari": "11.1",
|
||||
"node": "10",
|
||||
"ios": "11.3",
|
||||
"samsung": "9",
|
||||
"electron": "3.0"
|
||||
},
|
||||
"transform-async-to-generator": {
|
||||
"chrome": "55",
|
||||
"opera": "42",
|
||||
"edge": "15",
|
||||
"firefox": "52",
|
||||
"safari": "11",
|
||||
"node": "7.6",
|
||||
"ios": "11",
|
||||
"samsung": "6",
|
||||
"electron": "1.6"
|
||||
},
|
||||
"transform-exponentiation-operator": {
|
||||
"chrome": "52",
|
||||
"opera": "39",
|
||||
"edge": "14",
|
||||
"firefox": "52",
|
||||
"safari": "10.1",
|
||||
"node": "7",
|
||||
"ios": "10.3",
|
||||
"samsung": "6",
|
||||
"rhino": "1.7.14",
|
||||
"electron": "1.3"
|
||||
},
|
||||
"transform-template-literals": {
|
||||
"chrome": "41",
|
||||
"opera": "28",
|
||||
"edge": "13",
|
||||
"firefox": "34",
|
||||
"safari": "13",
|
||||
"node": "4",
|
||||
"ios": "13",
|
||||
"samsung": "3.4",
|
||||
"electron": "0.21"
|
||||
},
|
||||
"transform-literals": {
|
||||
"chrome": "44",
|
||||
"opera": "31",
|
||||
"edge": "12",
|
||||
"firefox": "53",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"samsung": "4",
|
||||
"electron": "0.30"
|
||||
},
|
||||
"transform-function-name": {
|
||||
"chrome": "51",
|
||||
"opera": "38",
|
||||
"edge": "79",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"transform-arrow-functions": {
|
||||
"chrome": "47",
|
||||
"opera": "34",
|
||||
"edge": "13",
|
||||
"firefox": "43",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"rhino": "1.7.13",
|
||||
"electron": "0.36"
|
||||
},
|
||||
"transform-block-scoped-functions": {
|
||||
"chrome": "41",
|
||||
"opera": "28",
|
||||
"edge": "12",
|
||||
"firefox": "46",
|
||||
"safari": "10",
|
||||
"node": "4",
|
||||
"ie": "11",
|
||||
"ios": "10",
|
||||
"samsung": "3.4",
|
||||
"electron": "0.21"
|
||||
},
|
||||
"transform-classes": {
|
||||
"chrome": "46",
|
||||
"opera": "33",
|
||||
"edge": "13",
|
||||
"firefox": "45",
|
||||
"safari": "10",
|
||||
"node": "5",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"electron": "0.36"
|
||||
},
|
||||
"transform-object-super": {
|
||||
"chrome": "46",
|
||||
"opera": "33",
|
||||
"edge": "13",
|
||||
"firefox": "45",
|
||||
"safari": "10",
|
||||
"node": "5",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"electron": "0.36"
|
||||
},
|
||||
"transform-shorthand-properties": {
|
||||
"chrome": "43",
|
||||
"opera": "30",
|
||||
"edge": "12",
|
||||
"firefox": "33",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"samsung": "4",
|
||||
"rhino": "1.7.14",
|
||||
"electron": "0.27"
|
||||
},
|
||||
"transform-duplicate-keys": {
|
||||
"chrome": "42",
|
||||
"opera": "29",
|
||||
"edge": "12",
|
||||
"firefox": "34",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"samsung": "3.4",
|
||||
"electron": "0.25"
|
||||
},
|
||||
"transform-computed-properties": {
|
||||
"chrome": "44",
|
||||
"opera": "31",
|
||||
"edge": "12",
|
||||
"firefox": "34",
|
||||
"safari": "7.1",
|
||||
"node": "4",
|
||||
"ios": "8",
|
||||
"samsung": "4",
|
||||
"electron": "0.30"
|
||||
},
|
||||
"transform-for-of": {
|
||||
"chrome": "51",
|
||||
"opera": "38",
|
||||
"edge": "15",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"transform-sticky-regex": {
|
||||
"chrome": "49",
|
||||
"opera": "36",
|
||||
"edge": "13",
|
||||
"firefox": "3",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"electron": "0.37"
|
||||
},
|
||||
"transform-unicode-escapes": {
|
||||
"chrome": "44",
|
||||
"opera": "31",
|
||||
"edge": "12",
|
||||
"firefox": "53",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"samsung": "4",
|
||||
"electron": "0.30"
|
||||
},
|
||||
"transform-unicode-regex": {
|
||||
"chrome": "50",
|
||||
"opera": "37",
|
||||
"edge": "13",
|
||||
"firefox": "46",
|
||||
"safari": "12",
|
||||
"node": "6",
|
||||
"ios": "12",
|
||||
"samsung": "5",
|
||||
"electron": "1.1"
|
||||
},
|
||||
"transform-spread": {
|
||||
"chrome": "46",
|
||||
"opera": "33",
|
||||
"edge": "13",
|
||||
"firefox": "45",
|
||||
"safari": "10",
|
||||
"node": "5",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"electron": "0.36"
|
||||
},
|
||||
"transform-destructuring": {
|
||||
"chrome": "51",
|
||||
"opera": "38",
|
||||
"edge": "15",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"transform-block-scoping": {
|
||||
"chrome": "49",
|
||||
"opera": "36",
|
||||
"edge": "14",
|
||||
"firefox": "51",
|
||||
"safari": "11",
|
||||
"node": "6",
|
||||
"ios": "11",
|
||||
"samsung": "5",
|
||||
"electron": "0.37"
|
||||
},
|
||||
"transform-typeof-symbol": {
|
||||
"chrome": "38",
|
||||
"opera": "25",
|
||||
"edge": "12",
|
||||
"firefox": "36",
|
||||
"safari": "9",
|
||||
"node": "0.12",
|
||||
"ios": "9",
|
||||
"samsung": "3",
|
||||
"rhino": "1.7.13",
|
||||
"electron": "0.20"
|
||||
},
|
||||
"transform-new-target": {
|
||||
"chrome": "46",
|
||||
"opera": "33",
|
||||
"edge": "14",
|
||||
"firefox": "41",
|
||||
"safari": "10",
|
||||
"node": "5",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"electron": "0.36"
|
||||
},
|
||||
"transform-regenerator": {
|
||||
"chrome": "50",
|
||||
"opera": "37",
|
||||
"edge": "13",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"electron": "1.1"
|
||||
},
|
||||
"transform-member-expression-literals": {
|
||||
"chrome": "7",
|
||||
"opera": "12",
|
||||
"edge": "12",
|
||||
"firefox": "2",
|
||||
"safari": "5.1",
|
||||
"node": "0.10",
|
||||
"ie": "9",
|
||||
"android": "4",
|
||||
"ios": "6",
|
||||
"phantom": "2",
|
||||
"samsung": "1",
|
||||
"rhino": "1.7.13",
|
||||
"electron": "0.20"
|
||||
},
|
||||
"transform-property-literals": {
|
||||
"chrome": "7",
|
||||
"opera": "12",
|
||||
"edge": "12",
|
||||
"firefox": "2",
|
||||
"safari": "5.1",
|
||||
"node": "0.10",
|
||||
"ie": "9",
|
||||
"android": "4",
|
||||
"ios": "6",
|
||||
"phantom": "2",
|
||||
"samsung": "1",
|
||||
"rhino": "1.7.13",
|
||||
"electron": "0.20"
|
||||
},
|
||||
"transform-reserved-words": {
|
||||
"chrome": "13",
|
||||
"opera": "10.50",
|
||||
"edge": "12",
|
||||
"firefox": "2",
|
||||
"safari": "3.1",
|
||||
"node": "0.10",
|
||||
"ie": "9",
|
||||
"android": "4.4",
|
||||
"ios": "6",
|
||||
"phantom": "2",
|
||||
"samsung": "1",
|
||||
"rhino": "1.7.13",
|
||||
"electron": "0.20"
|
||||
},
|
||||
"proposal-export-namespace-from": {
|
||||
"chrome": "72",
|
||||
"and_chr": "72",
|
||||
"edge": "79",
|
||||
"firefox": "80",
|
||||
"and_ff": "80",
|
||||
"node": "13.2",
|
||||
"opera": "60",
|
||||
"op_mob": "51",
|
||||
"samsung": "11.0",
|
||||
"android": "72",
|
||||
"electron": "5.0"
|
||||
}
|
||||
}
|
||||
1
themes/keepit/node_modules/@babel/compat-data/native-modules.js
generated
vendored
Normal file
1
themes/keepit/node_modules/@babel/compat-data/native-modules.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./data/native-modules.json");
|
||||
1
themes/keepit/node_modules/@babel/compat-data/overlapping-plugins.js
generated
vendored
Normal file
1
themes/keepit/node_modules/@babel/compat-data/overlapping-plugins.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./data/overlapping-plugins.json");
|
||||
39
themes/keepit/node_modules/@babel/compat-data/package.json
generated
vendored
Normal file
39
themes/keepit/node_modules/@babel/compat-data/package.json
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "@babel/compat-data",
|
||||
"version": "7.17.10",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"license": "MIT",
|
||||
"description": "",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-compat-data"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"exports": {
|
||||
"./plugins": "./plugins.js",
|
||||
"./native-modules": "./native-modules.js",
|
||||
"./corejs2-built-ins": "./corejs2-built-ins.js",
|
||||
"./corejs3-shipped-proposals": "./corejs3-shipped-proposals.js",
|
||||
"./overlapping-plugins": "./overlapping-plugins.js",
|
||||
"./plugin-bugfixes": "./plugin-bugfixes.js"
|
||||
},
|
||||
"scripts": {
|
||||
"build-data": "./scripts/download-compat-table.sh && node ./scripts/build-data.js && node ./scripts/build-modules-support.js && node ./scripts/build-bugfixes-targets.js"
|
||||
},
|
||||
"keywords": [
|
||||
"babel",
|
||||
"compat-table",
|
||||
"compat-data"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@mdn/browser-compat-data": "^4.0.10",
|
||||
"core-js-compat": "^3.22.1",
|
||||
"electron-to-chromium": "^1.4.113"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
}
|
||||
1
themes/keepit/node_modules/@babel/compat-data/plugin-bugfixes.js
generated
vendored
Normal file
1
themes/keepit/node_modules/@babel/compat-data/plugin-bugfixes.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./data/plugin-bugfixes.json");
|
||||
1
themes/keepit/node_modules/@babel/compat-data/plugins.js
generated
vendored
Normal file
1
themes/keepit/node_modules/@babel/compat-data/plugins.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./data/plugins.json");
|
||||
22
themes/keepit/node_modules/@babel/core/LICENSE
generated
vendored
Normal file
22
themes/keepit/node_modules/@babel/core/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||
|
||||
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.
|
||||
19
themes/keepit/node_modules/@babel/core/README.md
generated
vendored
Normal file
19
themes/keepit/node_modules/@babel/core/README.md
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# @babel/core
|
||||
|
||||
> Babel compiler core.
|
||||
|
||||
See our website [@babel/core](https://babeljs.io/docs/en/babel-core) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20core%22+is%3Aopen) associated with this package.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/core
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/core --dev
|
||||
```
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user