🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@swc/cli

Package Overview
Dependencies
Maintainers
2
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@swc/cli - npm Package Compare versions

Comparing version

to
0.1.64

2

lib/swc/__tests__/options.test.js

@@ -71,3 +71,5 @@ "use strict";

],
ignore: [],
includeDotfiles: false,
only: [],
// @ts-expect-error

@@ -74,0 +76,0 @@ outDir: undefined,

12

lib/swc/__tests__/sources.test.js

@@ -22,3 +22,3 @@ "use strict";

".dotfile"
], false);
], [], [], false);
expect([

@@ -36,3 +36,3 @@ ...files

".dotfile"
], true);
], [], [], true);
expect([

@@ -58,3 +58,3 @@ ...files

"file"
], true);
], [], [], true);
expect([

@@ -79,3 +79,3 @@ ...files

"file"
], true);
], [], [], true);
expect([

@@ -105,3 +105,3 @@ ...files

"directory"
], true);
], [], [], true);
expect([

@@ -130,3 +130,3 @@ ...files

"directory"
], true);
], [], [], true);
expect([

@@ -133,0 +133,0 @@ ...files

@@ -78,6 +78,6 @@ "use strict";

async function initialCompilation(cliOptions, swcOptions) {
const { includeDotfiles , filenames , copyFiles , extensions , outDir , sync , quiet , watch } = cliOptions;
const { includeDotfiles , filenames , copyFiles , extensions , outDir , sync , quiet , watch , only , ignore } = cliOptions;
const results = new Map();
const start = process.hrtime();
const sourceFiles = await (0, _sources.globSources)(filenames, includeDotfiles);
const sourceFiles = await (0, _sources.globSources)(filenames, only, ignore, includeDotfiles);
const [compilable, copyable] = (0, _sources.splitCompilableAndCopyable)(sourceFiles, extensions, copyFiles);

@@ -84,0 +84,0 @@ if (sync) {

@@ -128,3 +128,3 @@ "use strict";

const results = new Map();
for (const filename of (await (0, _sources.globSources)(cliOptions.filenames, cliOptions.includeDotfiles))){
for (const filename of (await (0, _sources.globSources)(cliOptions.filenames, cliOptions.only, cliOptions.ignore, cliOptions.includeDotfiles))){
if ((0, _sources.isCompilableExtension)(filename, cliOptions.extensions)) {

@@ -131,0 +131,0 @@ results.set(filename, previousResults.get(filename));

@@ -159,3 +159,5 @@ "use strict";

deleteDirOnStart: Boolean(opts.deleteDirOnStart),
quiet: !!opts.quiet
quiet: !!opts.quiet,
only: opts.only || [],
ignore: opts.ignore || []
};

@@ -162,0 +164,0 @@ return {

@@ -22,2 +22,3 @@ "use strict";

const _path = require("path");
const _minimatch = require("minimatch");
function _interopRequireDefault(obj) {

@@ -67,6 +68,6 @@ return obj && obj.__esModule ? obj : {

}
async function globSources(sources, includeDotfiles = false) {
async function globSources(sources, only, ignore, includeDotfiles = false) {
const globConfig = {
dot: includeDotfiles,
nodir: true
ignore
};

@@ -90,3 +91,6 @@ const files = await Promise.all(sources.filter((source)=>includeDotfiles || source === "." || !(0, _path.basename)(source).startsWith(".")).map((source)=>{

}));
return Array.from(new Set(files.flat()));
const f = files.flat().filter((filename)=>{
return only.length === 0 || only.some((only)=>(0, _minimatch.minimatch)((0, _slash.default)(filename), only));
});
return Array.from(new Set(f));
}

@@ -93,0 +97,0 @@ function isCompilableExtension(filename, allowedExtension) {

{
"name": "@swc/cli",
"version": "0.1.63",
"version": "0.1.64",
"description": "CLI for the swc project",

@@ -52,2 +52,3 @@ "main": "lib/swc/index.js",

"fast-glob": "^3.2.5",
"minimatch": "^9.0.3",
"semver": "^7.3.8",

@@ -54,0 +55,0 @@ "slash": "3.0.0",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet