Skip to content

Commit 4958529

Browse files
committed
test: coffee esm loader options
1 parent e737265 commit 4958529

File tree

7 files changed

+70
-21
lines changed

7 files changed

+70
-21
lines changed

demo/esm/test/loaders/coffee.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
import CoffeeScript from 'coffeescript';
22

3-
const coffeeRegex = /\.coffee$|\.litcoffee$|\.coffee\.md$/;
3+
// See https://github.com/nodejs/node/issues/36396
4+
const extensionsRegex = /\.coffee$|\.litcoffee$|\.coffee\.md$/;
45

56
export async function load(url, context, next) {
6-
if (coffeeRegex.test(url)) {
7+
if (extensionsRegex.test(url)) {
78
const format = 'module';
89
const { source: rawSource } = await next(url, { format });
9-
const source = CoffeeScript.compile(rawSource.toString(), { bare: true });
10+
const source = CoffeeScript.compile(rawSource.toString(), {
11+
bare: true,
12+
inlineMap: true,
13+
filename: url,
14+
header: false,
15+
sourceMap: false,
16+
});
1017
return {format, source};
1118
}
1219
return next(url, context);

demo/issues-esm/test/loaders/coffee.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
import CoffeeScript from 'coffeescript';
22

3-
const coffeeRegex = /\.coffee$|\.litcoffee$|\.coffee\.md$/;
3+
// See https://github.com/nodejs/node/issues/36396
4+
const extensionsRegex = /\.coffee$|\.litcoffee$|\.coffee\.md$/;
45

56
export async function load(url, context, next) {
6-
if (coffeeRegex.test(url)) {
7+
if (extensionsRegex.test(url)) {
78
const format = 'module';
89
const { source: rawSource } = await next(url, { format });
9-
const source = CoffeeScript.compile(rawSource.toString(), { bare: true });
10+
const source = CoffeeScript.compile(rawSource.toString(), {
11+
bare: true,
12+
inlineMap: true,
13+
filename: url,
14+
header: false,
15+
sourceMap: false,
16+
});
1017
return {format, source};
1118
}
1219
return next(url, context);

packages/csv-generate/test/loaders/coffee.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
import CoffeeScript from 'coffeescript';
22

3-
const coffeeRegex = /\.coffee$|\.litcoffee$|\.coffee\.md$/;
3+
// See https://github.com/nodejs/node/issues/36396
4+
const extensionsRegex = /\.coffee$|\.litcoffee$|\.coffee\.md$/;
45

56
export async function load(url, context, next) {
6-
if (coffeeRegex.test(url)) {
7+
if (extensionsRegex.test(url)) {
78
const format = 'module';
89
const { source: rawSource } = await next(url, { format });
9-
const source = CoffeeScript.compile(rawSource.toString(), { bare: true });
10+
const source = CoffeeScript.compile(rawSource.toString(), {
11+
bare: true,
12+
inlineMap: true,
13+
filename: url,
14+
header: false,
15+
sourceMap: false,
16+
});
1017
return {format, source};
1118
}
1219
return next(url, context);

packages/csv-parse/test/loaders/coffee.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
import CoffeeScript from 'coffeescript';
22

3-
const coffeeRegex = /\.coffee$|\.litcoffee$|\.coffee\.md$/;
3+
// See https://github.com/nodejs/node/issues/36396
4+
const extensionsRegex = /\.coffee$|\.litcoffee$|\.coffee\.md$/;
45

56
export async function load(url, context, next) {
6-
if (coffeeRegex.test(url)) {
7+
if (extensionsRegex.test(url)) {
78
const format = 'module';
89
const { source: rawSource } = await next(url, { format });
9-
const source = CoffeeScript.compile(rawSource.toString(), { bare: true });
10+
const source = CoffeeScript.compile(rawSource.toString(), {
11+
bare: true,
12+
inlineMap: true,
13+
filename: url,
14+
header: false,
15+
sourceMap: false,
16+
});
1017
return {format, source};
1118
}
1219
return next(url, context);

packages/csv-stringify/test/loaders/coffee.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
import CoffeeScript from 'coffeescript';
22

3-
const coffeeRegex = /\.coffee$|\.litcoffee$|\.coffee\.md$/;
3+
// See https://github.com/nodejs/node/issues/36396
4+
const extensionsRegex = /\.coffee$|\.litcoffee$|\.coffee\.md$/;
45

56
export async function load(url, context, next) {
6-
if (coffeeRegex.test(url)) {
7+
if (extensionsRegex.test(url)) {
78
const format = 'module';
89
const { source: rawSource } = await next(url, { format });
9-
const source = CoffeeScript.compile(rawSource.toString(), { bare: true });
10+
const source = CoffeeScript.compile(rawSource.toString(), {
11+
bare: true,
12+
inlineMap: true,
13+
filename: url,
14+
header: false,
15+
sourceMap: false,
16+
});
1017
return {format, source};
1118
}
1219
return next(url, context);

packages/csv/test/loaders/coffee.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
import CoffeeScript from 'coffeescript';
22

3-
const coffeeRegex = /\.coffee$|\.litcoffee$|\.coffee\.md$/;
3+
// See https://github.com/nodejs/node/issues/36396
4+
const extensionsRegex = /\.coffee$|\.litcoffee$|\.coffee\.md$/;
45

56
export async function load(url, context, next) {
6-
if (coffeeRegex.test(url)) {
7+
if (extensionsRegex.test(url)) {
78
const format = 'module';
89
const { source: rawSource } = await next(url, { format });
9-
const source = CoffeeScript.compile(rawSource.toString(), { bare: true });
10+
const source = CoffeeScript.compile(rawSource.toString(), {
11+
bare: true,
12+
inlineMap: true,
13+
filename: url,
14+
header: false,
15+
sourceMap: false,
16+
});
1017
return {format, source};
1118
}
1219
return next(url, context);

packages/stream-transform/test/loaders/coffee.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
import CoffeeScript from 'coffeescript';
22

3-
const coffeeRegex = /\.coffee$|\.litcoffee$|\.coffee\.md$/;
3+
// See https://github.com/nodejs/node/issues/36396
4+
const extensionsRegex = /\.coffee$|\.litcoffee$|\.coffee\.md$/;
45

56
export async function load(url, context, next) {
6-
if (coffeeRegex.test(url)) {
7+
if (extensionsRegex.test(url)) {
78
const format = 'module';
89
const { source: rawSource } = await next(url, { format });
9-
const source = CoffeeScript.compile(rawSource.toString(), { bare: true });
10+
const source = CoffeeScript.compile(rawSource.toString(), {
11+
bare: true,
12+
inlineMap: true,
13+
filename: url,
14+
header: false,
15+
sourceMap: false,
16+
});
1017
return {format, source};
1118
}
1219
return next(url, context);

0 commit comments

Comments
 (0)