Socket
Socket
Sign inDemoInstall

svelte-preprocess

Package Overview
Dependencies
Maintainers
1
Versions
175
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-preprocess - npm Package Compare versions

Comparing version 4.9.3 to 4.9.4

22

dist/transformers/typescript.js

@@ -17,2 +17,6 @@ "use strict";

const injectedCodeSeparator = 'const $$$$$$$$ = null;';
/**
* Map of valid tsconfigs (no errors). Key is the path.
*/
const tsconfigMap = new Map();
function createFormatDiagnosticsHost(cwd) {

@@ -78,7 +82,14 @@ return {

: v.name);
const contentForCodestores = content +
// Append instance script content because it's valid
// to import a store in module script and autosubscribe to it in instance script
((attributes === null || attributes === void 0 ? void 0 : attributes.context) === 'module' ? getScriptContent(markup, false) : '');
// This regex extracts all possible store variables
// TODO investigate if it's possible to achieve this with a
// TS transformer (previous attemps have failed)
const codestores = Array.from(content.match(/\$[^\s();:,[\]{}.?!+-=*/~|&%<>^`"']+/g) || [], (name) => name.slice(1)).filter((name) => !utils_1.JAVASCRIPT_RESERVED_KEYWORD_SET.has(name));
const codestores = Array.from(contentForCodestores.match(/\$[^\s();:,[\]{}.?!+-=*/~|&%<>^`"']+/g) || [], (name) => name.slice(1)).filter((name) => !utils_1.JAVASCRIPT_RESERVED_KEYWORD_SET.has(name));
const varsString = [...codestores, ...varnames].join(',');
const injectedVars = `const $$vars$$ = [${varsString}];`;
// Append instance/markup script content because it's valid
// to import things in one and reference it in the other.
const injectedCode = (attributes === null || attributes === void 0 ? void 0 : attributes.context) === 'module'

@@ -189,2 +200,8 @@ ? `${sep}${getScriptContent(markup, false)}\n${injectedVars}`

basePath = (0, path_1.dirname)(tsconfigFile);
if (tsconfigMap.has(tsconfigFile)) {
return {
errors: [],
options: tsconfigMap.get(tsconfigFile),
};
}
const { error, config } = typescript_1.default.readConfigFile(tsconfigFile, typescript_1.default.sys.readFile);

@@ -199,2 +216,5 @@ if (error) {

errors = errors.filter((d) => d.code !== 18003);
if (errors.length === 0) {
tsconfigMap.set(tsconfigFile, options);
}
return { errors, options };

@@ -201,0 +221,0 @@ }

2

package.json
{
"name": "svelte-preprocess",
"version": "4.9.3",
"version": "4.9.4",
"license": "MIT",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc