Skip to content

Commit 46305d4

Browse files
committed
Update to bridgetown 2.0
1 parent 071204f commit 46305d4

File tree

6 files changed

+620
-475
lines changed

6 files changed

+620
-475
lines changed

Gemfile.lock

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
activesupport (7.2.2.1)
4+
activesupport (7.2.2.2)
55
base64
66
benchmark (>= 0.3)
77
bigdecimal
@@ -15,22 +15,22 @@ GEM
1515
tzinfo (~> 2.0, >= 2.0.5)
1616
addressable (2.8.7)
1717
public_suffix (>= 2.0.2, < 7.0)
18-
amazing_print (1.7.2)
19-
base64 (0.2.0)
20-
benchmark (0.4.0)
21-
bigdecimal (3.1.9)
22-
bridgetown (2.0.0.beta5)
23-
bridgetown-builder (= 2.0.0.beta5)
24-
bridgetown-core (= 2.0.0.beta5)
25-
bridgetown-foundation (= 2.0.0.beta5)
26-
bridgetown-paginate (= 2.0.0.beta5)
27-
bridgetown-builder (2.0.0.beta5)
28-
bridgetown-core (= 2.0.0.beta5)
29-
bridgetown-core (2.0.0.beta5)
18+
amazing_print (1.8.1)
19+
base64 (0.3.0)
20+
benchmark (0.4.1)
21+
bigdecimal (3.2.3)
22+
bridgetown (2.0.0)
23+
bridgetown-builder (= 2.0.0)
24+
bridgetown-core (= 2.0.0)
25+
bridgetown-foundation (= 2.0.0)
26+
bridgetown-paginate (= 2.0.0)
27+
bridgetown-builder (2.0.0)
28+
bridgetown-core (= 2.0.0)
29+
bridgetown-core (2.0.0)
3030
activesupport (>= 6.0, < 8.0)
3131
addressable (~> 2.4)
3232
amazing_print (~> 1.2)
33-
bridgetown-foundation (= 2.0.0.beta5)
33+
bridgetown-foundation (= 2.0.0)
3434
csv (~> 3.2)
3535
dry-inflector (>= 1.0)
3636
erubi (~> 1.9)
@@ -53,26 +53,27 @@ GEM
5353
thor (~> 1.1)
5454
tilt (~> 2.0)
5555
zeitwerk (~> 2.5)
56-
bridgetown-foundation (2.0.0.beta5)
56+
bridgetown-foundation (2.0.0)
5757
hash_with_dot_access (~> 2.0)
5858
inclusive (~> 1.0)
5959
zeitwerk (~> 2.5)
60-
bridgetown-paginate (2.0.0.beta5)
61-
bridgetown-core (= 2.0.0.beta5)
60+
bridgetown-paginate (2.0.0)
61+
bridgetown-core (= 2.0.0)
6262
concurrent-ruby (1.3.5)
63-
connection_pool (2.5.2)
64-
csv (3.3.4)
63+
connection_pool (2.5.4)
64+
csv (3.3.5)
6565
date (3.4.1)
66-
drb (2.2.1)
66+
drb (2.2.3)
6767
dry-inflector (1.2.0)
68+
erb (5.0.2)
6869
erubi (1.13.1)
69-
faraday (2.13.0)
70+
faraday (2.13.4)
7071
faraday-net_http (>= 2.0, < 3.5)
7172
json
7273
logger
7374
faraday-follow_redirects (0.3.0)
7475
faraday (>= 1, < 3)
75-
faraday-net_http (3.4.0)
76+
faraday-net_http (3.4.1)
7677
net-http (>= 0.5.0)
7778
ffi (1.17.2)
7879
ffi (1.17.2-aarch64-linux-gnu)
@@ -85,16 +86,16 @@ GEM
8586
ffi (1.17.2-x86_64-darwin)
8687
ffi (1.17.2-x86_64-linux-gnu)
8788
ffi (1.17.2-x86_64-linux-musl)
88-
hash_with_dot_access (2.1.1)
89+
hash_with_dot_access (2.2.0)
8990
i18n (1.14.7)
9091
concurrent-ruby (~> 1.0)
91-
inclusive (1.0.0)
92-
io-console (0.8.0)
92+
inclusive (1.1.0)
93+
io-console (0.8.1)
9394
irb (1.15.2)
9495
pp (>= 0.6.0)
9596
rdoc (>= 4.0.0)
9697
reline (>= 0.4.2)
97-
json (2.10.2)
98+
json (2.14.1)
9899
kramdown (2.5.1)
99100
rexml (>= 3.3.9)
100101
kramdown-parser-gfm (1.1.0)
@@ -111,43 +112,44 @@ GEM
111112
pp (0.6.2)
112113
prettyprint
113114
prettyprint (0.2.0)
114-
psych (5.2.3)
115+
psych (5.2.6)
115116
date
116117
stringio
117-
public_suffix (6.0.1)
118-
puma (6.6.0)
118+
public_suffix (6.0.2)
119+
puma (7.0.3)
119120
nio4r (~> 2.0)
120-
rack (3.1.14)
121+
rack (3.2.1)
121122
rackup (2.2.1)
122123
rack (>= 3)
123-
rake (13.2.1)
124+
rake (13.3.0)
124125
rb-fsevent (0.11.2)
125126
rb-inotify (0.11.1)
126127
ffi (~> 1.0)
127-
rdoc (6.13.1)
128+
rdoc (6.14.2)
129+
erb
128130
psych (>= 4.0.0)
129-
reline (0.6.1)
131+
reline (0.6.2)
130132
io-console (~> 0.5)
131-
rexml (3.4.1)
132-
roda (3.91.0)
133+
rexml (3.4.4)
134+
roda (3.96.0)
133135
rack
134-
rouge (4.5.1)
136+
rouge (4.6.0)
135137
securerandom (0.4.1)
136-
serbea (2.2.0)
137-
erubi (>= 1.10)
138-
tilt (~> 2.0)
139-
signalize (1.3.0)
138+
serbea (2.3.0)
139+
erubi (>= 1.11)
140+
tilt (>= 2.1)
141+
signalize (1.3.1)
140142
concurrent-ruby (~> 1.2)
141-
streamlined (0.6.0)
143+
streamlined (0.6.1)
142144
serbea (>= 2.1)
143145
zeitwerk (~> 2.5)
144146
stringio (3.1.7)
145-
thor (1.3.2)
146-
tilt (2.6.0)
147+
thor (1.4.0)
148+
tilt (2.6.1)
147149
tzinfo (2.0.6)
148150
concurrent-ruby (~> 1.0)
149151
uri (1.0.3)
150-
zeitwerk (2.7.2)
152+
zeitwerk (2.7.3)
151153

152154
PLATFORMS
153155
aarch64-linux-gnu
@@ -167,4 +169,4 @@ DEPENDENCIES
167169
puma
168170

169171
BUNDLED WITH
170-
2.5.11
172+
2.7.2

config/esbuild.defaults.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// when an update is applied hence we strongly recommend adding overrides to
77
// `esbuild.config.js` instead of editing this file.
88
//
9-
// Shipped with Bridgetown v2.0.0.beta2
9+
// Shipped with Bridgetown v2.0.0
1010

1111
// DO NOT MANUALLY EDIT THIS CONFIGURATION:
1212
const autogeneratedBridgetownConfig = {
@@ -16,19 +16,19 @@ const autogeneratedBridgetownConfig = {
1616
"islandsDir": "_islands"
1717
}
1818

19-
const path = require("path")
20-
const fsLib = require("fs")
19+
import path from "path"
20+
import fsLib from "fs"
2121
const fs = fsLib.promises
22-
const { pathToFileURL, fileURLToPath } = require("url")
23-
const glob = require("glob")
24-
const postcss = require("postcss")
25-
const postCssImport = require("postcss-import")
26-
const readCache = require("read-cache")
22+
import { pathToFileURL, fileURLToPath } from "url"
23+
import { glob } from "glob"
24+
import postcss from "postcss"
25+
import postCssImport from "postcss-import"
26+
import readCache from "read-cache"
2727

2828
// Detect if an NPM package is available
2929
const moduleAvailable = name => {
3030
try {
31-
require.resolve(name)
31+
import.meta.resolve(name)
3232
return true
3333
} catch (e) { }
3434
return false
@@ -43,7 +43,7 @@ const generateSourceMappingURL = sourceMap => {
4343
// Import Sass if available
4444
let sass
4545
if (moduleAvailable("sass")) {
46-
sass = require("sass")
46+
sass = (await import("sass")).default
4747
}
4848

4949
// Glob plugin derived from:
@@ -288,9 +288,9 @@ const bridgetownConfigured = (bridgetownConfig, outputFolder) => {
288288
}
289289

290290
// Load the PostCSS config from postcss.config.js or whatever else is a supported location/format
291-
const postcssrc = require("postcss-load-config")
291+
const postcssrc = (await import("postcss-load-config")).default
292292

293-
module.exports = async (esbuildOptions, ...args) => {
293+
export default async (esbuildOptions, ...args) => {
294294
let outputFolder;
295295
if (typeof esbuildOptions === "string") { // legacy syntax where first argument is output folder
296296
outputFolder = esbuildOptions
@@ -313,11 +313,12 @@ module.exports = async (esbuildOptions, ...args) => {
313313
esbuildOptions.plugins.push(bridgetownPreset(bridgetownConfig))
314314
if (esbuildOptions.bridgetownConfig) delete esbuildOptions.bridgetownConfig
315315

316-
const esbuild = require("esbuild")
316+
const esbuild = (await import("esbuild")).default
317317
const entryPoints = esbuildOptions.entryPoints || ["./frontend/javascript/index.js"]
318318
if (esbuildOptions.entryPoints) delete esbuildOptions.entryPoints
319319

320320
const islands = glob.sync(`./${bridgetownConfig.source}/${bridgetownConfig.islandsDir}/*.{js,js.rb}`).map(item => `./${item}`)
321+
const islandsAsObject = islands.reduce((obj, str) => obj[str] = str, {})
321322

322323
esbuild.context({
323324
bundle: true,
@@ -339,7 +340,7 @@ module.exports = async (esbuildOptions, ...args) => {
339340
minify: process.argv.includes("--minify"),
340341
sourcemap: true,
341342
target: "es2020",
342-
entryPoints: [...entryPoints, ...islands],
343+
entryPoints: Array.isArray(entryPoints) ? [...entryPoints, ...islands] : {...entryPoints, ...islandsAsObject},
343344
entryNames: "[dir]/[name].[hash]",
344345
outdir: path.join(process.cwd(), `${bridgetownConfig.destination}/_bridgetown/static`),
345346
publicPath: "/_bridgetown/static",

esbuild.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const build = require("./config/esbuild.defaults.js")
1+
import build from "./config/esbuild.defaults.js"
22

33
// You can customize this as you wish, perhaps to add new esbuild plugins.
44
//

0 commit comments

Comments
 (0)