New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

emscripten-library-decorator

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

emscripten-library-decorator - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

47

index.ts
// @dep decorator.
// Apply to a function, to export other variables whenever it's used.
// Arguments can be functions to export or names of global variables.
function dep(...depList: any[]) {

@@ -33,2 +36,4 @@ return((target: Object, functionName: string) => {

// @exportLibrary decorator.
// Apply to a class with static methods, to export them as functions.
function exportLibrary(target: any) {

@@ -38,30 +43,30 @@ mergeInto(LibraryManager.library, target);

var namespaceList: string[] = [];
// @exportNamespace decorator.
// Apply to a class named "_" and defined at the end of the namespace,
// to export the entire namespace.
function _initNamespaces() {
var namespaceList = $NAMESPACELIST;
for(var i = 0; i < namespaceList.length; ++i) {
var space = namespaceList[i];
if(space) space.init(space);
}
}
// @exportNamespace decorator.
function exportNamespace(name: string) {
return((target: any) => {
var exportName = name.substr(1);
var body = '(' + __decorate.caller.caller.toString().replace(/var +_ *= *[^]*/, '}') + ')';
eval(name + ' = { init: ' + body + ' };');
eval(name + '={};');
namespaceList.push(name);
var lib: _Library = {
_extends: __extends,
_decorate: __decorate,
defineHidden: _defineHidden
};
var safeList = namespaceList.map((name: string) => ("typeof(" + name + ")=='object'&&" + name));
lib[exportName + '__deps'] = Object.keys(lib);
lib[exportName + '__postset'] = body + '(' + name + ')';
mergeInto(LibraryManager.library, {
initNamespaces: eval('(' + _initNamespaces.toString().replace('$NAMESPACELIST', '[' + safeList.join(',') + ']') + ')')
});
mergeInto(LibraryManager.library, lib);
});
}
// @_defineHidden decorator.
// Apply to a property to protect it from modifications and hide it.
function _defineHidden(value: any) {

@@ -78,6 +83,2 @@ return((target: any, key: string) => {

// Placeholder variable replaced in code with array contents.
declare var $NAMESPACELIST: any[];
// Typescript internal shim functions.

@@ -90,3 +91,3 @@

interface _Library {}
interface _Library { [name: string]: any }

@@ -101,3 +102,3 @@ interface _LibraryManager {

declare function mergeInto(lib: _Library, proto: any): void;
declare function mergeInto(target: _Library, extension: _Library): void;

@@ -104,0 +105,0 @@ // The HEAP* arrays are the main way to access the C++ heap.

{
"name": "emscripten-library-decorator",
"version": "0.1.0",
"version": "0.1.1",
"description": "Decorators for writing Emscripten libraries",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/charto/emscripten-library-decorator",

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