From 4b89e3c5dd74afa63545f54e84ce4998f8e5b977 Mon Sep 17 00:00:00 2001 From: Greg Franko Date: Mon, 25 Nov 2013 02:14:36 -0500 Subject: [PATCH] Releasing AMDClean v0.2.7 --- README.md | 21 +++++++++++++++++++++ package.json | 2 +- src/amdclean.js | 4 ++-- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e36a2c3..ac2a875 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,12 @@ It is best used for libraries or apps that use AMD and: * `define()` and `require()` calls. +* [Simplified CJS wrapper](https://github.com/jrburke/requirejs/wiki/Differences-between-the-simplified-CommonJS-wrapper-and-standard-AMD-define#wiki-cjs) + +* Exporting global modules to the `window` object + +* Storing all local modules inside of a global object (Helps scoping issues for certain use cases) + ## Download Node - `npm install amdclean` @@ -278,6 +284,13 @@ The amdclean `clean()` method accepts a string or an object. Below is an exampl amdclean.clean({ // The source code you would like to be 'cleaned' code: 'define("example", [], function(one, two) {});', + // The modules that you would like to set as window properties + // An array of strings (module names) + globalModules: [], + // Determines if all of your local modules are stored in a single global object (helps with scoping in certain cases) + globalObject: false, + // Determines the name of your global object that stores all of your global modules + globalObjectName: 'amdclean', // All esprima API options are supported: http://esprima.org/doc/ esprima: {}, // All escodegen API options are supported: https://github.com/Constellation/escodegen/wiki/API @@ -310,6 +323,14 @@ __Why are define() method placeholder functions inserted into my source?__ - This is the default behavior of r.js when a module(s) is not wrapped in a define() method. Luckily, this behavior can be overridden by setting the `skipModuleInsertion` option to `true` in your build configuration. +__How would I expose one or more modules as a global window property?__ + +- You can use the `globalModules` option to list all of the modules that you would like to expose as a `window` property + +__I am having a scope problem with all of the local module variables. What can I do?__ + +- You can use the `globalObject` option to store all of your modules in a global object that uses the top-most function scope. + ## License diff --git a/package.json b/package.json index e9db2eb..17c36b9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "amdclean", - "version": "0.2.6", + "version": "0.2.7", "description": "A build tool that converts AMD code to standard JavaScript", "main": "./src/amdclean", "repository": { diff --git a/src/amdclean.js b/src/amdclean.js index 1454f98..af722f7 100644 --- a/src/amdclean.js +++ b/src/amdclean.js @@ -1,4 +1,4 @@ -/*! amdclean - v0.2.6 - 2013-10-15 +/*! amdclean - v0.2.7 - 2013-11-25 * http://gregfranko.com/amdclean * Copyright (c) 2013 Greg Franko; Licensed MIT*/ @@ -35,7 +35,7 @@ // The Public API object publicAPI = { // Current project version number - VERSION: '0.2.6', + VERSION: '0.2.7', // Default Options defaultOptions: { 'globalObject': false,