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

@sketch-hq/sketch-file-format-ts

Package Overview
Dependencies
Maintainers
3
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sketch-hq/sketch-file-format-ts - npm Package Compare versions

Comparing version 5.2.4 to 6.0.0

dist/cjs/types.d.ts

16

CHANGELOG.md
# @sketch-hq/sketch-file-format-ts
## 6.0.0
### Major Changes
- 4704c97: Drop types for older schema versions. This is a breaking change.
Instead of `FileFormat1`, `FileFormat2` and `FileFormat3` in addition to the
latest file format version as `default`, types are now only exported as
`default` for the latest schemas.
To import specific versions of the file format, use specific versions of
`@sketch-hq/sketch-file-format-ts` instead.
### Patch Changes
- fa8a43b: Reorganise source code
## 5.2.4

@@ -4,0 +20,0 @@

17

dist/cjs/index.d.ts

@@ -1,5 +0,12 @@

import * as FileFormat1 from './v1-types.js';
import * as FileFormat2 from './v2-types.js';
import * as FileFormat3 from './v3-types.js';
export { FileFormat1, FileFormat2, FileFormat3 };
export default FileFormat3;
/**
* Types must be generated from the {@link ../../file-format|JSON Schema definitions}.
*
* To always use the latest schemas, either run `yarn build` from the monorepo root
* which first builds {@link @sketch-hq/sketch-file-format} before generating the
* types.
*
* Alternatively, running `yarn generate` from {@link ../|file-format-ts} generates
* the TypeScript types only, based on the previous build of the schemas.
*/
import * as FileFormat from './types';
export default FileFormat;

@@ -22,9 +22,13 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.FileFormat3 = exports.FileFormat2 = exports.FileFormat1 = void 0;
const FileFormat1 = __importStar(require("./v1-types.js"));
exports.FileFormat1 = FileFormat1;
const FileFormat2 = __importStar(require("./v2-types.js"));
exports.FileFormat2 = FileFormat2;
const FileFormat3 = __importStar(require("./v3-types.js"));
exports.FileFormat3 = FileFormat3;
exports.default = FileFormat3;
/**
* Types must be generated from the {@link ../../file-format|JSON Schema definitions}.
*
* To always use the latest schemas, either run `yarn build` from the monorepo root
* which first builds {@link @sketch-hq/sketch-file-format} before generating the
* types.
*
* Alternatively, running `yarn generate` from {@link ../|file-format-ts} generates
* the TypeScript types only, based on the previous build of the schemas.
*/
const FileFormat = __importStar(require("./types"));
exports.default = FileFormat;

@@ -1,5 +0,12 @@

import * as FileFormat1 from './v1-types.js';
import * as FileFormat2 from './v2-types.js';
import * as FileFormat3 from './v3-types.js';
export { FileFormat1, FileFormat2, FileFormat3 };
export default FileFormat3;
/**
* Types must be generated from the {@link ../../file-format|JSON Schema definitions}.
*
* To always use the latest schemas, either run `yarn build` from the monorepo root
* which first builds {@link @sketch-hq/sketch-file-format} before generating the
* types.
*
* Alternatively, running `yarn generate` from {@link ../|file-format-ts} generates
* the TypeScript types only, based on the previous build of the schemas.
*/
import * as FileFormat from './types';
export default FileFormat;

@@ -1,5 +0,12 @@

import * as FileFormat1 from './v1-types.js';
import * as FileFormat2 from './v2-types.js';
import * as FileFormat3 from './v3-types.js';
export { FileFormat1, FileFormat2, FileFormat3 };
export default FileFormat3;
/**
* Types must be generated from the {@link ../../file-format|JSON Schema definitions}.
*
* To always use the latest schemas, either run `yarn build` from the monorepo root
* which first builds {@link @sketch-hq/sketch-file-format} before generating the
* types.
*
* Alternatively, running `yarn generate` from {@link ../|file-format-ts} generates
* the TypeScript types only, based on the previous build of the schemas.
*/
import * as FileFormat from './types';
export default FileFormat;
{
"name": "@sketch-hq/sketch-file-format-ts",
"description": "TypeScript types for the Sketch File Format",
"version": "5.2.4",
"version": "6.0.0",
"main": "dist/cjs/index",

@@ -21,8 +21,5 @@ "types": "dist/cjs/index",

],
"dependencies": {
"@sketch-hq/sketch-file-format-1": "npm:@sketch-hq/sketch-file-format@1.1.7",
"@sketch-hq/sketch-file-format-2": "npm:@sketch-hq/sketch-file-format@2.0.3",
"@sketch-hq/sketch-file-format": "5.2.3"
},
"dependencies": {},
"devDependencies": {
"@sketch-hq/sketch-file-format": "5.2.3",
"@types/humps": "2.0.0",

@@ -33,3 +30,3 @@ "humps": "2.0.1",

"scripts": {
"generate": "ts-node ./scripts/generate.ts",
"generate": "ts-node ./scripts/generate.ts ./src/types.ts",
"build": "rm -rf dist && yarn generate && tsc --project tsconfig.json && tsc --project tsconfig.esm.json",

@@ -36,0 +33,0 @@ "test": "jest",

@@ -25,8 +25,2 @@ # Sketch File Format TS

Types for historical file formats are accessible via named exports
```typescript
import { FileFormat1, FileFormat2 } from '@sketch-hq/sketch-file-format-ts'
```
> Read about how file format versions map to Sketch document versions

@@ -71,21 +65,2 @@ > [here](https://github.com/sketch-hq/sketch-file-format)

Work with representations of Sketch files that could have a range of document
versions
```typescript
import {
FileFormat1,
FileFormat2,
FileFormat3,
} from '@sketch-hq/sketch-file-format-ts'
const processDocumentContents = (
contents: FileFormat1.Contents | FileFormat2.Contents | FileFormat3.Contents,
) => {
if (contents.meta.version === 119) {
// type narrowed to file format v1, i.e. Sketch documents with version 119
}
}
```
## Development

@@ -92,0 +67,0 @@

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