Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Universal Module Definition for use in automated build systems

License

NotificationsYou must be signed in to change notification settings

ForbesLindesay/umd

Repository files navigation

Universal Module Definition for use in automated build systems

  • simple synchronous wrapping of a string
  • return style module support
  • CommonJS support
  • prevents internal UMDs from conflicting

Build StatusDependency StatusNPM version

Source Format

In order for the UMD wrapper to work the source code for your module shouldreturn the export, e.g.

functionmethod(){//code}method.helper=function(){//code}returnmethod;

For examples, see the examples directory. The CommonJS module format is also supported by passing true as the second argument to methods.

API

options:

  • commonJS (default:false) - If commonJS istrue then it will accept CommonJS source instead of source code whichreturns the module.

umd(name, source, [options])

Thename should the the name of the module. Use a string like name, all lower case with hyphens instead of spaces.

Ifsource should be a string, that is wrapped in umd and returned as a string.

umd.prelude(module, [options])

return the text which will be inserted before a module.

umd.postlude(module, [options])

return the text which will be inserted after a module.

Command Line

Usage: umd <name> <source> <destination> [options]Pipe Usage: umd <name> [options] < source > destinationOptions: -h --help     Display usage information -c --commonJS Use CommonJS module format

You can easilly pipe unix commands together like:

catmy-module.js|umdmy-module|uglify-js>my-module.umd.min.js

Name Casing and Characters

Thename passed toumd will be converted to camel case (my-library becomesmyLibrary) and may only contain:

  • alphanumeric characters
  • $
  • _

The name may not begin with a number. Invalid characters will be stripped.

License

MIT

About

Universal Module Definition for use in automated build systems

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors9


[8]ページ先頭

©2009-2025 Movatter.jp