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.15.0 to 1.16.0

dist/checks/remote-asset/index.d.ts

10

CHANGELOG.md
# @shopify/theme-check-common
## 1.16.0
### Minor Changes
- 279a464: Replace `AssetUrlFilters` with `RemoteAsset`
### Patch Changes
- d71a5e2: Fix completion, hover and UndefinedObject reporting of tablerowloop and forloop variables
## 1.15.0

@@ -4,0 +14,0 @@

8

dist/checks/index.js

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

const asset_preload_1 = require("./asset-preload");
const asset_url_filters_1 = require("./asset-url-filters");
const remote_asset_1 = require("./remote-asset");
const cdn_preconnect_1 = require("./cdn-preconnect");

@@ -41,8 +41,7 @@ const deprecate_bgsizes_1 = require("./deprecate-bgsizes");

asset_size_javascript_1.AssetSizeJavaScript,
asset_url_filters_1.AssetUrlFilters,
cdn_preconnect_1.CdnPreconnect,
content_for_header_modification_1.ContentForHeaderModification,
deprecate_bgsizes_1.DeprecateBgsizes,
deprecated_filters_1.DeprecatedFilters,
deprecated_tags_1.DeprecatedTags,
deprecate_bgsizes_1.DeprecateBgsizes,
deprecate_lazysizes_1.DeprecateLazysizes,

@@ -57,6 +56,7 @@ img_width_and_height_1.ImgWidthAndHeight,

parser_blocking_script_1.ParserBlockingScript,
remote_asset_1.RemoteAsset,
required_layout_theme_object_1.RequiredLayoutThemeObject,
translation_key_exists_1.TranslationKeyExists,
undefined_object_1.UndefinedObject,
unknown_filter_1.UnknownFilter,
undefined_object_1.UndefinedObject,
unused_assign_1.UnusedAssign,

@@ -63,0 +63,0 @@ valid_html_translation_1.ValidHTMLTranslation,

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

async LiquidTag(node) {
var _a, _b;
var _a, _b, _c;
if (isLiquidTagAssign(node)) {

@@ -64,2 +64,6 @@ indexVariableScope(node.markup.name, {

});
indexVariableScope(node.name === 'for' ? 'forloop' : 'tablerowloop', {
start: node.blockStartPosition.end,
end: (_c = node.blockEndPosition) === null || _c === void 0 ? void 0 : _c.start,
});
}

@@ -66,0 +70,0 @@ },

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

});
(0, vitest_1.it)('should not report an offense for forloop/tablerowloop variables when in the correct context', async () => {
for (const tag of ['for', 'tablerow']) {
const sourceCode = `
{% ${tag} x in collections %}
{{ ${tag}loop }}
{% end${tag} %}
`;
const offenses = await (0, test_1.runLiquidCheck)(index_1.UndefinedObject, sourceCode, 'file.liquid');
(0, vitest_1.expect)(offenses).toHaveLength(0);
}
});
(0, vitest_1.it)('should report an offense for forloop/tablerowloop used outside of context', async () => {
const sourceCode = `
{{ forloop }}
{{ tablerowloop }}
`;
const offenses = await (0, test_1.runLiquidCheck)(index_1.UndefinedObject, sourceCode, 'file.liquid');
(0, vitest_1.expect)(offenses).toHaveLength(2);
});
(0, vitest_1.it)('should not report an offenses when definitions for global objects are unavailable', async () => {

@@ -170,0 +189,0 @@ const sourceCode = `

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

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

@@ -9,3 +9,3 @@ import {

import { AssetPreload } from './asset-preload';
import { AssetUrlFilters } from './asset-url-filters';
import { RemoteAsset } from './remote-asset';
import { CdnPreconnect } from './cdn-preconnect';

@@ -44,8 +44,7 @@ import { DeprecateBgsizes } from './deprecate-bgsizes';

AssetSizeJavaScript,
AssetUrlFilters,
CdnPreconnect,
ContentForHeaderModification,
DeprecateBgsizes,
DeprecatedFilters,
DeprecatedTags,
DeprecateBgsizes,
DeprecateLazysizes,

@@ -60,6 +59,7 @@ ImgWidthAndHeight,

ParserBlockingScript,
RemoteAsset,
RequiredLayoutThemeObject,
TranslationKeyExists,
UndefinedObject,
UnknownFilter,
UndefinedObject,
UnusedAssign,

@@ -66,0 +66,0 @@ ValidHTMLTranslation,

@@ -217,2 +217,27 @@ import { expect, describe, it } from 'vitest';

it('should not report an offense for forloop/tablerowloop variables when in the correct context', async () => {
for (const tag of ['for', 'tablerow']) {
const sourceCode = `
{% ${tag} x in collections %}
{{ ${tag}loop }}
{% end${tag} %}
`;
const offenses = await runLiquidCheck(UndefinedObject, sourceCode, 'file.liquid');
expect(offenses).toHaveLength(0);
}
});
it('should report an offense for forloop/tablerowloop used outside of context', async () => {
const sourceCode = `
{{ forloop }}
{{ tablerowloop }}
`;
const offenses = await runLiquidCheck(UndefinedObject, sourceCode, 'file.liquid');
expect(offenses).toHaveLength(2);
});
it('should not report an offenses when definitions for global objects are unavailable', async () => {

@@ -219,0 +244,0 @@ const sourceCode = `

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

});
indexVariableScope(node.name === 'for' ? 'forloop' : 'tablerowloop', {
start: node.blockStartPosition.end,
end: node.blockEndPosition?.start,
});
}

@@ -81,0 +85,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

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