Skip to content

Commit

Permalink
Enable import attributes.
Browse files Browse the repository at this point in the history
  • Loading branch information
cpojer committed Dec 12, 2024
1 parent 3c99b50 commit ccc1ee7
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 9 deletions.
3 changes: 1 addition & 2 deletions example/src/example/Example.react.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import classNames from 'classnames';
import { fbs, fbt, GenderConst, init, IntlVariations } from 'fbtee';
import { ChangeEvent, useCallback, useState } from 'react';
// @ts-expect-error
import translations from '../translatedFbts.json';
import translations from '../translatedFbts.json' with { type: 'json' };
import ExampleEnum from './Example$FbtEnum.js';

const viewerContext = {
Expand Down
6 changes: 2 additions & 4 deletions example/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import fbteePreset from '@nkzw/babel-fbtee';
import react from '@vitejs/plugin-react';
// @ts-expect-error
import EnumManifest from './.enum_manifest.json';
// @ts-expect-error
import CommonStrings from './common_strings.json';
import EnumManifest from './.enum_manifest.json' with { type: 'json' };
import CommonStrings from './common_strings.json' with { type: 'json' };

const root = process.cwd();

Expand Down
2 changes: 2 additions & 0 deletions jest-preprocessor.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import babel from '@babel/core';
import pluginSyntaxAttributes from '@babel/plugin-syntax-import-attributes';
import presetReact from '@babel/preset-react';
import presetTypescript from '@babel/preset-typescript';

const createTransformer = (opts = {}) => ({
process: (src, filename) =>
babel.transform(src, {
filename,
plugins: [pluginSyntaxAttributes],
presets: [
...(opts?.presets || []),
[
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@babel/core": "^7.26.0",
"@babel/generator": "^7.26.3",
"@babel/parser": "^7.26.3",
"@babel/plugin-syntax-import-attributes": "^7.26.0",
"@babel/preset-react": "^7.26.3",
"@babel/preset-typescript": "^7.26.0",
"@babel/types": "^7.26.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import {
getFbtCollector,
getPackagers,
} from '../collectFbtUtils.tsx';
// @ts-expect-error
import fbtCommon from './FbtCommonForTests.json';
import fbtCommon from './FbtCommonForTests.json' with { type: 'json' };

async function collect(
source: Array<[string, string]> | string,
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-plugin-fbtee/src/utils/addLeafToTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import invariant from 'invariant';
export default function addLeafToTree<V, T extends Record<string, unknown>>(
tree: T,
keys: ReadonlyArray<string | number>,
leaf: unknown,
leaf: V,
) {
let branch = tree;

Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ccc1ee7

Please sign in to comment.