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
8
Versions
45
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 3.5.0 to 3.6.0

dist/checks/app-block-missing-schema/index.d.ts

12

CHANGELOG.md
# @shopify/theme-check-common
## 3.6.0
### Minor Changes
- b31e0f85: [internal] Add `offset` information on Schema objects
- 34c2268a: This update ensures that the AppBlockMissingSchema theme check will only run on block files on theme app extensions, to avoid errors surfacing when the theme check is incorrectly run on snippets. Renamed the check to make it more accurate (from MissingSchema to AppBlockMissingSchema).
### Patch Changes
- c74850c8: [Internal] Add template type interfaces
- c60e61ba: [Internal] Add schema raw value to schema node
## 3.5.0

@@ -4,0 +16,0 @@

4

dist/checks/index.js

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

const variable_name_1 = require("./variable-name");
const missing_schema_1 = require("./missing-schema");
const app_block_missing_schema_1 = require("./app-block-missing-schema");
exports.allChecks = [

@@ -75,3 +75,3 @@ app_block_valid_tags_1.AppBlockValidTags,

missing_template_1.MissingTemplate,
missing_schema_1.MissingSchema,
app_block_missing_schema_1.AppBlockMissingSchema,
pagination_size_1.PaginationSize,

@@ -78,0 +78,0 @@ parser_blocking_script_1.ParserBlockingScript,

@@ -5,4 +5,4 @@ import { AppBlockSchema, ThemeBlockSchema, IsValidSchema, LiquidHtmlNode, SectionSchema, SourceCode, SourceCodeType, UriString, Context, Schema } from './types';

export declare function isSection(uri: UriString): boolean;
export declare function isBlockSchema(schema: SectionSchema | ThemeBlockSchema | undefined): schema is ThemeBlockSchema;
export declare function isSectionSchema(schema: SectionSchema | ThemeBlockSchema | undefined): schema is SectionSchema;
export declare function isBlockSchema(schema: AppBlockSchema | SectionSchema | ThemeBlockSchema | undefined): schema is ThemeBlockSchema;
export declare function isSectionSchema(schema: AppBlockSchema | SectionSchema | ThemeBlockSchema | undefined): schema is SectionSchema;
export declare function toBlockSchema(uri: UriString, liquidAst: LiquidHtmlNode | Error, isValidSchema: IsValidSchema | undefined): Promise<ThemeBlockSchema>;

@@ -9,0 +9,0 @@ export declare function toSectionSchema(uri: UriString, liquidAst: LiquidHtmlNode | Error, isValidSchema: IsValidSchema | undefined): Promise<SectionSchema>;

@@ -83,5 +83,7 @@ "use strict";

validSchema: await toValidSchema(uri, schemaNode, parsed, isValidSchema),
offset: schemaNode instanceof Error ? 0 : schemaNode.blockStartPosition.end,
name,
parsed,
ast,
value: schemaNode instanceof Error ? '' : schemaNode.body.value,
};

@@ -101,5 +103,7 @@ }

validSchema: await toValidSchema(uri, schemaNode, parsed, isValidSchema),
offset: schemaNode instanceof Error ? 0 : schemaNode.blockStartPosition.end,
name,
parsed,
ast,
value: schemaNode instanceof Error ? '' : schemaNode.body.value,
};

@@ -116,5 +120,7 @@ }

type: types_1.ThemeSchemaType.AppBlock,
offset: schemaNode instanceof Error ? 0 : schemaNode.blockStartPosition.end,
name,
parsed,
ast,
value: schemaNode instanceof Error ? '' : schemaNode.body.value,
};

@@ -121,0 +127,0 @@ }

@@ -5,1 +5,2 @@ export { ThemeBlock } from './theme-block';

export { Preset } from './preset';
export { Template } from './template';

@@ -26,2 +26,6 @@ import { SourceCode, SourceCodeType } from '../types';

parsed: any | Error;
/** 0-based index of the start of JSON object in the document */
offset: number;
/** schema node value */
value: string;
}

@@ -28,0 +32,0 @@ /** See {@link ThemeSchema} */

{
"name": "@shopify/theme-check-common",
"version": "3.5.0",
"version": "3.6.0",
"license": "MIT",

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

@@ -47,3 +47,3 @@ import { ConfigTarget, JSONCheckDefinition, LiquidCheckDefinition } from '../types';

import { VariableName } from './variable-name';
import { MissingSchema } from './missing-schema';
import { AppBlockMissingSchema } from './app-block-missing-schema';

@@ -74,3 +74,3 @@ export const allChecks: (LiquidCheckDefinition | JSONCheckDefinition)[] = [

MissingTemplate,
MissingSchema,
AppBlockMissingSchema,
PaginationSize,

@@ -77,0 +77,0 @@ ParserBlockingScript,

@@ -25,2 +25,4 @@ import { expect, describe, it } from 'vitest';

type: ThemeSchemaType.Section,
offset: 0,
value: '',
}),

@@ -27,0 +29,0 @@ });

@@ -49,3 +49,3 @@ import { LiquidRawTag } from '@shopify/liquid-html-parser';

export function isBlockSchema(
schema: SectionSchema | ThemeBlockSchema | undefined,
schema: AppBlockSchema | SectionSchema | ThemeBlockSchema | undefined,
): schema is ThemeBlockSchema {

@@ -56,3 +56,3 @@ return schema?.type === ThemeSchemaType.Block;

export function isSectionSchema(
schema: SectionSchema | ThemeBlockSchema | undefined,
schema: AppBlockSchema | SectionSchema | ThemeBlockSchema | undefined,
): schema is SectionSchema {

@@ -86,8 +86,11 @@ return schema?.type === ThemeSchemaType.Section;

const ast = toAst(schemaNode);
return {
type: ThemeSchemaType.Block,
validSchema: await toValidSchema<ThemeBlock.Schema>(uri, schemaNode, parsed, isValidSchema),
offset: schemaNode instanceof Error ? 0 : schemaNode.blockStartPosition.end,
name,
parsed,
ast,
value: schemaNode instanceof Error ? '' : schemaNode.body.value,
};

@@ -108,8 +111,11 @@ }

const ast = toAst(schemaNode);
return {
type: ThemeSchemaType.Section,
validSchema: await toValidSchema(uri, schemaNode, parsed, isValidSchema),
offset: schemaNode instanceof Error ? 0 : schemaNode.blockStartPosition.end,
name,
parsed,
ast,
value: schemaNode instanceof Error ? '' : schemaNode.body.value,
};

@@ -127,7 +133,10 @@ }

const ast = toAst(schemaNode);
return {
type: ThemeSchemaType.AppBlock,
offset: schemaNode instanceof Error ? 0 : schemaNode.blockStartPosition.end,
name,
parsed,
ast,
value: schemaNode instanceof Error ? '' : schemaNode.body.value,
};

@@ -134,0 +143,0 @@ }

@@ -5,1 +5,2 @@ export { ThemeBlock } from './theme-block';

export { Preset } from './preset';
export { Template } from './template';

@@ -32,2 +32,8 @@ import { SourceCode, SourceCodeType } from '../types';

parsed: any | Error;
/** 0-based index of the start of JSON object in the document */
offset: number;
/** schema node value */
value: string;
}

@@ -34,0 +40,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

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