Skip to content

Commit

Permalink
Include webpack-helpers in stimulus glue/proxy package (#453)
Browse files Browse the repository at this point in the history
* move webpack-helpers back to it's own file

So they can be impored with `stimulus/webpack-helpers` again

See: https://github.com/hotwired/stimulus/blob/v2.0.0/packages/stimulus/webpack-helpers.js

* rollup webpack-helpers too

* add browser field too
  • Loading branch information
marcoroth authored Oct 7, 2021
1 parent 3128ef1 commit 5827509
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 24 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ node_modules/
docs/api/
*.log
*.tsbuildinfo
*.d.ts
2 changes: 2 additions & 0 deletions packages/stimulus/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "@hotwired/stimulus"
export as namespace Stimulus
29 changes: 26 additions & 3 deletions packages/stimulus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,39 @@
"Javan Makhmali <[email protected]>",
"Sam Stephenson <[email protected]>"
],
"main": "dist/stimulus.js",
"module": "dist/stimulus.esm.js",
"main": "./dist/stimulus.js",
"module": "./dist/stimulus.js",
"browser": "./dist/stimulus.js",
"umd:main": "./dist/stimulus.umd.js",
"types": "./index.d.ts",
"exports": {
".": {
"browser": "./dist/stimulus.js",
"import": "./dist/stimulus.js",
"umd": "./dist/stimulus.umd.js",
"types": "./index.d.ts"
},
"./webpack-helpers": {
"browser": "./dist/webpack-helpers.js",
"import": "./dist/webpack-helpers.js",
"umd": "./dist/webpack-helpers.umd.js",
"types": "./webpack-helpers.d.ts"
}
},
"files": [
"index.d.ts",
"dist/stimulus.js",
"dist/stimulus.umd.js",
"webpack-helpers.js",
"webpack-helpers.d.ts",
"dist/webpack-helpers.js",
"dist/webpack-helpers.umd.js",
"README.md"
],
"license": "MIT",
"dependencies": {
"@hotwired/stimulus": "^3.0.0"
"@hotwired/stimulus": "^3.0.0",
"@hotwired/stimulus-webpack-helpers": "^1.0.0"
},
"devDependencies": {
"@rollup/plugin-node-resolve": "^13.0.0",
Expand Down
76 changes: 56 additions & 20 deletions packages/stimulus/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,59 @@ import { version } from "./package.json"
const year = new Date().getFullYear()
const banner = `/*\nStimulus ${version}\nCopyright © ${year} Basecamp, LLC\n */`

export default {
input: "index.js",
output: [
{
name: "Stimulus",
file: "dist/stimulus.umd.js",
format: "umd",
banner
},
{
file: "dist/stimulus.js",
format: "es",
banner
},
],
context: "window",
plugins: [
resolve()
]
}
export default [
{
external: [
"@hotwired/stimulus",
"@hotwired/stimulus-webpack-helpers"
],
input: "index.js",
output: [
{
globals: {
'@hotwired/stimulus': 'Stimulus'
},
name: "Stimulus",
file: "dist/stimulus.umd.js",
format: "umd",
banner
},
{
file: "dist/stimulus.js",
format: "es",
banner
},
],
context: "window",
plugins: [
resolve()
]
},
{
external: [
"@hotwired/stimulus",
"@hotwired/stimulus-webpack-helpers"
],
input: "webpack-helpers.js",
output: [
{
globals: {
'@hotwired/stimulus-webpack-helpers': 'StimulusWebpackHelpers'
},
name: "Stimulus",
file: "dist/webpack-helpers.umd.js",
format: "umd",
banner
},
{
file: "dist/webpack-helpers.js",
format: "es",
banner
},
],
context: "window",
plugins: [
resolve()
]
}
]
2 changes: 2 additions & 0 deletions packages/stimulus/webpack-helpers.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "@hotwired/stimulus-webpack-helpers"
export as namespace StimulusWebpackHelpers
1 change: 1 addition & 0 deletions packages/stimulus/webpack-helpers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "@hotwired/stimulus-webpack-helpers"
5 changes: 5 additions & 0 deletions packages/stimulus/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
# yarn lockfile v1


"@hotwired/stimulus-webpack-helpers@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@hotwired/stimulus-webpack-helpers/-/stimulus-webpack-helpers-1.0.0.tgz#6bd7906a4a2b6e1cd8732203b60264f987bd1084"
integrity sha512-6oKDmJDSsV+zdlHnF485nneuekY/Zbl669wei4HIiwxUWHhVSU1XIVji4aj+Ws9AXghjTYBS8H5ralB97BVMDw==

"@hotwired/stimulus@^3.0.0":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@hotwired/stimulus/-/stimulus-3.0.0.tgz#45171e61417af60f0e546665c52fae5b67295cee"
Expand Down

0 comments on commit 5827509

Please sign in to comment.