Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@shopify/theme-check-common

Package Overview
Dependencies
Maintainers
25
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shopify/theme-check-common - npm Package Compare versions

Comparing version 1.14.1 to 1.15.0

7

CHANGELOG.md
# @shopify/theme-check-common
## 1.15.0
### Patch Changes
- 6c2c00f: `UndefinedObject` should not show any offenses when themeDocset is not given
- f1a642f: Improve resilience of theme check pipeline by preventing entire failure if an individual check fails
## 1.14.1

@@ -4,0 +11,0 @@

13

dist/checks/undefined-object/index.js

@@ -29,2 +29,9 @@ "use strict";

}
/**
* Skip this check when definitions for global objects are unavailable.
*/
if (!context.themeDocset) {
return {};
}
const themeDocset = context.themeDocset;
const variableScopes = new Map();

@@ -66,6 +73,4 @@ const variables = [];

async onCodePathEnd() {
if (context.themeDocset) {
const objects = await globalObjects(context.themeDocset);
objects.forEach((obj) => variableScopes.set(obj.name, []));
}
const objects = await globalObjects(themeDocset);
objects.forEach((obj) => variableScopes.set(obj.name, []));
variables.forEach((variable) => {

@@ -72,0 +77,0 @@ if (!variable.name)

@@ -168,3 +168,12 @@ "use strict";

});
(0, vitest_1.it)('should not report an offenses when definitions for global objects are unavailable', async () => {
const sourceCode = `
{{ my_var }}
`;
const offenses = await (0, test_1.runLiquidCheck)(index_1.UndefinedObject, sourceCode, 'file.liquid', {
themeDocset: null,
});
(0, vitest_1.expect)(offenses).toHaveLength(0);
});
});
//# sourceMappingURL=index.spec.js.map

@@ -41,2 +41,5 @@ "use strict";

__exportStar(require("./ignore"), exports);
const defaultErrorHandler = (_error) => {
// Silently ignores errors by default.
};
async function check(sourceCodes, config, dependencies) {

@@ -76,3 +79,4 @@ const pipelines = [];

}
await Promise.all(pipelines);
const onRejected = config.onError || defaultErrorHandler;
await Promise.all(pipelines.map((pipeline) => pipeline.catch(onRejected)));
return offenses.filter((offense) => !isDisabled(offense));

@@ -79,0 +83,0 @@ }

@@ -62,2 +62,3 @@ import { NodeTypes as LiquidHtmlNodeTypes, LiquidHtmlNode } from '@shopify/liquid-html-parser';

ignore?: string[];
onError?: (error: Error) => void;
}

@@ -64,0 +65,0 @@ export type NodeOfType<T extends SourceCodeType, NT> = Extract<AST[T], {

{
"name": "@shopify/theme-check-common",
"version": "1.14.1",
"version": "1.15.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/Shopify/theme-tools/blob/main/packages/theme-check-common/README.md",

@@ -216,2 +216,14 @@ import { expect, describe, it } from 'vitest';

});
it('should not report an offenses when definitions for global objects are unavailable', async () => {
const sourceCode = `
{{ my_var }}
`;
const offenses = await runLiquidCheck(UndefinedObject, sourceCode, 'file.liquid', {
themeDocset: null,
});
expect(offenses).toHaveLength(0);
});
});

@@ -42,2 +42,10 @@ import {

/**
* Skip this check when definitions for global objects are unavailable.
*/
if (!context.themeDocset) {
return {};
}
const themeDocset = context.themeDocset;
const variableScopes: Map<string, Scope[]> = new Map();

@@ -84,7 +92,5 @@ const variables: LiquidVariableLookup[] = [];

async onCodePathEnd() {
if (context.themeDocset) {
const objects = await globalObjects(context.themeDocset);
const objects = await globalObjects(themeDocset);
objects.forEach((obj) => variableScopes.set(obj.name, []));
}
objects.forEach((obj) => variableScopes.set(obj.name, []));

@@ -91,0 +97,0 @@ variables.forEach((variable) => {

@@ -34,2 +34,6 @@ import {

const defaultErrorHandler = (_error: Error): void => {
// Silently ignores errors by default.
};
export async function check(

@@ -73,3 +77,4 @@ sourceCodes: Theme,

await Promise.all(pipelines);
const onRejected = config.onError || defaultErrorHandler;
await Promise.all(pipelines.map((pipeline) => pipeline.catch(onRejected)));

@@ -76,0 +81,0 @@ return offenses.filter((offense) => !isDisabled(offense));

@@ -97,2 +97,3 @@ import { NodeTypes as LiquidHtmlNodeTypes, LiquidHtmlNode } from '@shopify/liquid-html-parser';

ignore?: string[];
onError?: (error: Error) => void;
}

@@ -99,0 +100,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

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