From 820d600aeedeb459f0448e74df1d9d1403a26a9d Mon Sep 17 00:00:00 2001 From: Luis De Anda Date: Mon, 17 Apr 2023 23:50:31 -0600 Subject: [PATCH 1/2] Document how to import package in the browser --- README.md | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9fd64bd..ec9e8bd 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A TypeScript implementation of the [Amazon States Language specification](https://states-language.net/spec.html). -This package lets you run AWS Step Functions locally on your machine! +This package lets you run AWS Step Functions locally, both in Node.js and in the browser! > NOTE: This is a work in progress. Some features defined in the specification might not be supported at all yet or might have limited support. @@ -14,6 +14,7 @@ This package lets you run AWS Step Functions locally on your machine! - [Node.js](#nodejs) - [CommonJS](#commonjs) - [ES Module](#es-module) + - [Browser](#browser) - [API](#api) - [Constructor](#constructor-new-statemachinedefinition-statemachineoptions) - [StateMachine.run](#statemachineruninput-options) @@ -32,8 +33,6 @@ npm install aws-local-stepfunctions ## Importing -Currently, the only supported environment to import the package is Node.js. Browser support is not available yet. - ### Node.js #### CommonJS @@ -48,6 +47,22 @@ const { StateMachine } = require('aws-local-stepfunctions'); import { StateMachine } from 'aws-local-stepfunctions'; ``` +### Browser + +You can import the bundled package directly into a browser script as an ES module, from one of the following CDNs: + +#### unpkg + +```js +import { StateMachine } from 'https://unpkg.com/aws-local-stepfunctions'; +``` + +#### jsDelivr + +```js +import { StateMachine } from 'https://cdn.jsdelivr.net/npm/aws-local-stepfunctions/build/main.browser.esm.js'; +``` + ## API ### Constructor: `new StateMachine(definition[, stateMachineOptions])` From 1626101a8b54a14421d13812b0fa05f4812fc0d1 Mon Sep 17 00:00:00 2001 From: Luis De Anda Date: Tue, 18 Apr 2023 20:46:21 -0600 Subject: [PATCH 2/2] Add links to CDNs websites --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ec9e8bd..403e42e 100644 --- a/README.md +++ b/README.md @@ -51,13 +51,15 @@ import { StateMachine } from 'aws-local-stepfunctions'; You can import the bundled package directly into a browser script as an ES module, from one of the following CDNs: -#### unpkg +> NOTE: The following examples will import the latest package version. Refer to the CDNs websites to know about other ways in which you can specify the package URL (for example, to import a specific version). + +#### [unpkg](https://unpkg.com/) ```js import { StateMachine } from 'https://unpkg.com/aws-local-stepfunctions'; ``` -#### jsDelivr +#### [jsDelivr](https://www.jsdelivr.com/) ```js import { StateMachine } from 'https://cdn.jsdelivr.net/npm/aws-local-stepfunctions/build/main.browser.esm.js';