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

@colyseus/schema

Package Overview
Dependencies
Maintainers
2
Versions
315
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@colyseus/schema - npm Package Compare versions

Comparing version 1.0.39 to 1.0.40

7

lib/codegen/parser.d.ts

@@ -0,1 +1,2 @@

import * as ts from "typescript";
import { Class, Interface, Context } from "./types";

@@ -6,1 +7,7 @@ export declare function parseFiles(fileNames: string[], decoratorName?: string, context?: Context): {

};
/**
* TypeScript 4.8+ has introduced a change on how to access decorators.
* - https://github.com/microsoft/TypeScript/pull/49089
* - https://devblogs.microsoft.com/typescript/announcing-typescript-4-8/#decorators-are-placed-on-modifiers-on-typescripts-syntax-trees
*/
export declare function getDecorators(node: ts.Node | null | undefined): undefined | ts.Decorator[];

26

lib/codegen/parser.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseFiles = void 0;
exports.getDecorators = exports.parseFiles = void 0;
var ts = require("typescript");

@@ -85,3 +85,3 @@ var path = require("path");

var prop = (_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.parent;
var propDecorator = prop === null || prop === void 0 ? void 0 : prop.decorators;
var propDecorator = getDecorators(prop);
var hasExpression = (_c = prop === null || prop === void 0 ? void 0 : prop.expression) === null || _c === void 0 ? void 0 : _c.arguments;

@@ -197,2 +197,24 @@ /**

exports.parseFiles = parseFiles;
/**
* TypeScript 4.8+ has introduced a change on how to access decorators.
* - https://github.com/microsoft/TypeScript/pull/49089
* - https://devblogs.microsoft.com/typescript/announcing-typescript-4-8/#decorators-are-placed-on-modifiers-on-typescripts-syntax-trees
*/
function getDecorators(node) {
var _a;
if (node == undefined) {
return undefined;
}
// TypeScript 4.7 and below
if (node.decorators) {
return node.decorators;
}
// TypeScript 4.8 and above
if (ts.canHaveDecorators(node)) {
var decorators = ts.getDecorators(node);
return decorators ? Array.from(decorators) : undefined;
}
return (_a = node.modifiers) === null || _a === void 0 ? void 0 : _a.filter(ts.isDecorator);
}
exports.getDecorators = getDecorators;
//# sourceMappingURL=parser.js.map

7

package.json
{
"name": "@colyseus/schema",
"version": "1.0.39",
"version": "1.0.40",
"description": "Binary state serializer with delta encoding for games",

@@ -11,6 +11,4 @@ "bin": {

"watch": "tsc -w",
"test": "mocha --require ts-node/register test/*Test.ts test/**/*Test.ts",
"coverage": "nyc mocha --require ts-node/register --require source-map-support/register --recursive test/**Test.ts",
"generate-test-1": "bin/schema-codegen test-external/PrimitiveTypes.ts --namespace SchemaTest.PrimitiveTypes --output ../colyseus-unity3d/Assets/Editor/ColyseusTests/Schema/PrimitiveTypes",

@@ -27,3 +25,2 @@ "generate-test-2": "bin/schema-codegen test-external/ChildSchemaTypes.ts --namespace SchemaTest.ChildSchemaTypes --output ../colyseus-unity3d/Assets/Editor/ColyseusTests/Schema/ChildSchemaTypes",

"generate-test-11": "bin/schema-codegen test-external/MapSchemaMoveNullifyType.ts --namespace SchemaTest.MapSchemaMoveNullifyType --output ../colyseus-unity3d/Assets/Editor/ColyseusTests/Schema/MapSchemaMoveNullifyType",
"prepublishOnly": "npm run build"

@@ -83,3 +80,3 @@ },

"tslib": "^2.1.0",
"typescript": "^4.1.3"
"typescript": "^4.8.4"
},

@@ -86,0 +83,0 @@ "nyc": {

@@ -100,3 +100,3 @@ import * as ts from "typescript";

const prop: any = node.parent?.parent?.parent;
const propDecorator = prop?.decorators;
const propDecorator = getDecorators(prop);
const hasExpression = prop?.expression?.arguments;

@@ -252,2 +252,22 @@

return context.getStructures();
}
/**
* TypeScript 4.8+ has introduced a change on how to access decorators.
* - https://github.com/microsoft/TypeScript/pull/49089
* - https://devblogs.microsoft.com/typescript/announcing-typescript-4-8/#decorators-are-placed-on-modifiers-on-typescripts-syntax-trees
*/
export function getDecorators(node: ts.Node | null | undefined,): undefined | ts.Decorator[] {
if (node == undefined) { return undefined; }
// TypeScript 4.7 and below
if (node.decorators) { return node.decorators; }
// TypeScript 4.8 and above
if (ts.canHaveDecorators(node)) {
const decorators = ts.getDecorators(node);
return decorators ? Array.from(decorators) : undefined;
}
return node.modifiers?.filter(ts.isDecorator);
}

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