JSPM

modulize-generic-js

0.0.4
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q28230F
  • License BSD

convert generic javascript into amd and commonJs loadable modules

Package Exports

  • modulize-generic-js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (modulize-generic-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Description

Turn your generic JavaScript files into loadable modules.

Usage

` var modulizer = require("modulize-generic-js"); var someSourceCodeStr = "var x = 'something'"; console.log( modulizer.convertCode(someSourceCodeStr, { "return": "x" }) );

var sourceFileName = "/somejs.js" var destFileName = "/modules/some/somejs.js"

modulizer.convertFile(sourceFileName, { require: [{ module: "/othermodule/main" , as: "otherVariable" }, "/othermodule/justload-dontrefer"] , "return": "moduleVariable" }, destFileName, function(err, data){}); `

the result will contain a header that is supposed to autodetect weather it is being loaded as AMD by the presence of a define function or as a commonJs module.

License

BSD