Skip to content

Commit

Permalink
Rename amd-loader to esm-amd-loader (everything else).
Browse files Browse the repository at this point in the history
  • Loading branch information
aomarks committed May 1, 2018
1 parent 6f07c97 commit e0455dc
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 17 deletions.
22 changes: 12 additions & 10 deletions packages/esm-amd-loader/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![NPM version](http://img.shields.io/npm/v/@polymer/amd-loader.svg)](https://www.npmjs.com/package/@polymer/amd-loader)
[![NPM version](http://img.shields.io/npm/v/@polymer/esm-amd-loader.svg)](https://www.npmjs.com/package/@polymer/esm-amd-loader)

# @polymer/amd-loader
# @polymer/esm-amd-loader

A JavaScript library which loads AMD-style modules in the browser in 0.9 KB.

Expand All @@ -22,7 +22,7 @@ document.
For other use cases, this loader can be installed directly from NPM:

```bash
$ npm install --save @polymer/amd-loader
$ npm install --save @polymer/esm-amd-loader
```

## Example usage
Expand All @@ -35,7 +35,7 @@ directly for this API.

#### index.html
```html
<script src="./node_modules/@polymer/amd-loader/amd-loader.min.js"></script>
<script src="./node_modules/@polymer/esm-amd-loader/esm-amd-loader.min.js"></script>

<script>
define(['./foo.js'], function(foo) {
Expand All @@ -62,8 +62,9 @@ define(['exports', 'require', 'meta'], function(exports, require, meta) {
## window.define

```ts
window.define = function(dependencies: string[],
factory?: (...args: Array<{}>) => void
window.define = function(
dependencies: string[],
factory?: (...args: Array<{}>) => void
```
### `dependencies`
Expand All @@ -89,13 +90,14 @@ this is the object that will be received.
### `"require"`
```ts
function require(dependencies: string[],
onLoad?: (...args: Array<{}>),
onError?: (error: Error)) => void
function require(
dependencies: string[],
onResolve?: (...args: Array<{}>),
onError?: (error: Error)) => void
```
A function which will load the given dependencies, with relative paths resolved
relative to the current module. If successful, `onLoad` is called with the
relative to the current module. If successful, `onResolve` is called with the
resolved dependencies. If a dependency fails to load, `onError` is called with
the error from the first dependency which failed.
Expand Down
8 changes: 4 additions & 4 deletions packages/esm-amd-loader/package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"name": "@polymer/amd-loader",
"name": "@polymer/esm-amd-loader",
"version": "0.1.0",
"description": "Minimal AMD style loader for Polymer build.",
"description": "Minimal AMD-style loader for replicating ES module behavior.",
"repository": "git+https://github.com/Polymer/tools.git",
"main": "lib/amd-loader.min.js",
"main": "lib/esm-amd-loader.min.js",
"author": "The Polymer Project Authors",
"license": "BSD-3-Clause",
"scripts": {
"format": "find src/ -iname '*.ts' -o -iname '*.js' | xargs clang-format --style=file -i",
"clean": "rm -rf lib/",
"lint": "tslint --project . --format stylish",
"build": "npm run clean && tsc && npm run minify",
"minify": "babel-minify lib/amd-loader.js --outFile=lib/amd-loader.min.js",
"minify": "babel-minify lib/esm-amd-loader.js --outFile=lib/esm-amd-loader.min.js",
"test": "npm run lint && npm run build && wct",
"prepack": "npm run build",
"prepublishOnly": "npm test"
Expand Down
2 changes: 1 addition & 1 deletion packages/esm-amd-loader/src/test/suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// ├── x.js (module with no dependencies)
// └── y
// ├── suite.html (base HTML document)
// ├── suite.min.html (same as suite.html but uses minified amd-loader)
// ├── suite.min.html (same as suite.html but uses minified version)
// ├── y.js (module with no dependencies)
// ├── no-define.js (module which does not call define)
// └── z
Expand Down
2 changes: 1 addition & 1 deletion packages/esm-amd-loader/test/y/suite-min.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta charset="utf-8">
<script src="/components/web-component-tester/browser.js"></script>
<script src="../../lib/amd-loader.min.js"></script>
<script src="../../lib/esm-amd-loader.min.js"></script>
</head>

<body>
Expand Down
2 changes: 1 addition & 1 deletion packages/esm-amd-loader/test/y/suite.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta charset="utf-8">
<script src="/components/web-component-tester/browser.js"></script>
<script src="../../lib/amd-loader.js"></script>
<script src="../../lib/esm-amd-loader.js"></script>
</head>

<body>
Expand Down

0 comments on commit e0455dc

Please sign in to comment.