UNPKG

18.5 kBMarkdownView Raw
1# microsite
2
3## 1.0.1
4
5### Patch Changes
6
7- 41f0201: Remove init script if no hydrated components exist
8- fe2d1d7: Resolve exact version of Preact used in project
9- 712dc53: Fixes build issue where no esm dependencies would be found
10
11## 1.0.0
12
13### Major Changes
14
15- 2ae753d: Microsite has been completely rewritten to focus on what it does best—optimize your static site for partial hydration.
16
17 Rather than implementing a highly-opinionated, custom build pipeline, Microsite@1.0.0 leverages the power of [Snowpack](https://www.snowpack.dev/)'s upcoming 3.0.0 release. This means that there are a number of new features, notably:
18
19 - Pages can now be written in your preferred file format—TypeScript or plain old JavaScript.
20 - If your file/asset types are [supported in Snowpack](https://www.snowpack.dev/reference/supported-files), they are supported by Microsite. This is because Microsite has delegated the initial compilation of your site completely to Snowpack!
21 - `microsite dev` spins up a Snowpack development server with best-in-class DX, including built-in HMR with [Prefresh](https://github.com/JoviDeCroock/prefresh/tree/main).
22 - `microsite build --serve` performs a build and serves the result on a local server, for testing production builds.
23
24 There are a small number of breaking changes in the release:
25
26 - Microsite now relies on explicit [subpath exports](https://nodejs.org/api/packages.html#packages_subpath_exports), meaning only public files can be accessed from Node.
27 - Global asset entry points have been moved from `src/global.ts` and `src/global.css` to `src/global/index.ts` and `src/global/index.css`.
28 - Global scripts are no longer executed as a side-effect. Global scripts must contain a single `export default async () => {}`, which is executed on page load.
29
30### Patch Changes
31
32- 914bf18: Fix cosmicconfig CJS interop issue
33- 727fc04: Remove cache dir for now
34- 7681446: Fixed a bug where automatic JSX inject would not always be triggered
35- d5993d7: Automatically use PostCSS if a postcss.config.cjs file is found
36- a3b38a8: Automatic JSX injection is fixed (I really mean it this time.)
37
38 Added automatic aliasing for `tsconfig` `paths`.
39
40 Fixed a bug where `microsite/global` was not included in the vendor bundle.
41
42 Fixed a bug where `shared` components would not be concatenated into a single chunk.
43
44 Added minification for the `init` hydration script.
45
46- c17d109: Fix bug with JSX Pragma injection
47- 1dff58f: Fixed issue with automatic environment typings.
48
49 Fixed issue where JSX pragma (`h`, `Fragment`) was not being automatically injected.
50
51 Enabled Snowpack to pick up on `tsconfig.json` or `jsconfig.json` `paths` aliases automatically.
52
53## 1.0.0-next.7
54
55### Patch Changes
56
57- 727fc04: Remove cache dir for now
58
59## 1.0.0-next.6
60
61### Patch Changes
62
63- 914bf18: Fix cosmicconfig CJS interop issue
64
65## 1.0.0-next.5
66
67### Patch Changes
68
69- Automatically use PostCSS if a postcss.config.cjs file is found
70
71## 1.0.0-next.4
72
73### Patch Changes
74
75- a3b38a8: Automatic JSX injection is fixed (I really mean it this time.)
76
77 Added automatic aliasing for `tsconfig` `paths`.
78
79 Fixed a bug where `microsite/global` was not included in the vendor bundle.
80
81 Fixed a bug where `shared` components would not be concatenated into a single chunk.
82
83 Added minification for the `init` hydration script.
84
85## 1.0.0-next.3
86
87### Patch Changes
88
89- 7681446: Fixed a bug where automatic JSX inject would not always be triggered
90
91## 1.0.0-next.2
92
93### Patch Changes
94
95- Fix bug with JSX Pragma injection
96
97## 1.0.0-next.1
98
99### Patch Changes
100
101- Fixed issue with automatic environment typings.
102
103 Fixed issue where JSX pragma (`h`, `Fragment`) was not being automatically injected.
104
105 Enabled Snowpack to pick up on `tsconfig.json` or `jsconfig.json` `paths` aliases automatically.
106
107## 1.0.0-next.0
108
109### Major Changes
110
111- 2ae753d: Microsite has been completely rewritten to focus on what it does best—optimize your static site for partial hydration.
112
113 Rather than implementing a highly-opinionated, custom build pipeline, Microsite@1.0.0 leverages the power of [Snowpack](https://www.snowpack.dev/)'s upcoming 3.0.0 release. This means that there are a number of new features, notably:
114
115 - Pages can now be written in your preferred file format—TypeScript or plain old JavaScript.
116 - If your file/asset types are [supported in Snowpack](https://www.snowpack.dev/reference/supported-files), they are supported by Microsite. This is because Microsite has delegated the initial compilation of your site completely to Snowpack!
117 - `microsite dev` spins up a Snowpack development server with best-in-class DX, including built-in HMR with [Prefresh](https://github.com/JoviDeCroock/prefresh/tree/main).
118 - `microsite build --serve` performs a build and serves the result on a local server, for testing production builds.
119
120 There are a small number of breaking changes in the release:
121
122 - Microsite now relies on explicit [subpath exports](https://nodejs.org/api/packages.html#packages_subpath_exports), meaning only public files can be accessed from Node.
123 - Global asset entry points have been moved from `src/global.ts` and `src/global.css` to `src/global/index.ts` and `src/global/index.css`.
124 - Global scripts are no longer executed as a side-effect. Global scripts must contain a single `export default async () => {}`, which is executed on page load.
125
126## 0.7.6
127
128### Patch Changes
129
130- 837da9c: Fix issue with `<pre> <code>` dedent
131
132## 0.7.5
133
134### Patch Changes
135
136- cb4da30: Fix dedent within <pre> tags
137
138## 0.7.4
139
140### Patch Changes
141
142- 5eb1b20: Fix issue where shared styles of non-hydrated components would not be included in the output
143
144## 0.7.3
145
146### Patch Changes
147
148- 2535fe9: Fix bug where global script would have extra code injected
149
150## 0.7.2
151
152### Patch Changes
153
154- c71d8da: Whoops, actually fix that bundling bug
155
156## 0.7.1
157
158### Patch Changes
159
160- bf8cfa0: Fix bundling bug
161
162## 0.7.0
163
164### Minor Changes
165
166- 65bf0bd: Implements a caching strategy for `getStaticProps` and `getStaticPaths`, which can often become a build bottleneck due to network or filesystem reads.
167
168 This change introduces a new `prefetch` method for both of these functions. [Read the docs](/docs/data-fetching) for more details.
169
170### Patch Changes
171
172- 4475a3c: Update prefetch logic to accomodate changing headers
173- f3b313b: Update to esbuild@0.8.x
174
175## 0.7.0-next.2
176
177### Patch Changes
178
179- 4475a3c: Update prefetch logic to accomodate changing headers
180
181## 0.7.0-next.1
182
183### Patch Changes
184
185- f3b313b: Update to esbuild@0.8.x
186
187## 0.7.0-next.0
188
189### Minor Changes
190
191- 65bf0bd: Implements a caching strategy for `getStaticProps` and `getStaticPaths`, which can often become a build bottleneck due to network or filesystem reads.
192
193 This change introduces a new `prefetch` method for both of these functions. [Read the docs](/docs/data-fetching) for more details.
194
195## 0.6.14
196
197### Patch Changes
198
199- e18c71c: Fix Linux shebang issue (#40) by removing need for --experimental-module-resolution=node. Uses .js import specifiers everywhere
200
201## 0.6.13
202
203### Patch Changes
204
205- 86bdb17: Fix bug where &lt;pre> code was improperly indented
206
207## 0.6.12
208
209### Patch Changes
210
211- 9d22932: Update to typescript@4.1.2
212- 217299b: Update Document viewport meta tag, html lang and dir
213
214## 0.6.12-next.0
215
216### Patch Changes
217
218- 9d22932: Update to typescript@4.1.2
219- 217299b: Update Document viewport meta tag, html lang and dir
220
221## 0.6.11
222
223### Minor Changes
224
225- fd4c454: Add [HTTP Caching](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching) to `fetch` via [`make-fetch-happen`](https://github.com/zkat/make-fetch-happen/). Thanks [@zkat](https://github.com/zkat)!
226
227## 0.6.10
228
229### Patch Changes
230
231- 8a7374f: Add preload hints for hydrated pages
232- 6d0f3a3: Microsite's partial hydration method manages each component as a seperate Preact tree, meaning standard `Context` won't work across components.
233
234 This update adds a `microsite/global` entry point which exposes two utilities for sharing state across component trees.
235
236 **`createGlobalState`** creates a [`Proxy`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) which acts as a mutable data source. Mutating this object notifies any consuming components that they should rerender.
237
238 > If you're a fan of Vue, this is very similar to `reactive` from the Composition API.
239
240 Components can consume this global state object via **`useGlobalState(state)`**.
241
242 ```tsx
243 // utils/state.tsx
244 import { createGlobalState } from "microsite/global";
245
246 export const state = createGlobalState({
247 count: 0
248 });
249
250 // components/Counter.tsx
251 import { withHydrate } from "microsite/hydrate";
252 import { useGlobalState } from "microsite/global";
253 import { state } from "@/utils/state";
254
255 const Counter = () => {
256 const localState = useGlobalState(state);
257 // `localState` is a readonly snapshot of global `state`
258 // Updates can be written to global `state` by direct mutation
259
260 return (
261 <>
262 <button onClick={() => state.count--}>-</button>
263 <span>{localState.count}</span>
264 <button onClick={() => state.count++}>+</button>
265 </>
266 );
267 };
268
269 export default withHydrate(Counter);
270 ```
271
272- 6d0f3a3: Fix issue with CSS scoped name generation
273
274## 0.6.9
275
276### Patch Changes
277
278- 788860d: Add --no-clean flag to persist intermediate build (useful for debugging)
279- 64add28: Fixes issue with named hydration chunks
280- 10f9fd5: Improve caching by using external styles rather than inlined styles
281- 0641e72: Update microsite bin to use correct arguments
282
283## 0.6.9-next.0
284
285### Patch Changes
286
287- Add --no-clean flag to persist intermediate build (useful for debugging)
288
289## 0.6.6
290
291### Patch Changes
292
293- 7e955a0: Ensure children is not required for Head component
294
295## 0.6.5
296
297### Patch Changes
298
299- f65c7f4: Improve types by adding global `h` and `Fragment`, and ambient `*.modules.css` declarations
300
301## 0.6.4
302
303### Patch Changes
304
305- e53864f: Update default `tsconfig` to be named `base`.
306
307 Update `tsconfig.baseUrl` to resolve from inside `node_modules`
308
309## 0.6.3
310
311### Patch Changes
312
313- a760228: Automatically inject h and Fragment
314- 580bb4f: expose default tsconfig.json for end-users
315
316## 0.6.2
317
318### Patch Changes
319
320- 60de6a2: Fix esbuild jsxFactory
321
322## 0.6.1
323
324### Patch Changes
325
326- a3a5131: Fix external warning
327- 5c79ec3: update README
328
329## 0.6.0
330
331### Breaking Changes
332
333- 9d0e9cc: Drop `@types/react` and switch to `preact`. See issue [#5](https://github.com/natemoo-re/microsite/issues/5) for more background.
334
335## 0.0.0-canary-2020101419274
336
337### Breaking Changes
338
339- 7fd4679: Drop `@types/react` and switch to `preact`. See issue [#5](https://github.com/natemoo-re/microsite/issues/5) for more background.
340
341## 0.5.1
342
343### Patch Changes
344
345- 3d99331: Fix handling of node builtins for intermediate builds
346- 3d99331: Remove .microsite/cache dir for now
347
348## 0.5.1-next.0
349
350### Patch Changes
351
352- a29b71e: Fix handling of node builtins for intermediate builds
353- 078b910: Remove .microsite/cache dir for now
354
355## 0.5.0
356
357### Minor Changes
358
359- 47eec22: **Build performance improvements**
360
361 Rather than relying on [`@rollup/plugin-typescript`](https://github.com/rollup/plugins/tree/master/packages/typescript) (which uses `typescript` under the hood), we have switched to [`rollup-plugin-esbuild`](https://github.com/egoist/rollup-plugin-esbuild) to perform code transforms.
362
363 [`esbuild`](https://github.com/evanw/esbuild) is very very fast. Now, so is Microsite.
364
365### Patch Changes
366
367- 275f297: Gracefully handle Component/export name mismatch
368
369 Automatically handle `tsconfig.paths` aliases
370
371- 945685d: **SEO**
372
373 Microsite aims to make SEO as simple as possible, so this featureset adds built-in SEO utility components to `microsite/head` under the `seo` namespace.
374
375 The benefit of using `seo` components over manual `meta` tag configuration is API simplicity, since `seo` automatically configures duplicate [Open Graph](https://ogp.me/)/social meta tags for you.
376
377 If something here doesn't cover your use case, please feel free to [open an issue](https://github.com/natemoo-re/microsite/issues/new).
378
379 ```tsx
380 import { Head, seo } from "microsite/head";
381
382 <Head>
383 <seo.title>Easy SEO</seo.title>
384 <seo.description>Hello world!</seo.description>
385 <seo.image
386 src="https://og-image.now.sh/**Hello**%20World.png?theme=light&md=1&fontSize=100px&images=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Ffront%2Fassets%2Fdesign%2Fvercel-triangle-black.svg"
387 width={100}
388 height={100}
389 />
390 <seo.twitter handle="@n_moore" />
391 </Head>;
392 ```
393
394 #### seo.robots
395
396 By default, `<Head>` now automatically adds the following tags.
397
398 ```html
399 <meta name="robots" content="index,follow" />
400 <meta name="googlebot" content="index,follow" />
401 ```
402
403 This behavior can be controlled with the `<seo.robots>` helper, which accepts `noindex` and `nofollow` booleans.
404
405 ```tsx
406 <seo.robots noindex nofollow />
407 ```
408
409 #### seo.title
410
411 `<seo.title>` has the same API as a regular `<title>` tag—it accepts a `string` child. `<seo.title>` sets the page `<title>` as well as `<meta property="og:title">`.
412
413 #### seo.description
414
415 `<seo.description>` accepts a `string` child. `<seo.description>` sets `<meta name="description">` as well as `<meta property="og:description">`.
416
417 #### seo.canonical
418
419 `<seo.canonical>` accepts a `string` child representing the canonical URL of the current page. It generates `<link rel="canonical">` and `<meta property="og:url">`.
420
421 #### seo.image
422
423 `<seo.image>` exposes an API similar to the native `<img>`, accepting `src`, `alt`, `width`, and `height` props. It generates all the meta tags necessary for valid Open Graph images.
424
425 #### seo.video
426
427 `<seo.video>` exposes an API similar to the native `<video>`, accepting `src`, `width`, and `height` props. It generates all the meta tags necessary for valid Open Graph videos.
428
429 #### seo.audio
430
431 `<seo.audio>` exposes an API similar to the native `<audio>`, accepting only a `src` prop. It generates all the meta tags necessary for valid Open Graph audio.
432
433 #### seo.twitter
434
435 `<seo.twitter>` controls [Twitter meta tags](https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/markup). It accepts `card`, `handle` (maps to `twitter:creator`), and `site`.
436
437 #### seo.facebook
438
439 `<seo.facebook>` accepts an `appId` in order to set `<meta property="fb:app_id">`.
440
441 #### seo.openGraph
442
443 `<seo.openGraph>` provides low-level control over [Open Graph meta tags](https://ogp.me/). The accepted props vary based on `type`, so you might want to dig [into the code](https://github.com/natemoo-re/microsite/blob/8c0599f8c05da3214534b864c536a2614a89fb7f/src/head.tsx#L14) for this one.
444
445- 17e3130: Fix issue when building projects without optional global/hydrated files
446- da6e0f3: Improve build performance (parallelization)
447- eaec00b: Fixes issue with static path generation for the `/` route
448
449## 0.5.0-alpha.0
450
451### Minor Changes
452
453- 47eec22: **Build performance improvements**
454
455 Rather than relying on [`@rollup/plugin-typescript`](https://github.com/rollup/plugins/tree/master/packages/typescript) (which uses `typescript` under the hood), we have switched to [`rollup-plugin-esbuild`](https://github.com/egoist/rollup-plugin-esbuild) to perform code transforms.
456
457 [`esbuild`](https://github.com/evanw/esbuild) is very very fast. Now, so is Microsite.
458
459### Patch Changes
460
461- 945685d: **SEO**
462
463 Microsite aims to make SEO as simple as possible, so this featureset adds built-in SEO utility components to `microsite/head` under the `seo` namespace.
464
465 The benefit of using `seo` components over manual `meta` tag configuration is API simplicity, since `seo` automatically configures duplicate [Open Graph](https://ogp.me/)/social meta tags for you.
466
467 If something here doesn't cover your use case, please feel free to [open an issue](https://github.com/natemoo-re/microsite/issues/new).
468
469 ```tsx
470 import { Head, seo } from "microsite/head";
471
472 <Head>
473 <seo.title>Easy SEO</seo.title>
474 <seo.description>Hello world!</seo.description>
475 <seo.image
476 src="https://og-image.now.sh/**Hello**%20World.png?theme=light&md=1&fontSize=100px&images=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Ffront%2Fassets%2Fdesign%2Fvercel-triangle-black.svg"
477 width={100}
478 height={100}
479 />
480 <seo.twitter handle="@n_moore" />
481 </Head>;
482 ```
483
484 #### seo.robots
485
486 By default, `<Head>` now automatically adds the following tags.
487
488 ```html
489 <meta name="robots" content="index,follow" />
490 <meta name="googlebot" content="index,follow" />
491 ```
492
493 This behavior can be controlled with the `<seo.robots>` helper, which accepts `noindex` and `nofollow` booleans.
494
495 ```tsx
496 <seo.robots noindex nofollow />
497 ```
498
499 #### seo.title
500
501 `<seo.title>` has the same API as a regular `<title>` tag—it accepts a `string` child. `<seo.title>` sets the page `<title>` as well as `<meta property="og:title">`.
502
503 #### seo.description
504
505 `<seo.description>` accepts a `string` child. `<seo.description>` sets `<meta name="description">` as well as `<meta property="og:description">`.
506
507 #### seo.canonical
508
509 `<seo.canonical>` accepts a `string` child representing the canonical URL of the current page. It generates `<link rel="canonical">` and `<meta property="og:url">`.
510
511 #### seo.image
512
513 `<seo.image>` exposes an API similar to the native `<img>`, accepting `src`, `alt`, `width`, and `height` props. It generates all the meta tags necessary for valid Open Graph images.
514
515 #### seo.video
516
517 `<seo.video>` exposes an API similar to the native `<video>`, accepting `src`, `width`, and `height` props. It generates all the meta tags necessary for valid Open Graph videos.
518
519 #### seo.audio
520
521 `<seo.audio>` exposes an API similar to the native `<audio>`, accepting only a `src` prop. It generates all the meta tags necessary for valid Open Graph audio.
522
523 #### seo.twitter
524
525 `<seo.twitter>` controls [Twitter meta tags](https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/markup). It accepts `card`, `handle` (maps to `twitter:creator`), and `site`.
526
527 #### seo.facebook
528
529 `<seo.facebook>` accepts an `appId` in order to set `<meta property="fb:app_id">`.
530
531 #### seo.openGraph
532
533 `<seo.openGraph>` provides low-level control over [Open Graph meta tags](https://ogp.me/). The accepted props vary based on `type`, so you might want to dig [into the code](https://github.com/natemoo-re/microsite/blob/8c0599f8c05da3214534b864c536a2614a89fb7f/src/head.tsx#L14) for this one.
534
\No newline at end of file