Skip to content

Commit f875ae5

Browse files
committed
fix: only enable experimentalFunctions for new loader
1 parent 5b34489 commit f875ae5

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/loader/babel.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ import { version } from "../../package.json";
1212

1313
type GetCodeFn = (loc: t.SourceLocation) => string;
1414

15-
const babelPluginUntyped: PluginItem = function (api: ConfigAPI) {
15+
const babelPluginUntyped: PluginItem = function (
16+
api: ConfigAPI,
17+
options: { experimentalFunctions?: boolean }
18+
) {
1619
api.cache.using(() => version);
1720

1821
return <PluginObj>{
@@ -89,10 +92,13 @@ const babelPluginUntyped: PluginItem = function (api: ConfigAPI) {
8992
schema.type = "function";
9093
schema.args = [];
9194

92-
// TODO: Check for possible external regressions and only opt-in for loader if any
93-
// if (!schema.tags.includes("@untyped")) {
94-
// return;
95-
// }
95+
// Experimental functions meta support
96+
if (
97+
!options.experimentalFunctions &&
98+
!schema.tags.includes("@untyped")
99+
) {
100+
return;
101+
}
96102

97103
const _getLines = cachedFn(() => this.file.code.split("\n"));
98104
const getCode: GetCodeFn = (loc) => {

src/loader/loader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export async function loadSchema(
2323
interopDefault: true,
2424
transformOptions: {
2525
babel: {
26-
plugins: [untypedPlugin],
26+
plugins: [[untypedPlugin, { experimentalFunctions: true }]],
2727
},
2828
},
2929
})

0 commit comments

Comments
 (0)