@evoke-platform/plugin-scripts
Advanced tools
| /** @widget */ | ||
| export declare function Widget1(): null; | ||
| /** @widget */ | ||
| export declare function Widget2(): null; |
| "use strict"; | ||
| // Copyright (c) 2023 System Automation Corporation. | ||
| // This file is licensed under the MIT License. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.Widget2 = exports.Widget1 = void 0; | ||
| /** @widget */ | ||
| function Widget1() { | ||
| return null; | ||
| } | ||
| exports.Widget1 = Widget1; | ||
| /** @widget */ | ||
| function Widget2() { | ||
| return null; | ||
| } | ||
| exports.Widget2 = Widget2; | ||
| //# sourceMappingURL=widget.js.map |
| {"version":3,"file":"widget.js","sourceRoot":"","sources":["../../../../../src/__tests__/manifest/badFiles/multipleWidgets/widget.tsx"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,+CAA+C;;;AAE/C,cAAc;AACd,SAAgB,OAAO;IACnB,OAAO,IAAI,CAAC;AAChB,CAAC;AAFD,0BAEC;AAED,cAAc;AACd,SAAgB,OAAO;IACnB,OAAO,IAAI,CAAC;AAChB,CAAC;AAFD,0BAEC"} |
| /** @widget */ | ||
| export declare class NotFunctionComponent { | ||
| } |
| "use strict"; | ||
| // Copyright (c) 2023 System Automation Corporation. | ||
| // This file is licensed under the MIT License. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.NotFunctionComponent = void 0; | ||
| /** @widget */ | ||
| class NotFunctionComponent { | ||
| } | ||
| exports.NotFunctionComponent = NotFunctionComponent; | ||
| //# sourceMappingURL=widget.js.map |
| {"version":3,"file":"widget.js","sourceRoot":"","sources":["../../../../../src/__tests__/manifest/badFiles/notFunctionComponent/widget.tsx"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,+CAA+C;;;AAE/C,cAAc;AACd,MAAa,oBAAoB;CAAG;AAApC,oDAAoC"} |
| export {}; |
| "use strict"; | ||
| // Copyright (c) 2023 System Automation Corporation. | ||
| // This file is licensed under the MIT License. | ||
| var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
| if (k2 === undefined) k2 = k; | ||
| var desc = Object.getOwnPropertyDescriptor(m, k); | ||
| if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
| desc = { enumerable: true, get: function() { return m[k]; } }; | ||
| } | ||
| Object.defineProperty(o, k2, desc); | ||
| }) : (function(o, m, k, k2) { | ||
| if (k2 === undefined) k2 = k; | ||
| o[k2] = m[k]; | ||
| })); | ||
| var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
| Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
| }) : function(o, v) { | ||
| o["default"] = v; | ||
| }); | ||
| var __importStar = (this && this.__importStar) || function (mod) { | ||
| if (mod && mod.__esModule) return mod; | ||
| var result = {}; | ||
| if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
| __setModuleDefault(result, mod); | ||
| return result; | ||
| }; | ||
| var __importDefault = (this && this.__importDefault) || function (mod) { | ||
| return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const chai_1 = __importStar(require("chai")); | ||
| const chai_as_promised_1 = __importDefault(require("chai-as-promised")); | ||
| const dirty_chai_1 = __importDefault(require("dirty-chai")); | ||
| const manifest_1 = require("../../manifest"); | ||
| chai_1.default.use(dirty_chai_1.default).use(chai_as_promised_1.default); | ||
| const Timeout = 15000; | ||
| describe('Scanner', () => { | ||
| const scanner = new manifest_1.Scanner('src/__tests__/manifest/testFiles', { defaultVersion: '1-test' }); | ||
| let widgets = {}; | ||
| before(async function () { | ||
| this.timeout(Timeout); | ||
| widgets = (await scanner.scan()).widgets; | ||
| }); | ||
| describe('widget', () => { | ||
| it('detects components marked with @widget', () => { | ||
| (0, chai_1.expect)(widgets['Basic']).to.eql({ | ||
| id: 'Basic', | ||
| name: 'Basic', | ||
| description: '', | ||
| version: '1-test', | ||
| src: 'src/__tests__/manifest/testFiles/basic.tsx', | ||
| properties: [], | ||
| }); | ||
| }); | ||
| it('detects components marked with @widgetName', () => { | ||
| (0, chai_1.expect)(widgets['Basic2']).to.eql({ | ||
| id: 'Basic2', | ||
| name: 'Basic2', | ||
| description: '', | ||
| version: '1-test', | ||
| src: 'src/__tests__/manifest/testFiles/basic2.tsx', | ||
| properties: [], | ||
| }); | ||
| }); | ||
| it('allows overriding widget id', () => { | ||
| (0, chai_1.expect)(widgets['CustomId']).to.eql({ | ||
| id: 'CustomId', | ||
| name: 'CustomId', | ||
| description: '', | ||
| version: '1-test', | ||
| src: 'src/__tests__/manifest/testFiles/widgetId.tsx', | ||
| properties: [], | ||
| }); | ||
| }); | ||
| it('allows setting widget name', () => { | ||
| (0, chai_1.expect)(widgets['WidgetName']).to.eql({ | ||
| id: 'WidgetName', | ||
| name: 'Test Widget Name', | ||
| description: '', | ||
| version: '1-test', | ||
| src: 'src/__tests__/manifest/testFiles/widgetName.tsx', | ||
| properties: [], | ||
| }); | ||
| }); | ||
| it('allows setting widget description', () => { | ||
| (0, chai_1.expect)(widgets['WidgetDescription']).to.eql({ | ||
| id: 'WidgetDescription', | ||
| name: 'WidgetDescription', | ||
| description: 'This is a sample description for a widget. It may wrap to multiple lines.', | ||
| version: '1-test', | ||
| src: 'src/__tests__/manifest/testFiles/description.tsx', | ||
| properties: [], | ||
| }); | ||
| }); | ||
| it('allows overriding version for widget', () => { | ||
| (0, chai_1.expect)(widgets['WidgetVersion']).to.eql({ | ||
| id: 'WidgetVersion', | ||
| name: 'WidgetVersion', | ||
| description: '', | ||
| version: 'testVersion', | ||
| src: 'src/__tests__/manifest/testFiles/version.tsx', | ||
| properties: [], | ||
| }); | ||
| }); | ||
| it('fails if module contains multiple widgets', async () => { | ||
| const scanner = new manifest_1.Scanner('src/__tests__/manifest/badFiles/multipleWidgets'); | ||
| await (0, chai_1.expect)(scanner.scan()).to.be.rejectedWith('Multiple @widget declarations in src/__tests__/manifest/badFiles/multipleWidgets/widget.tsx, only the default export can be declared a widget'); | ||
| }).timeout(Timeout); | ||
| it('fails if @widget is not on a function', async () => { | ||
| const scanner = new manifest_1.Scanner('src/__tests__/manifest/badFiles/notFunctionComponent'); | ||
| await (0, chai_1.expect)(scanner.scan()).to.be.rejectedWith('@widget must be declared on a FunctionComponent'); | ||
| }).timeout(Timeout); | ||
| }); | ||
| describe('props', () => { | ||
| it('detects properties through type reference', () => { | ||
| (0, chai_1.expect)(widgets['PropsTypeReference']).to.eql({ | ||
| id: 'PropsTypeReference', | ||
| name: 'PropsTypeReference', | ||
| description: '', | ||
| version: '1-test', | ||
| src: 'src/__tests__/manifest/testFiles/typeReferenceProps.tsx', | ||
| properties: [ | ||
| { | ||
| name: 'textProperty', | ||
| displayName: 'textProperty', | ||
| type: 'text', | ||
| optional: false, | ||
| }, | ||
| ], | ||
| }); | ||
| }); | ||
| it('detects properties on type literal', () => { | ||
| (0, chai_1.expect)(widgets['PropsTypeLiteral']).to.eql({ | ||
| id: 'PropsTypeLiteral', | ||
| name: 'PropsTypeLiteral', | ||
| description: '', | ||
| version: '1-test', | ||
| src: 'src/__tests__/manifest/testFiles/typeLiteralProps.tsx', | ||
| properties: [ | ||
| { | ||
| name: 'textProperty', | ||
| displayName: 'textProperty', | ||
| type: 'text', | ||
| optional: false, | ||
| }, | ||
| ], | ||
| }); | ||
| }); | ||
| xit('detects properties of intersection types', () => { | ||
| (0, chai_1.expect)(widgets['PropsIntersectionType']).to.eql({ | ||
| id: 'PropsIntersectionType', | ||
| name: 'PropsIntersectionType', | ||
| description: '', | ||
| version: '1-test', | ||
| src: 'src/__tests__/manifest/testFiles/intersectionTypeProps.tsx', | ||
| properties: [ | ||
| { | ||
| name: 'base', | ||
| displayName: 'base', | ||
| type: 'text', | ||
| optional: false, | ||
| }, | ||
| { | ||
| name: 'textProperty', | ||
| displayName: 'textProperty', | ||
| type: 'text', | ||
| optional: false, | ||
| }, | ||
| ], | ||
| }); | ||
| }); | ||
| it('allows setting property name', () => { | ||
| (0, chai_1.expect)(widgets['PropertyName']).to.eql({ | ||
| id: 'PropertyName', | ||
| name: 'PropertyName', | ||
| description: '', | ||
| version: '1-test', | ||
| src: 'src/__tests__/manifest/testFiles/propertyName.tsx', | ||
| properties: [ | ||
| { | ||
| name: 'textProperty', | ||
| displayName: 'Text Property', | ||
| type: 'text', | ||
| optional: false, | ||
| }, | ||
| ], | ||
| }); | ||
| }); | ||
| it('allows overriding property type', () => { | ||
| (0, chai_1.expect)(widgets['PropertyType']).to.eql({ | ||
| id: 'PropertyType', | ||
| name: 'PropertyType', | ||
| description: '', | ||
| version: '1-test', | ||
| src: 'src/__tests__/manifest/testFiles/propertyType.tsx', | ||
| properties: [ | ||
| { | ||
| name: 'choicesProperty', | ||
| displayName: 'choicesProperty', | ||
| type: 'choices', | ||
| optional: false, | ||
| }, | ||
| ], | ||
| }); | ||
| }); | ||
| it('detects optional properties', () => { | ||
| (0, chai_1.expect)(widgets['OptionalProperty']).to.eql({ | ||
| id: 'OptionalProperty', | ||
| name: 'OptionalProperty', | ||
| description: '', | ||
| version: '1-test', | ||
| src: 'src/__tests__/manifest/testFiles/optionalProperty.tsx', | ||
| properties: [ | ||
| { | ||
| name: 'textProperty', | ||
| displayName: 'textProperty', | ||
| type: 'text', | ||
| optional: true, | ||
| }, | ||
| ], | ||
| }); | ||
| }); | ||
| it('detects properties that can be undefined', () => { | ||
| (0, chai_1.expect)(widgets['OptionalProperty2']).to.eql({ | ||
| id: 'OptionalProperty2', | ||
| name: 'OptionalProperty2', | ||
| description: '', | ||
| version: '1-test', | ||
| src: 'src/__tests__/manifest/testFiles/optionalProperty2.tsx', | ||
| properties: [ | ||
| { | ||
| name: 'textProperty', | ||
| displayName: 'textProperty', | ||
| type: 'text', | ||
| optional: true, | ||
| }, | ||
| ], | ||
| }); | ||
| }); | ||
| it('infers type of number properties', () => { | ||
| (0, chai_1.expect)(widgets['NumberProperty']).to.eql({ | ||
| id: 'NumberProperty', | ||
| name: 'NumberProperty', | ||
| description: '', | ||
| version: '1-test', | ||
| src: 'src/__tests__/manifest/testFiles/numberProperty.tsx', | ||
| properties: [ | ||
| { | ||
| name: 'numProperty', | ||
| displayName: 'numProperty', | ||
| type: 'number', | ||
| optional: false, | ||
| }, | ||
| ], | ||
| }); | ||
| }); | ||
| xit('infers type of record properties', () => { | ||
| (0, chai_1.expect)(widgets['RecordProperty']).to.eql({ | ||
| id: 'RecordProperty', | ||
| name: 'RecordProperty', | ||
| description: '', | ||
| version: '1-test', | ||
| src: 'src/__tests__/manifest/testFiles/recordProperty.tsx', | ||
| properties: [ | ||
| { | ||
| name: 'recordProperty', | ||
| displayName: 'recordProperty', | ||
| type: 'inputGroup', | ||
| optional: false, | ||
| inputGroup: [ | ||
| { | ||
| name: 'nested1', | ||
| displayName: 'nested1', | ||
| type: 'text', | ||
| optional: false, | ||
| }, | ||
| { | ||
| name: 'nested2', | ||
| displayName: 'nested2', | ||
| type: 'number', | ||
| optional: false, | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
| }); | ||
| }); | ||
| }); | ||
| }); | ||
| //# sourceMappingURL=scanner.unit.js.map |
| {"version":3,"file":"scanner.unit.js","sourceRoot":"","sources":["../../../src/__tests__/manifest/scanner.unit.ts"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,+CAA+C;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE/C,6CAAoC;AACpC,wEAA8C;AAC9C,4DAAmC;AAEnC,6CAA2D;AAE3D,cAAI,CAAC,GAAG,CAAC,oBAAS,CAAC,CAAC,GAAG,CAAC,0BAAc,CAAC,CAAC;AAExC,MAAM,OAAO,GAAG,KAAK,CAAC;AAEtB,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACrB,MAAM,OAAO,GAAG,IAAI,kBAAO,CAAC,kCAAkC,EAAE,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC9F,IAAI,OAAO,GAAiC,EAAE,CAAC;IAE/C,MAAM,CAA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CAAC,CAAC,EAAE,CAAC,GAAG,CAAC;gBACrC,EAAE,EAAE,gBAAgB;gBACpB,IAAI,EAAE,gBAAgB;gBACtB,WAAW,EAAE,EAAE;gBACf,OAAO,EAAE,QAAQ;gBACjB,GAAG,EAAE,qDAAqD;gBAC1D,UAAU,EAAE;oBACR;wBACI,IAAI,EAAE,aAAa;wBACnB,WAAW,EAAE,aAAa;wBAC1B,IAAI,EAAE,QAAQ;wBACd,QAAQ,EAAE,KAAK;qBAClB;iBACJ;aACJ,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;QAEH,GAAG,CAAC,kCAAkC,EAAE,GAAG,EAAE;YACzC,IAAA,aAAM,EAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC;gBACrC,EAAE,EAAE,gBAAgB;gBACpB,IAAI,EAAE,gBAAgB;gBACtB,WAAW,EAAE,EAAE;gBACf,OAAO,EAAE,QAAQ;gBACjB,GAAG,EAAE,qDAAqD;gBAC1D,UAAU,EAAE;oBACR;wBACI,IAAI,EAAE,gBAAgB;wBACtB,WAAW,EAAE,gBAAgB;wBAC7B,IAAI,EAAE,YAAY;wBAClB,QAAQ,EAAE,KAAK;wBACf,UAAU,EAAE;4BACR;gCACI,IAAI,EAAE,SAAS;gCACf,WAAW,EAAE,SAAS;gCACtB,IAAI,EAAE,MAAM;gCACZ,QAAQ,EAAE,KAAK;6BAClB;4BACD;gCACI,IAAI,EAAE,SAAS;gCACf,WAAW,EAAE,SAAS;gCACtB,IAAI,EAAE,QAAQ;gCACd,QAAQ,EAAE,KAAK;6BAClB;yBACJ;qBACJ;iBACJ;aACJ,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"} |
| /** @widget */ | ||
| declare function Basic(): null; | ||
| export default Basic; |
| "use strict"; | ||
| // Copyright (c) 2023 System Automation Corporation. | ||
| // This file is licensed under the MIT License. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| /** @widget */ | ||
| function Basic() { | ||
| return null; | ||
| } | ||
| exports.default = Basic; | ||
| //# sourceMappingURL=basic.js.map |
| {"version":3,"file":"basic.js","sourceRoot":"","sources":["../../../../src/__tests__/manifest/testFiles/basic.tsx"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,+CAA+C;;AAE/C,cAAc;AACd,SAAS,KAAK;IACV,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,kBAAe,KAAK,CAAC"} |
| /** @widgetName */ | ||
| declare function Basic2(): null; | ||
| export default Basic2; |
| "use strict"; | ||
| // Copyright (c) 2023 System Automation Corporation. | ||
| // This file is licensed under the MIT License. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| /** @widgetName */ | ||
| function Basic2() { | ||
| return null; | ||
| } | ||
| exports.default = Basic2; | ||
| //# sourceMappingURL=basic2.js.map |
| {"version":3,"file":"basic2.js","sourceRoot":"","sources":["../../../../src/__tests__/manifest/testFiles/basic2.tsx"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,+CAA+C;;AAE/C,kBAAkB;AAClB,SAAS,MAAM;IACX,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,kBAAe,MAAM,CAAC"} |
| /** | ||
| * This is a sample description for a widget. It may wrap to | ||
| * multiple lines. | ||
| * | ||
| * @widget | ||
| */ | ||
| declare function WidgetDescription(): null; | ||
| export default WidgetDescription; |
| "use strict"; | ||
| // Copyright (c) 2023 System Automation Corporation. | ||
| // This file is licensed under the MIT License. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| /** | ||
| * This is a sample description for a widget. It may wrap to | ||
| * multiple lines. | ||
| * | ||
| * @widget | ||
| */ | ||
| function WidgetDescription() { | ||
| return null; | ||
| } | ||
| exports.default = WidgetDescription; | ||
| //# sourceMappingURL=description.js.map |
| {"version":3,"file":"description.js","sourceRoot":"","sources":["../../../../src/__tests__/manifest/testFiles/description.tsx"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,+CAA+C;;AAE/C;;;;;GAKG;AACH,SAAS,iBAAiB;IACtB,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,kBAAe,iBAAiB,CAAC"} |
| type BaseType = { | ||
| base: string; | ||
| }; | ||
| type PropsType = BaseType & { | ||
| textProperty: string; | ||
| }; | ||
| /** @widget */ | ||
| declare function PropsIntersectionType(props: PropsType): null; | ||
| export default PropsIntersectionType; |
| "use strict"; | ||
| // Copyright (c) 2023 System Automation Corporation. | ||
| // This file is licensed under the MIT License. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| /** @widget */ | ||
| function PropsIntersectionType(props) { | ||
| return null; | ||
| } | ||
| exports.default = PropsIntersectionType; | ||
| //# sourceMappingURL=intersectionTypeProps.js.map |
| {"version":3,"file":"intersectionTypeProps.js","sourceRoot":"","sources":["../../../../src/__tests__/manifest/testFiles/intersectionTypeProps.tsx"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,+CAA+C;;AAU/C,cAAc;AACd,SAAS,qBAAqB,CAAC,KAAgB;IAC3C,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,kBAAe,qBAAqB,CAAC"} |
| type PropsType = { | ||
| numProperty: number; | ||
| }; | ||
| /** @widget */ | ||
| declare function NumberProperty(props: PropsType): null; | ||
| export default NumberProperty; |
| "use strict"; | ||
| // Copyright (c) 2023 System Automation Corporation. | ||
| // This file is licensed under the MIT License. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| /** @widget */ | ||
| function NumberProperty(props) { | ||
| return null; | ||
| } | ||
| exports.default = NumberProperty; | ||
| //# sourceMappingURL=numberProperty.js.map |
| {"version":3,"file":"numberProperty.js","sourceRoot":"","sources":["../../../../src/__tests__/manifest/testFiles/numberProperty.tsx"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,+CAA+C;;AAM/C,cAAc;AACd,SAAS,cAAc,CAAC,KAAgB;IACpC,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,kBAAe,cAAc,CAAC"} |
| type PropsType = { | ||
| textProperty?: string; | ||
| }; | ||
| /** @widget */ | ||
| declare function OptionalProperty(props: PropsType): null; | ||
| export default OptionalProperty; |
| "use strict"; | ||
| // Copyright (c) 2023 System Automation Corporation. | ||
| // This file is licensed under the MIT License. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| /** @widget */ | ||
| function OptionalProperty(props) { | ||
| return null; | ||
| } | ||
| exports.default = OptionalProperty; | ||
| //# sourceMappingURL=optionalProperty.js.map |
| {"version":3,"file":"optionalProperty.js","sourceRoot":"","sources":["../../../../src/__tests__/manifest/testFiles/optionalProperty.tsx"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,+CAA+C;;AAM/C,cAAc;AACd,SAAS,gBAAgB,CAAC,KAAgB;IACtC,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,kBAAe,gBAAgB,CAAC"} |
| type PropsType = { | ||
| textProperty: string | undefined; | ||
| }; | ||
| /** @widget */ | ||
| declare function OptionalProperty2(props: PropsType): null; | ||
| export default OptionalProperty2; |
| "use strict"; | ||
| // Copyright (c) 2023 System Automation Corporation. | ||
| // This file is licensed under the MIT License. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| /** @widget */ | ||
| function OptionalProperty2(props) { | ||
| return null; | ||
| } | ||
| exports.default = OptionalProperty2; | ||
| //# sourceMappingURL=optionalProperty2.js.map |
| {"version":3,"file":"optionalProperty2.js","sourceRoot":"","sources":["../../../../src/__tests__/manifest/testFiles/optionalProperty2.tsx"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,+CAA+C;;AAM/C,cAAc;AACd,SAAS,iBAAiB,CAAC,KAAgB;IACvC,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,kBAAe,iBAAiB,CAAC"} |
| type PropsType = { | ||
| /** | ||
| * @propertyName Text Property | ||
| */ | ||
| textProperty: string; | ||
| }; | ||
| /** @widget */ | ||
| declare function PropertyName(props: PropsType): null; | ||
| export default PropertyName; |
| "use strict"; | ||
| // Copyright (c) 2023 System Automation Corporation. | ||
| // This file is licensed under the MIT License. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| /** @widget */ | ||
| function PropertyName(props) { | ||
| return null; | ||
| } | ||
| exports.default = PropertyName; | ||
| //# sourceMappingURL=propertyName.js.map |
| {"version":3,"file":"propertyName.js","sourceRoot":"","sources":["../../../../src/__tests__/manifest/testFiles/propertyName.tsx"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,+CAA+C;;AAS/C,cAAc;AACd,SAAS,YAAY,CAAC,KAAgB;IAClC,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,kBAAe,YAAY,CAAC"} |
| type PropsType = { | ||
| /** | ||
| * @propertyType choices | ||
| */ | ||
| choicesProperty: string; | ||
| }; | ||
| /** @widget */ | ||
| declare function PropertyType(props: PropsType): null; | ||
| export default PropertyType; |
| "use strict"; | ||
| // Copyright (c) 2023 System Automation Corporation. | ||
| // This file is licensed under the MIT License. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| /** @widget */ | ||
| function PropertyType(props) { | ||
| return null; | ||
| } | ||
| exports.default = PropertyType; | ||
| //# sourceMappingURL=propertyType.js.map |
| {"version":3,"file":"propertyType.js","sourceRoot":"","sources":["../../../../src/__tests__/manifest/testFiles/propertyType.tsx"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,+CAA+C;;AAS/C,cAAc;AACd,SAAS,YAAY,CAAC,KAAgB;IAClC,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,kBAAe,YAAY,CAAC"} |
| type PropsType = { | ||
| recordProperty: { | ||
| nested1: string; | ||
| nested2: number; | ||
| }; | ||
| }; | ||
| /** @widget */ | ||
| declare function RecordProperty(props: PropsType): null; | ||
| export default RecordProperty; |
| "use strict"; | ||
| // Copyright (c) 2023 System Automation Corporation. | ||
| // This file is licensed under the MIT License. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| /** @widget */ | ||
| function RecordProperty(props) { | ||
| return null; | ||
| } | ||
| exports.default = RecordProperty; | ||
| //# sourceMappingURL=recordProperty.js.map |
| {"version":3,"file":"recordProperty.js","sourceRoot":"","sources":["../../../../src/__tests__/manifest/testFiles/recordProperty.tsx"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,+CAA+C;;AAS/C,cAAc;AACd,SAAS,cAAc,CAAC,KAAgB;IACpC,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,kBAAe,cAAc,CAAC"} |
| /** @widget */ | ||
| declare function PropsTypeLiteral(props: { | ||
| textProperty: string; | ||
| }): null; | ||
| export default PropsTypeLiteral; |
| "use strict"; | ||
| // Copyright (c) 2023 System Automation Corporation. | ||
| // This file is licensed under the MIT License. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| /** @widget */ | ||
| function PropsTypeLiteral(props) { | ||
| return null; | ||
| } | ||
| exports.default = PropsTypeLiteral; | ||
| //# sourceMappingURL=typeLiteralProps.js.map |
| {"version":3,"file":"typeLiteralProps.js","sourceRoot":"","sources":["../../../../src/__tests__/manifest/testFiles/typeLiteralProps.tsx"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,+CAA+C;;AAE/C,cAAc;AACd,SAAS,gBAAgB,CAAC,KAA+B;IACrD,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,kBAAe,gBAAgB,CAAC"} |
| type PropsType = { | ||
| textProperty: string; | ||
| }; | ||
| /** @widget */ | ||
| declare function PropsTypeReference(props: PropsType): null; | ||
| export default PropsTypeReference; |
| "use strict"; | ||
| // Copyright (c) 2023 System Automation Corporation. | ||
| // This file is licensed under the MIT License. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| /** @widget */ | ||
| function PropsTypeReference(props) { | ||
| return null; | ||
| } | ||
| exports.default = PropsTypeReference; | ||
| //# sourceMappingURL=typeReferenceProps.js.map |
| {"version":3,"file":"typeReferenceProps.js","sourceRoot":"","sources":["../../../../src/__tests__/manifest/testFiles/typeReferenceProps.tsx"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,+CAA+C;;AAM/C,cAAc;AACd,SAAS,kBAAkB,CAAC,KAAgB;IACxC,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,kBAAe,kBAAkB,CAAC"} |
| /** | ||
| * @widget | ||
| * @widgetVersion testVersion | ||
| * */ | ||
| declare function WidgetVersion(): null; | ||
| export default WidgetVersion; |
| "use strict"; | ||
| // Copyright (c) 2023 System Automation Corporation. | ||
| // This file is licensed under the MIT License. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| /** | ||
| * @widget | ||
| * @widgetVersion testVersion | ||
| * */ | ||
| function WidgetVersion() { | ||
| return null; | ||
| } | ||
| exports.default = WidgetVersion; | ||
| //# sourceMappingURL=version.js.map |
| {"version":3,"file":"version.js","sourceRoot":"","sources":["../../../../src/__tests__/manifest/testFiles/version.tsx"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,+CAA+C;;AAE/C;;;KAGK;AACL,SAAS,aAAa;IAClB,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,kBAAe,aAAa,CAAC"} |
| /** @widget CustomId */ | ||
| declare function Widget(): null; | ||
| export default Widget; |
| "use strict"; | ||
| // Copyright (c) 2023 System Automation Corporation. | ||
| // This file is licensed under the MIT License. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| /** @widget CustomId */ | ||
| function Widget() { | ||
| return null; | ||
| } | ||
| exports.default = Widget; | ||
| //# sourceMappingURL=widgetId.js.map |
| {"version":3,"file":"widgetId.js","sourceRoot":"","sources":["../../../../src/__tests__/manifest/testFiles/widgetId.tsx"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,+CAA+C;;AAE/C,uBAAuB;AACvB,SAAS,MAAM;IACX,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,kBAAe,MAAM,CAAC"} |
| /** @widgetName Test Widget Name */ | ||
| declare function WidgetName(): null; | ||
| export default WidgetName; |
| "use strict"; | ||
| // Copyright (c) 2023 System Automation Corporation. | ||
| // This file is licensed under the MIT License. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| /** @widgetName Test Widget Name */ | ||
| function WidgetName() { | ||
| return null; | ||
| } | ||
| exports.default = WidgetName; | ||
| //# sourceMappingURL=widgetName.js.map |
| {"version":3,"file":"widgetName.js","sourceRoot":"","sources":["../../../../src/__tests__/manifest/testFiles/widgetName.tsx"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,+CAA+C;;AAE/C,mCAAmC;AACnC,SAAS,UAAU;IACf,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,kBAAe,UAAU,CAAC"} |
| export * from './manifest'; |
| "use strict"; | ||
| // Copyright (c) 2023 System Automation Corporation. | ||
| // This file is licensed under the MIT License. | ||
| var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
| if (k2 === undefined) k2 = k; | ||
| var desc = Object.getOwnPropertyDescriptor(m, k); | ||
| if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
| desc = { enumerable: true, get: function() { return m[k]; } }; | ||
| } | ||
| Object.defineProperty(o, k2, desc); | ||
| }) : (function(o, m, k, k2) { | ||
| if (k2 === undefined) k2 = k; | ||
| o[k2] = m[k]; | ||
| })); | ||
| var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
| for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| __exportStar(require("./manifest"), exports); | ||
| //# sourceMappingURL=index.js.map |
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,+CAA+C;;;;;;;;;;;;;;;;AAE/C,6CAA2B"} |
| import _debug from 'debug'; | ||
| declare const debug: _debug.Debugger; | ||
| export default debug; |
| "use strict"; | ||
| // Copyright (c) 2023 System Automation Corporation. | ||
| // This file is licensed under the MIT License. | ||
| var __importDefault = (this && this.__importDefault) || function (mod) { | ||
| return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const debug_1 = __importDefault(require("debug")); | ||
| const debug = (0, debug_1.default)('plugin-scripts:manifest'); | ||
| exports.default = debug; | ||
| //# sourceMappingURL=debug.js.map |
| {"version":3,"file":"debug.js","sourceRoot":"","sources":["../../src/manifest/debug.ts"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,+CAA+C;;;;;AAE/C,kDAA2B;AAE3B,MAAM,KAAK,GAAG,IAAA,eAAM,EAAC,yBAAyB,CAAC,CAAC;AAEhD,kBAAe,KAAK,CAAC"} |
| export type WidgetDescriptor = { | ||
| id: string; | ||
| name: string; | ||
| description?: string; | ||
| version?: string; | ||
| src: string; | ||
| properties: WidgetPropertyDescriptor[]; | ||
| }; | ||
| export type WidgetPropertyDescriptor = { | ||
| name: string; | ||
| displayName?: string; | ||
| type: string; | ||
| isOptional?: boolean; | ||
| [key: string]: unknown; | ||
| }; |
| "use strict"; | ||
| // Copyright (c) 2023 System Automation Corporation. | ||
| // This file is licensed under the MIT License. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| //# sourceMappingURL=descriptors.js.map |
| {"version":3,"file":"descriptors.js","sourceRoot":"","sources":["../../src/manifest/descriptors.ts"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,+CAA+C"} |
| import { Node } from 'typescript'; | ||
| export declare function locationString(compilerNode: Node): string; | ||
| export declare class SyntaxError extends Error { | ||
| constructor(message: string, compilerNode: Node); | ||
| } |
| "use strict"; | ||
| // Copyright (c) 2023 System Automation Corporation. | ||
| // This file is licensed under the MIT License. | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.SyntaxError = exports.locationString = void 0; | ||
| function locationString(compilerNode) { | ||
| const sourceFile = compilerNode.getSourceFile(); | ||
| const location = sourceFile.getLineAndCharacterOfPosition(compilerNode.pos); | ||
| return `${sourceFile.fileName}(${location.line + 1},${location.character + 1})`; | ||
| } | ||
| exports.locationString = locationString; | ||
| class SyntaxError extends Error { | ||
| constructor(message, compilerNode) { | ||
| super(`${locationString(compilerNode)}: ${message}`); | ||
| } | ||
| } | ||
| exports.SyntaxError = SyntaxError; | ||
| //# sourceMappingURL=errors.js.map |
| {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/manifest/errors.ts"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,+CAA+C;;;AAI/C,SAAgB,cAAc,CAAC,YAAkB;IAC7C,MAAM,UAAU,GAAG,YAAY,CAAC,aAAa,EAAE,CAAC;IAChD,MAAM,QAAQ,GAAG,UAAU,CAAC,6BAA6B,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IAE5E,OAAO,GAAG,UAAU,CAAC,QAAQ,IAAI,QAAQ,CAAC,IAAI,GAAG,CAAC,IAAI,QAAQ,CAAC,SAAS,GAAG,CAAC,GAAG,CAAC;AACpF,CAAC;AALD,wCAKC;AAED,MAAa,WAAY,SAAQ,KAAK;IAClC,YAAY,OAAe,EAAE,YAAkB;QAC3C,KAAK,CAAC,GAAG,cAAc,CAAC,YAAY,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC;IACzD,CAAC;CACJ;AAJD,kCAIC"} |
| import { Program } from 'typescript'; | ||
| import { WidgetDescriptor } from './descriptors'; | ||
| export type FileScannerOptions = { | ||
| defaultVersion?: string; | ||
| }; | ||
| export declare class FileScanner { | ||
| private program; | ||
| private file; | ||
| private options?; | ||
| private parsedSource; | ||
| constructor(program: Program, file: string, options?: FileScannerOptions | undefined); | ||
| scanForWidget(): WidgetDescriptor | undefined; | ||
| private hasWidgetModifier; | ||
| private getTagValue; | ||
| private processWidget; | ||
| private processProperties; | ||
| private getPropertyComment; | ||
| private determinePropertyType; | ||
| private determineBaseType; | ||
| private isPropertyOptional; | ||
| private getPropsType; | ||
| } |
| "use strict"; | ||
| // Copyright (c) 2023 System Automation Corporation. | ||
| // This file is licensed under the MIT License. | ||
| var __importDefault = (this && this.__importDefault) || function (mod) { | ||
| return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.FileScanner = void 0; | ||
| const typescript_1 = require("typescript"); | ||
| const debug_1 = __importDefault(require("./debug")); | ||
| const errors_1 = require("./errors"); | ||
| const parser_1 = require("./parser"); | ||
| class FileScanner { | ||
| constructor(program, file, options) { | ||
| this.program = program; | ||
| this.file = file; | ||
| this.options = options; | ||
| } | ||
| scanForWidget() { | ||
| const parsed = (0, parser_1.parseFile)(this.program, this.file); | ||
| let widget; | ||
| if (parsed) { | ||
| this.parsedSource = parsed; | ||
| const widgetDeclarations = parsed.comments.filter(this.hasWidgetModifier); | ||
| if (widgetDeclarations.length > 1) { | ||
| throw new errors_1.SyntaxError(`Multiple @widget declarations in ${this.file}, only the default export can be declared a widget`, widgetDeclarations[1].compilerNode); | ||
| } | ||
| else if (widgetDeclarations.length === 1) { | ||
| (0, debug_1.default)('found @widget declaration in %s', this.file); | ||
| widget = this.processWidget(widgetDeclarations[0]); | ||
| } | ||
| } | ||
| return widget; | ||
| } | ||
| hasWidgetModifier(comment) { | ||
| return comment.commentBlock.tags.some((tag) => tag.tag === 'widget' || tag.tag === 'widgetName'); | ||
| } | ||
| getTagValue(tags, tagName, fullText) { | ||
| const tag = tags.find((tag) => tag.tag === tagName); | ||
| if (!tag) { | ||
| return undefined; | ||
| } | ||
| const nameComponents = [tag.name]; | ||
| if (fullText && tag.description) { | ||
| nameComponents.push(tag.description); | ||
| } | ||
| return nameComponents.join(' '); | ||
| } | ||
| processWidget(widgetDeclaration) { | ||
| if (widgetDeclaration.compilerNode.kind !== typescript_1.SyntaxKind.FunctionDeclaration) { | ||
| throw new errors_1.SyntaxError('@widget must be declared on a FunctionComponent', widgetDeclaration.compilerNode); | ||
| } | ||
| const funcDeclaration = widgetDeclaration.compilerNode; | ||
| const tags = widgetDeclaration.commentBlock.tags; | ||
| const widgetId = this.getTagValue(tags, 'widget') || funcDeclaration.name?.text; | ||
| if (!widgetId) { | ||
| throw new errors_1.SyntaxError('Unable to determine widget id, no explicit id provided and unable to determine function name', funcDeclaration); | ||
| } | ||
| const widgetName = this.getTagValue(tags, 'widgetName', true) || widgetId; | ||
| const widgetVersion = this.getTagValue(tags, 'widgetVersion') || this.options?.defaultVersion; | ||
| const widget = { | ||
| id: widgetId, | ||
| name: widgetName, | ||
| description: widgetDeclaration.commentBlock.description, | ||
| version: widgetVersion, | ||
| src: this.file, | ||
| properties: [], | ||
| }; | ||
| const propsType = this.getPropsType(funcDeclaration); | ||
| if (propsType) { | ||
| widget.properties = this.processProperties(propsType); | ||
| } | ||
| return widget; | ||
| } | ||
| processProperties(propsType) { | ||
| const properties = []; | ||
| for (const member of propsType.members) { | ||
| const name = member.name; | ||
| if (!name) { | ||
| throw new errors_1.SyntaxError('Property has no name', member); | ||
| } | ||
| if (!('text' in name)) { | ||
| throw new errors_1.SyntaxError('Unable to determine property id', member); | ||
| } | ||
| const comment = this.getPropertyComment(member); | ||
| const tags = comment?.commentBlock.tags ?? []; | ||
| const propertyId = name.text; | ||
| const propertyName = this.getTagValue(tags, 'propertyName', true) || propertyId; | ||
| const propertyType = this.getTagValue(tags, 'propertyType') || this.determinePropertyType(propertyId, member); | ||
| properties.push({ | ||
| name: propertyId, | ||
| displayName: propertyName, | ||
| type: propertyType, | ||
| optional: this.isPropertyOptional(member), | ||
| }); | ||
| } | ||
| return properties; | ||
| } | ||
| getPropertyComment(property) { | ||
| return this.parsedSource?.comments?.find((comment) => comment.compilerNode === property); | ||
| } | ||
| determinePropertyType(id, property) { | ||
| // Default to text unless we can determine a better type; | ||
| let type = 'text'; | ||
| const baseType = this.determineBaseType(property); | ||
| switch (baseType?.kind) { | ||
| case typescript_1.SyntaxKind.StringKeyword: | ||
| type = 'text'; | ||
| break; | ||
| case typescript_1.SyntaxKind.NumberKeyword: | ||
| type = 'number'; | ||
| break; | ||
| case typescript_1.SyntaxKind.BooleanKeyword: | ||
| type = 'boolean'; | ||
| break; | ||
| default: | ||
| console.log(`${(0, errors_1.locationString)(property)}: not able to infer type for property ${id}, defaulting to 'text'`); | ||
| break; | ||
| } | ||
| return type; | ||
| } | ||
| determineBaseType(property) { | ||
| let typeNode; | ||
| if (property.kind === typescript_1.SyntaxKind.PropertySignature) { | ||
| typeNode = property.type; | ||
| } | ||
| if (typeNode?.kind === typescript_1.SyntaxKind.UnionType) { | ||
| const unionType = typeNode; | ||
| // Remove undefined and null. | ||
| const types = unionType.types.filter((type) => type.kind !== typescript_1.SyntaxKind.UndefinedKeyword && type.kind !== typescript_1.SyntaxKind.NullKeyword); | ||
| if (types.length === 1) { | ||
| typeNode = types[0]; | ||
| } | ||
| else { | ||
| (0, debug_1.default)(''); | ||
| } | ||
| } | ||
| return typeNode; | ||
| } | ||
| isPropertyOptional(property) { | ||
| if (property.questionToken) { | ||
| return true; | ||
| } | ||
| if (property.kind === typescript_1.SyntaxKind.PropertySignature) { | ||
| const typeNode = property.type; | ||
| if (typeNode?.kind === typescript_1.SyntaxKind.UnionType) { | ||
| const unionType = typeNode; | ||
| return unionType.types.some((type) => type.kind === typescript_1.SyntaxKind.UndefinedKeyword); | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
| getPropsType(funcDeclaration) { | ||
| const propsParam = funcDeclaration.parameters[0]; | ||
| let propsType; | ||
| switch (propsParam?.type?.kind) { | ||
| case typescript_1.SyntaxKind.TypeLiteral: | ||
| propsType = propsParam.type; | ||
| break; | ||
| case typescript_1.SyntaxKind.TypeReference: { | ||
| const name = propsParam.type.typeName; | ||
| if ('text' in name) { | ||
| propsType = this.parsedSource?.types[name.text]; | ||
| } | ||
| else { | ||
| throw new errors_1.SyntaxError('Unable to determine widget props type (qualified type references not supported)', propsParam.type); | ||
| } | ||
| break; | ||
| } | ||
| default: | ||
| if (propsParam?.type?.kind) { | ||
| throw new errors_1.SyntaxError(`Unable to determine widget props type from ${typescript_1.SyntaxKind[propsParam.type.kind]}`, propsParam.type); | ||
| } | ||
| // Only an error if there is a parameter. | ||
| if (propsParam) { | ||
| throw new errors_1.SyntaxError('No type specified for widget props', propsParam); | ||
| } | ||
| break; | ||
| } | ||
| return propsType; | ||
| } | ||
| } | ||
| exports.FileScanner = FileScanner; | ||
| //# sourceMappingURL=fileScanner.js.map |
| {"version":3,"file":"fileScanner.js","sourceRoot":"","sources":["../../src/manifest/fileScanner.ts"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,+CAA+C;;;;;;AAG/C,2CAUoB;AACpB,oDAA4B;AAE5B,qCAAuD;AACvD,qCAA4D;AAM5D,MAAa,WAAW;IAGpB,YAAoB,OAAgB,EAAU,IAAY,EAAU,OAA4B;QAA5E,YAAO,GAAP,OAAO,CAAS;QAAU,SAAI,GAAJ,IAAI,CAAQ;QAAU,YAAO,GAAP,OAAO,CAAqB;IAAG,CAAC;IAEpG,aAAa;QACT,MAAM,MAAM,GAAG,IAAA,kBAAS,EAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAClD,IAAI,MAAoC,CAAC;QAEzC,IAAI,MAAM,EAAE;YACR,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC;YAE3B,MAAM,kBAAkB,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;YAE1E,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC/B,MAAM,IAAI,oBAAW,CACjB,oCAAoC,IAAI,CAAC,IAAI,oDAAoD,EACjG,kBAAkB,CAAC,CAAC,CAAC,CAAC,YAAY,CACrC,CAAC;aACL;iBAAM,IAAI,kBAAkB,CAAC,MAAM,KAAK,CAAC,EAAE;gBACxC,IAAA,eAAK,EAAC,iCAAiC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;gBAEpD,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;aACtD;SACJ;QAED,OAAO,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AU,CAAC,CAAC,CAAC,CAAC;QACjD,IAAI,SAAsC,CAAC;QAE3C,QAAQ,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE;YAC5B,KAAK,uBAAU,CAAC,WAAW;gBACvB,SAAS,GAAG,UAAU,CAAC,IAAuB,CAAC;gBAC/C,MAAM;YAEV,KAAK,uBAAU,CAAC,aAAa,CAAC,CAAC;gBAC3B,MAAM,IAAI,GAAI,UAAU,CAAC,IAA0B,CAAC,QAAQ,CAAC;gBAE7D,IAAI,MAAM,IAAI,IAAI,EAAE;oBAChB,SAAS,GAAG,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;iBACnD;qBAAM;oBACH,MAAM,IAAI,oBAAW,CACjB,iFAAiF,EACjF,UAAU,CAAC,IAAI,CAClB,CAAC;iBACL;gBAED,MAAM;aACT;YAED;gBACI,IAAI,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE;oBACxB,MAAM,IAAI,oBAAW,CACjB,8CAA8C,uBAAU,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAChF,UAAU,CAAC,IAAI,CAClB,CAAC;iBACL;gBAED,yCAAyC;gBACzC,IAAI,UAAU,EAAE;oBACZ,MAAM,IAAI,oBAAW,CAAC,oCAAoC,EAAE,UAAU,CAAC,CAAC;iBAC3E;gBAED,MAAM;SACb;QAED,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ;AA7OD,kCA6OC"} |
| export * from './descriptors'; | ||
| export * from './errors'; | ||
| export * from './fileScanner'; | ||
| export * from './scanner'; |
| "use strict"; | ||
| // Copyright (c) 2023 System Automation Corporation. | ||
| // This file is licensed under the MIT License. | ||
| var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
| if (k2 === undefined) k2 = k; | ||
| var desc = Object.getOwnPropertyDescriptor(m, k); | ||
| if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
| desc = { enumerable: true, get: function() { return m[k]; } }; | ||
| } | ||
| Object.defineProperty(o, k2, desc); | ||
| }) : (function(o, m, k, k2) { | ||
| if (k2 === undefined) k2 = k; | ||
| o[k2] = m[k]; | ||
| })); | ||
| var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
| for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| __exportStar(require("./descriptors"), exports); | ||
| __exportStar(require("./errors"), exports); | ||
| __exportStar(require("./fileScanner"), exports); | ||
| __exportStar(require("./scanner"), exports); | ||
| //# sourceMappingURL=index.js.map |
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/manifest/index.ts"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,+CAA+C;;;;;;;;;;;;;;;;AAE/C,gDAA8B;AAC9B,2CAAyB;AACzB,gDAA8B;AAC9B,4CAA0B"} |
| import { Block } from 'comment-parser'; | ||
| import ts, { SourceFile } from 'typescript'; | ||
| export interface Comment { | ||
| compilerNode: ts.Node; | ||
| commentBlock: Block; | ||
| } | ||
| export type ParsedSource = { | ||
| sourceFile: SourceFile; | ||
| comments: Comment[]; | ||
| types: { | ||
| [key: string]: ts.TypeLiteralNode; | ||
| }; | ||
| }; | ||
| export declare function parseFile(program: ts.Program, file: string): ParsedSource | undefined; |
| "use strict"; | ||
| // Copyright (c) 2023 System Automation Corporation. | ||
| // This file is licensed under the MIT License. | ||
| var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
| if (k2 === undefined) k2 = k; | ||
| var desc = Object.getOwnPropertyDescriptor(m, k); | ||
| if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
| desc = { enumerable: true, get: function() { return m[k]; } }; | ||
| } | ||
| Object.defineProperty(o, k2, desc); | ||
| }) : (function(o, m, k, k2) { | ||
| if (k2 === undefined) k2 = k; | ||
| o[k2] = m[k]; | ||
| })); | ||
| var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
| Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
| }) : function(o, v) { | ||
| o["default"] = v; | ||
| }); | ||
| var __importStar = (this && this.__importStar) || function (mod) { | ||
| if (mod && mod.__esModule) return mod; | ||
| var result = {}; | ||
| if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
| __setModuleDefault(result, mod); | ||
| return result; | ||
| }; | ||
| var __importDefault = (this && this.__importDefault) || function (mod) { | ||
| return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.parseFile = void 0; | ||
| const tsdoc = __importStar(require("@microsoft/tsdoc")); | ||
| const comment_parser_1 = require("comment-parser"); | ||
| const typescript_1 = __importStar(require("typescript")); | ||
| const debug_1 = __importDefault(require("./debug")); | ||
| /** | ||
| * Returns true if the specified SyntaxKind is part of a declaration form. | ||
| * | ||
| * Based on ts.isDeclarationKind() from the compiler. | ||
| * https://github.com/microsoft/TypeScript/blob/v3.0.3/src/compiler/utilities.ts#L6382 | ||
| */ | ||
| function isDeclarationKind(kind) { | ||
| return (kind === typescript_1.default.SyntaxKind.ArrowFunction || | ||
| kind === typescript_1.default.SyntaxKind.BindingElement || | ||
| kind === typescript_1.default.SyntaxKind.ClassDeclaration || | ||
| kind === typescript_1.default.SyntaxKind.ClassExpression || | ||
| kind === typescript_1.default.SyntaxKind.Constructor || | ||
| kind === typescript_1.default.SyntaxKind.EnumDeclaration || | ||
| kind === typescript_1.default.SyntaxKind.EnumMember || | ||
| kind === typescript_1.default.SyntaxKind.ExportSpecifier || | ||
| kind === typescript_1.default.SyntaxKind.FunctionDeclaration || | ||
| kind === typescript_1.default.SyntaxKind.FunctionExpression || | ||
| kind === typescript_1.default.SyntaxKind.GetAccessor || | ||
| kind === typescript_1.default.SyntaxKind.ImportClause || | ||
| kind === typescript_1.default.SyntaxKind.ImportEqualsDeclaration || | ||
| kind === typescript_1.default.SyntaxKind.ImportSpecifier || | ||
| kind === typescript_1.default.SyntaxKind.InterfaceDeclaration || | ||
| kind === typescript_1.default.SyntaxKind.JsxAttribute || | ||
| kind === typescript_1.default.SyntaxKind.MethodDeclaration || | ||
| kind === typescript_1.default.SyntaxKind.MethodSignature || | ||
| kind === typescript_1.default.SyntaxKind.ModuleDeclaration || | ||
| kind === typescript_1.default.SyntaxKind.NamespaceExportDeclaration || | ||
| kind === typescript_1.default.SyntaxKind.NamespaceImport || | ||
| kind === typescript_1.default.SyntaxKind.Parameter || | ||
| kind === typescript_1.default.SyntaxKind.PropertyAssignment || | ||
| kind === typescript_1.default.SyntaxKind.PropertyDeclaration || | ||
| kind === typescript_1.default.SyntaxKind.PropertySignature || | ||
| kind === typescript_1.default.SyntaxKind.SetAccessor || | ||
| kind === typescript_1.default.SyntaxKind.ShorthandPropertyAssignment || | ||
| kind === typescript_1.default.SyntaxKind.TypeAliasDeclaration || | ||
| kind === typescript_1.default.SyntaxKind.TypeParameter || | ||
| kind === typescript_1.default.SyntaxKind.VariableDeclaration || | ||
| kind === typescript_1.default.SyntaxKind.JSDocTypedefTag || | ||
| kind === typescript_1.default.SyntaxKind.JSDocCallbackTag || | ||
| kind === typescript_1.default.SyntaxKind.JSDocPropertyTag); | ||
| } | ||
| /** | ||
| * Retrieves the JSDoc-style comments associated with a specific AST node. | ||
| * | ||
| * Based on ts.getJSDocCommentRanges() from the compiler. | ||
| * https://github.com/microsoft/TypeScript/blob/v3.0.3/src/compiler/utilities.ts#L924 | ||
| */ | ||
| function getJSDocCommentRanges(node, text) { | ||
| const commentRanges = []; | ||
| switch (node.kind) { | ||
| case typescript_1.default.SyntaxKind.Parameter: | ||
| case typescript_1.default.SyntaxKind.TypeParameter: | ||
| case typescript_1.default.SyntaxKind.FunctionExpression: | ||
| case typescript_1.default.SyntaxKind.ArrowFunction: | ||
| case typescript_1.default.SyntaxKind.ParenthesizedExpression: | ||
| commentRanges.push(...(typescript_1.default.getTrailingCommentRanges(text, node.pos) || [])); | ||
| break; | ||
| } | ||
| commentRanges.push(...(typescript_1.default.getLeadingCommentRanges(text, node.pos) || [])); | ||
| // True if the comment starts with '/**' but not if it is '/**/' | ||
| return commentRanges.filter((comment) => text.charCodeAt(comment.pos + 1) === 0x2a /* ts.CharacterCodes.asterisk */ && | ||
| text.charCodeAt(comment.pos + 2) === 0x2a /* ts.CharacterCodes.asterisk */ && | ||
| text.charCodeAt(comment.pos + 3) !== 0x2f /* ts.CharacterCodes.slash */); | ||
| } | ||
| function walkCompilerAst(node, comments, types) { | ||
| // The TypeScript AST doesn't store code comments directly. If you want to find *every* comment, | ||
| // you would need to rescan the SourceFile tokens similar to how tsutils.forEachComment() works: | ||
| // https://github.com/ajafff/tsutils/blob/v3.0.0/util/util.ts#L453 | ||
| // | ||
| // However, for this demo we are modeling a tool that discovers declarations and then analyzes their doc comments, | ||
| // so we only care about TSDoc that would conventionally be associated with an interesting AST node. | ||
| const buffer = node.getSourceFile().getFullText(); // don't use getText() here! | ||
| // Only consider nodes that are part of a declaration form. Without this, we could discover | ||
| // the same comment twice (e.g. for a MethodDeclaration and its PublicKeyword). | ||
| if (isDeclarationKind(node.kind)) { | ||
| if (node.kind === typescript_1.SyntaxKind.TypeAliasDeclaration) { | ||
| const typeAlias = node; | ||
| if (typeAlias.type.kind === typescript_1.SyntaxKind.TypeLiteral) { | ||
| (0, debug_1.default)('discovered type %s', typeAlias.name.text); | ||
| types[typeAlias.name.text] = typeAlias.type; | ||
| } | ||
| else { | ||
| (0, debug_1.default)('could not determine definition for type %s from %s', typeAlias.name.text, typescript_1.default.SyntaxKind[typeAlias.type.kind]); | ||
| } | ||
| } | ||
| // Find "/** */" style comments associated with this node. | ||
| // Note that this reinvokes the compiler's scanner -- the result is not cached. | ||
| const commentRanges = getJSDocCommentRanges(node, buffer); | ||
| if (commentRanges.length > 0) { | ||
| for (const commentRange of commentRanges) { | ||
| const textRange = tsdoc.TextRange.fromStringRange(buffer, commentRange.pos, commentRange.end); | ||
| const blocks = (0, comment_parser_1.parse)(textRange.toString()); | ||
| if (blocks.length) { | ||
| comments.push({ | ||
| compilerNode: node, | ||
| commentBlock: blocks[0], // there should only be one block in textRange | ||
| }); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| return node.forEachChild((child) => walkCompilerAst(child, comments, types)); | ||
| } | ||
| function parseFile(program, file) { | ||
| (0, debug_1.default)('parsing file %s', file); | ||
| // This appears to be necessary to initialize some program state. Without | ||
| // this the subsequent getSourceFile will fail. | ||
| program.getSemanticDiagnostics(); | ||
| const sourceFile = program.getSourceFile(file); | ||
| sourceFile?.getLineAndCharacterOfPosition; | ||
| if (!sourceFile) { | ||
| (0, debug_1.default)('unable to get source file %s', file); | ||
| return undefined; | ||
| } | ||
| const comments = []; | ||
| const types = {}; | ||
| walkCompilerAst(sourceFile, comments, types); | ||
| return { | ||
| sourceFile, | ||
| comments, | ||
| types, | ||
| }; | ||
| } | ||
| exports.parseFile = parseFile; | ||
| //# sourceMappingURL=parser.js.map |
| {"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/manifest/parser.ts"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,+CAA+C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE/C,wDAA0C;AAC1C,mDAA8D;AAC9D,yDAA8E;AAC9E,oDAA4B;AAkB5B;;;;;GAKG;AACH,SAAS,iBAAiB,CAAC,IAAmB;IAC1C,OAAO,CACH,IAAI,KAAK,oBAAE,CAAC,UAAU,CAAC,aAAa;QACpC,IAAI,KAAK,oBAAE,CAAC,UAAU,CAAC,cAAc;QACrC,IAAI,KAAK,oBAAE,CAAC,UAAU,CAAC,gBAAgB;QACvC,IAAI,KAAK,oBAAE,CAAC,UAAU,CAAC,eAAe;QACtC,IAAI,KAAK,oBAAE,CAAC,UAAU,CAAC,WAAW;QAClC,IAAI,KAAK,oBAAE,CAAC,UAAU,CA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AElD,IAAI,MAAM,CAAC,MAAM,EAAE;oBACf,QAAQ,CAAC,IAAI,CAAC;wBACV,YAAY,EAAE,IAAI;wBAClB,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,8CAA8C;qBAC1E,CAAC,CAAC;iBACN;aACJ;SACJ;KACJ;IAED,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,eAAe,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;AACjF,CAAC;AAED,SAAgB,SAAS,CAAC,OAAmB,EAAE,IAAY;IACvD,IAAA,eAAK,EAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;IAE/B,0EAA0E;IAC1E,+CAA+C;IAC/C,OAAO,CAAC,sBAAsB,EAAE,CAAC;IAEjC,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAC/C,UAAU,EAAE,6BAA6B,CAAC;IAE1C,IAAI,CAAC,UAAU,EAAE;QACb,IAAA,eAAK,EAAC,8BAA8B,EAAE,IAAI,CAAC,CAAC;QAE5C,OAAO,SAAS,CAAC;KACpB;IAED,MAAM,QAAQ,GAAc,EAAE,CAAC;IAC/B,MAAM,KAAK,GAA0B,EAAE,CAAC;IAExC,eAAe,CAAC,UAAU,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;IAE7C,OAAO;QACH,UAAU;QACV,QAAQ;QACR,KAAK;KACR,CAAC;AACN,CAAC;AA1BD,8BA0BC"} |
| /// <reference types="lodash" /> | ||
| import { WidgetDescriptor } from './descriptors'; | ||
| export type ScannerOptions = { | ||
| defaultVersion?: string; | ||
| }; | ||
| export declare class Scanner { | ||
| private sourceRoot; | ||
| private options?; | ||
| constructor(sourceRoot: string, options?: ScannerOptions | undefined); | ||
| scan(): Promise<{ | ||
| widgets: import("lodash").Dictionary<WidgetDescriptor>; | ||
| }>; | ||
| } |
| "use strict"; | ||
| // Copyright (c) 2023 System Automation Corporation. | ||
| // This file is licensed under the MIT License. | ||
| var __importDefault = (this && this.__importDefault) || function (mod) { | ||
| return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.Scanner = void 0; | ||
| const glob_1 = require("glob"); | ||
| const lodash_1 = require("lodash"); | ||
| const typescript_1 = __importDefault(require("typescript")); | ||
| const fileScanner_1 = require("./fileScanner"); | ||
| class Scanner { | ||
| constructor(sourceRoot, options) { | ||
| this.sourceRoot = sourceRoot; | ||
| this.options = options; | ||
| } | ||
| async scan() { | ||
| const files = await (0, glob_1.glob)(`${this.sourceRoot}/**/*.{ts,tsx}`); | ||
| const widgets = []; | ||
| const program = typescript_1.default.createProgram(files, {}); | ||
| for (const file of files) { | ||
| const fileScanner = new fileScanner_1.FileScanner(program, file, this.options); | ||
| const widget = fileScanner.scanForWidget(); | ||
| if (widget) { | ||
| widgets.push(widget); | ||
| } | ||
| } | ||
| return { | ||
| widgets: (0, lodash_1.keyBy)(widgets, (widget) => widget.id), | ||
| }; | ||
| } | ||
| } | ||
| exports.Scanner = Scanner; | ||
| //# sourceMappingURL=scanner.js.map |
| {"version":3,"file":"scanner.js","sourceRoot":"","sources":["../../src/manifest/scanner.ts"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,+CAA+C;;;;;;AAE/C,+BAA4B;AAC5B,mCAA+B;AAC/B,4DAA4B;AAE5B,+CAA4C;AAM5C,MAAa,OAAO;IAChB,YAAoB,UAAkB,EAAU,OAAwB;QAApD,eAAU,GAAV,UAAU,CAAQ;QAAU,YAAO,GAAP,OAAO,CAAiB;IAAG,CAAC;IAE5E,KAAK,CAAC,IAAI;QACN,MAAM,KAAK,GAAG,MAAM,IAAA,WAAI,EAAC,GAAG,IAAI,CAAC,UAAU,gBAAgB,CAAC,CAAC;QAC7D,MAAM,OAAO,GAAuB,EAAE,CAAC;QACvC,MAAM,OAAO,GAAG,oBAAE,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAE5C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;YACtB,MAAM,WAAW,GAAG,IAAI,yBAAW,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;YACjE,MAAM,MAAM,GAAG,WAAW,CAAC,aAAa,EAAE,CAAC;YAE3C,IAAI,MAAM,EAAE;gBACR,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;aACxB;SACJ;QAED,OAAO;YACH,OAAO,EAAE,IAAA,cAAK,EAAC,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC;SACjD,CAAC;IACN,CAAC;CACJ;AArBD,0BAqBC"} |
+20
-10
@@ -10,4 +10,8 @@ #!/usr/bin/env node | ||
| const packageJson = require(path.resolve(process.cwd(), './package.json')); | ||
| const { Scanner } = require('../dist'); | ||
| (async () => { | ||
| const scanner = new Scanner('src', { defaultVersion: packageJson.version }); | ||
| const widgets = (await scanner.scan()).widgets; | ||
| const fs = require('fs'); | ||
@@ -18,19 +22,25 @@ | ||
| const getWidgetProperties = async (widgetsList) => { | ||
| const temp = []; | ||
| console.log(''); | ||
| for await (const widget of widgetsList) { | ||
| for (const widget of widgetsList) { | ||
| try { | ||
| const widget_folder_path = path.join(folderName, widget); | ||
| const WidgetProperties = require(`${widget_folder_path}/WidgetProperties.json`); | ||
| if (!WidgetProperties.id) { | ||
| console.error(`Missing widget id in ${widget_folder_path}/WidgetProperties.json`); | ||
| continue; | ||
| } | ||
| WidgetProperties.src = 'src/widgets/' + widget; | ||
| temp.push(WidgetProperties); | ||
| widgets[WidgetProperties.id] = WidgetProperties; | ||
| console.info(WidgetProperties.name + ' widget -- READ'); | ||
| } catch (e) { | ||
| if (e.code === 'ERR_MODULE_NOT_FOUND') | ||
| console.error(widget + ' widget -- WidgetProperties not defined.'); | ||
| else console.error('ERROR while reading properties for ' + widget + ':: ', e); | ||
| continue; | ||
| if (e.code !== 'MODULE_NOT_FOUND') { | ||
| console.error('ERROR while reading properties for ' + widget + ':: ', e); | ||
| } | ||
| } | ||
| } | ||
| return temp; | ||
| }; | ||
@@ -42,3 +52,3 @@ | ||
| widgetsList = fs.readdirSync(folderName).map((widget) => widget); | ||
| let WidgetProperties = await getWidgetProperties(widgetsList); | ||
| await getWidgetProperties(widgetsList); | ||
| console.log(''); | ||
@@ -48,3 +58,3 @@ const outputJSON = { | ||
| description: '', | ||
| widgets: WidgetProperties, | ||
| widgets: Object.values(widgets), | ||
| }; | ||
@@ -51,0 +61,0 @@ if (!fs.existsSync('./dist')) { |
+19
-3
| { | ||
| "name": "@evoke-platform/plugin-scripts", | ||
| "version": "1.0.0-dev.21", | ||
| "version": "1.0.0-dev.22", | ||
| "description": "Scripts for managing an Evoke platform plugin project", | ||
@@ -25,2 +25,5 @@ "homepage": "https://github.com/Evoke-Platform/evoke-sdk/blob/main/packages/plugin-scripts/README.md", | ||
| "scripts": { | ||
| "build": "tsc", | ||
| "pretest": "npm run build", | ||
| "test": "mocha \"dist/__tests__/**/*.unit.js\"", | ||
| "release": "commit-and-tag-version -t plugin-scripts@ --releaseCommitMessageFormat \"chore(release): plugin-scripts@{{currentTag}} [skip ci]\"", | ||
@@ -33,8 +36,21 @@ "predeploy": "cp ../../LICENSE .", | ||
| "dependencies": { | ||
| "@microsoft/tsdoc": "^0.14.2", | ||
| "comment-parser": "^1.3.1", | ||
| "glob": "^10.2.1", | ||
| "jszip": "^3.10.0", | ||
| "mkdirp": "^3.0.0" | ||
| "lodash": "^4.17.21", | ||
| "mkdirp": "^3.0.0", | ||
| "typescript": "^5.0.4" | ||
| }, | ||
| "devDependencies": { | ||
| "commit-and-tag-version": "^11.2.1" | ||
| "@types/chai": "^4.3.4", | ||
| "@types/chai-as-promised": "^7.1.5", | ||
| "@types/dirty-chai": "^2.0.2", | ||
| "@types/lodash": "^4.14.194", | ||
| "chai": "^4.3.7", | ||
| "chai-as-promised": "^7.1.1", | ||
| "commit-and-tag-version": "^11.2.1", | ||
| "dirty-chai": "^2.0.1", | ||
| "mocha": "^10.2.0" | ||
| } | ||
| } |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
74301
1033.85%83
1560%1178
1153.19%7
250%9
800%4
33.33%1
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added