Socket
Socket
Sign inDemoInstall

svelte-preprocess

Package Overview
Dependencies
253
Maintainers
2
Versions
171
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.2 to 5.0.3

dist/autoProcess.d.ts.map

3

dist/autoProcess.js

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

const transform = async (name, options, { content, markup, map, filename, attributes }) => {
var _a;
if (name == null || options === false) {

@@ -47,3 +46,3 @@ return { code: content };

// todo: maybe add a try-catch here looking for module-not-found errors
const { transformer } = await (_a = `./transformers/${name}`, Promise.resolve().then(() => __importStar(require(_a))));
const { transformer } = await Promise.resolve(`${`./transformers/${name}`}`).then(s => __importStar(require(s)));
return transformer({

@@ -50,0 +49,0 @@ content,

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

};
var _a;
Object.defineProperty(exports, "__esModule", { value: true });

@@ -62,3 +61,3 @@ exports.JAVASCRIPT_RESERVED_KEYWORD_SET = exports.setProp = exports.findUp = exports.isValidLocalPath = exports.hasDepInstalled = exports.getIncludePaths = exports.concat = void 0;

try {
await (_a = dep, Promise.resolve().then(() => __importStar(require(_a))));
await Promise.resolve(`${dep}`).then(s => __importStar(require(s)));
result = true;

@@ -65,0 +64,0 @@ }

@@ -0,0 +0,0 @@ "use strict";

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

const tsconfigMap = new Map();
const importsNotUsedAsValuesDeprecated = parseInt(typescript_1.default.version.split('.')[0], 10) >= 5;
function createFormatDiagnosticsHost(cwd) {

@@ -37,12 +38,25 @@ return {

const visit = (node) => {
var _a;
var _a, _b, _c;
if (typescript_1.default.isImportDeclaration(node)) {
if ((_a = node.importClause) === null || _a === void 0 ? void 0 : _a.isTypeOnly) {
return typescript_1.default.createEmptyStatement();
if (!((_b = typescript_1.default.factory) === null || _b === void 0 ? void 0 : _b.createEmptyStatement)) {
// @ts-expect-error removed in TS 5.0
return typescript_1.default.createEmptyStatement();
}
return typescript_1.default.factory.createEmptyStatement();
}
return typescript_1.default.createImportDeclaration(node.decorators, node.modifiers, node.importClause, node.moduleSpecifier);
if (!((_c = typescript_1.default.factory) === null || _c === void 0 ? void 0 : _c.createImportDeclaration)) {
// @ts-expect-error removed in TS 5.0
return typescript_1.default.createImportDeclaration(
// @ts-expect-error removed in TS 5.0
node.decorators, node.modifiers, node.importClause, node.moduleSpecifier);
}
return typescript_1.default.factory.createImportDeclaration(node.modifiers, node.importClause, node.moduleSpecifier);
}
return typescript_1.default.visitEachChild(node, (child) => visit(child), context);
};
return (node) => typescript_1.default.visitNode(node, visit);
return (node) => {
typescript_1.default.visitNode(node, visit);
return node;
};
};

@@ -142,2 +156,3 @@ function getScriptContent(markup, module) {

}
let warned = false;
function getCompilerOptions({ filename, options, basePath, }) {

@@ -156,3 +171,2 @@ var _a;

...convertedCompilerOptions,
importsNotUsedAsValues: typescript_1.default.ImportsNotUsedAsValues.Error,
allowNonTsExtensions: true,

@@ -162,2 +176,20 @@ // Clear outDir since it causes source map issues when the files aren't actually written to disk.

};
if (!importsNotUsedAsValuesDeprecated ||
(compilerOptions.ignoreDeprecations === '5.0' &&
!compilerOptions.verbatimModuleSyntax)) {
compilerOptions.importsNotUsedAsValues = typescript_1.default.ImportsNotUsedAsValues.Error;
}
// Ease TS 5 migration pains a little and add the deprecation flag automatically if needed
if (importsNotUsedAsValuesDeprecated &&
!compilerOptions.ignoreDeprecations &&
(compilerOptions.importsNotUsedAsValues ||
compilerOptions.preserveValueImports)) {
if (!warned) {
warned = true;
console.warn('tsconfig options "importsNotUsedAsValues" and "preserveValueImports" are deprecated. ' +
'Either set "ignoreDeprecations" to "5.0" in your tsconfig.json to silence this warning, ' +
'or replace them in favor of the new "verbatimModuleSyntax" flag.');
}
compilerOptions.ignoreDeprecations = '5.0';
}
if (compilerOptions.target === typescript_1.default.ScriptTarget.ES3 ||

@@ -277,3 +309,4 @@ compilerOptions.target === typescript_1.default.ScriptTarget.ES5) {

// keeping all imports that are not type imports
transformers: compilerOptions.preserveValueImports
transformers: compilerOptions.preserveValueImports ||
compilerOptions.verbatimModuleSyntax
? undefined

@@ -304,2 +337,3 @@ : { before: [importTransformer] },

const handleMixedImports = !compilerOptions.preserveValueImports &&
!compilerOptions.verbatimModuleSyntax &&
(options.handleMixedImports === false

@@ -306,0 +340,0 @@ ? false

{
"name": "svelte-preprocess",
"version": "5.0.2",
"version": "5.0.3",
"license": "MIT",

@@ -75,3 +75,3 @@ "main": "dist/index.js",

"husky": "^8.0.2",
"jest": "^27.5.1",
"jest": "^29.5.0",
"less": "^3.13.1",

@@ -88,4 +88,4 @@ "lint-staged": "^10.5.4",

"svelte": "^3.54.0",
"ts-jest": "^27.1.5",
"typescript": "^4.9.4"
"ts-jest": "^29.0.5",
"typescript": "^5.0.2"
},

@@ -92,0 +92,0 @@ "dependencies": {

@@ -0,0 +0,0 @@ # Svelte Preprocess

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc