Skip to content
This repository was archived by the owner on Jan 31, 2023. It is now read-only.

Commit e6d60cb

Browse files
major: Update deps, remove cjsx support
1 parent f8baedc commit e6d60cb

File tree

7 files changed

+1809
-1312
lines changed

7 files changed

+1809
-1312
lines changed

.node-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.11.3
1+
8.2.1

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,18 @@ browserify({
6060
})
6161
```
6262

63-
If you pass one of the top-level options in (`extensions`, `transform`, etc), it will override the default. In the above example, browserify will process `.js` and `.ts` files, but not `.jsx`, `.coffee`, or `.cjsx`. If you wish to add to or modify existing options, read about [modifying the default options](#modifying-default-options).
63+
If you pass one of the top-level options in (`extensions`, `transform`, etc), it will override the default. In the above example, browserify will process `.js` and `.ts` files, but not `.jsx` or `.coffee`. If you wish to add to or modify existing options, read about [modifying the default options](#modifying-default-options).
6464

6565
[watchify](https://github.com/browserify/watchify) is automatically configured as a plugin (as needed), so it's not necessary to manually specify it.
6666

6767
**Default**:
6868

6969
```javascript
7070
{
71-
extensions: ['.js', '.jsx', '.coffee', '.cjsx'],
71+
extensions: ['.js', '.jsx', '.coffee'],
7272
transform: [
7373
[
74-
'cjsxify',
74+
'coffeeify',
7575
{}
7676
],
7777
[

cjsxify.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

index.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ const debug = require('debug')('cypress:browserify')
1111

1212
const bundles = {}
1313

14-
// by default, we transform JavaScript (up to anything at stage-4), JSX,
15-
// CoffeeScript, and CJSX (CoffeeScript + JSX)
14+
// by default, we transform JavaScript (including some proposal features),
15+
// JSX, & CoffeeScript
1616
const defaultOptions = {
1717
browserifyOptions: {
18-
extensions: ['.js', '.jsx', '.coffee', '.cjsx'],
18+
extensions: ['.js', '.jsx', '.coffee'],
1919
transform: [
2020
[
21-
require.resolve('./cjsxify'),
21+
require.resolve('coffeeify'),
2222
{},
2323
],
2424
[
@@ -81,13 +81,15 @@ const preprocessor = (options = {}) => {
8181
// the supported file and spec file to be requested again
8282
return (file) => {
8383
const filePath = file.filePath
84+
8485
debug('get:', filePath)
8586

8687
// since this function can get called multiple times with the same
8788
// filePath, we return the cached bundle promise if we already have one
8889
// since we don't want or need to re-initiate browserify/watchify for it
8990
if (bundles[filePath]) {
9091
debug('already have bundle for:', filePath)
92+
9193
return bundles[filePath]
9294
}
9395

@@ -123,6 +125,7 @@ const preprocessor = (options = {}) => {
123125
// yield the bundle if onBundle is specified so the user can modify it
124126
// as need via `bundle.external()`, `bundle.plugin()`, etc
125127
const onBundle = options.onBundle
128+
126129
if (typeof onBundle === 'function') {
127130
onBundle(bundler)
128131
}
@@ -145,6 +148,7 @@ const preprocessor = (options = {}) => {
145148
}
146149

147150
const ws = fs.createWriteStream(outputPath)
151+
148152
ws.on('finish', () => {
149153
debug('finished bundling:', outputPath)
150154
resolve(outputPath)
@@ -168,6 +172,7 @@ const preprocessor = (options = {}) => {
168172
debug('- update finished for:', filePath)
169173
file.emit('rerun')
170174
})
175+
171176
bundles[filePath] = bundlePromise
172177
// we suppress unhandled rejections so they don't bubble up to the
173178
// unhandledRejection handler and crash the app. Cypress will eventually

0 commit comments

Comments
 (0)