Skip to content

Commit

Permalink
Import ts with extension
Browse files Browse the repository at this point in the history
  • Loading branch information
JrMasterModelBuilder committed Aug 6, 2024
1 parent 9058119 commit 6e2463d
Show file tree
Hide file tree
Showing 28 changed files with 85 additions and 88 deletions.
8 changes: 2 additions & 6 deletions babel.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,9 @@ export default api => {
);
plugins.push(
[
'esm-resolver',
'module-replace',
{
source: {
extensions: [
[['.js', '.mjs', '.jsx', '.mjsx', '.ts', '.tsx'], ext]
]
}
replace: [[/^(\.\.?\/.+)\.(m|c)?tsx?$/i, `$1${ext}`]]
}
],
[
Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"@eslint/js": "^9.8.0",
"@stylistic/eslint-plugin": "^2.6.1",
"@types/node": "^22.1.0",
"babel-plugin-esm-resolver": "^3.0.0",
"babel-plugin-module-replace": "^1.0.1",
"babel-plugin-search-and-replace": "^1.1.1",
"eslint": "^9.8.0",
"eslint-config-prettier": "^9.1.0",
Expand Down
12 changes: 6 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export * from './meta';
export * from './util';
export * from './options';
export * from './value';
export * from './value/';
export * from './plist';
export * from './meta.ts';
export * from './util.ts';
export * from './options.ts';
export * from './value.ts';
export * from './value/index.ts';
export * from './plist.ts';
2 changes: 1 addition & 1 deletion src/meta.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {describe, it} from 'node:test';
import {match} from 'node:assert';

import {NAME, VERSION} from './meta';
import {NAME, VERSION} from './meta.ts';

void describe('meta', () => {
void it('NAME', () => {
Expand Down
6 changes: 3 additions & 3 deletions src/plist.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import {describe, it} from 'node:test';
import {ok, strictEqual, throws} from 'node:assert';
import {readFile} from 'node:fs/promises';

import {Plist} from './plist';
import {ValueBoolean} from './value/boolean';
import {ValueString} from './value/string';
import {Plist} from './plist.ts';
import {ValueBoolean} from './value/boolean.ts';
import {ValueString} from './value/string.ts';

/**
* Extract plist body XML.
Expand Down
8 changes: 4 additions & 4 deletions src/plist.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {INDENT_ROOT, IToXmlOptions, NEWLINE_STRING} from './options';
import {IElement, xmlDecode, xmlElementChildElements} from './util';
import {Value} from './value';
import {ValueDict} from './value/dict';
import {INDENT_ROOT, IToXmlOptions, NEWLINE_STRING} from './options.ts';
import {IElement, xmlDecode, xmlElementChildElements} from './util.ts';
import {Value} from './value.ts';
import {ValueDict} from './value/dict.ts';

const xmlDeclaration = '<?xml version="1.0" encoding="UTF-8"?>';
const xmlDoctype =
Expand Down
2 changes: 1 addition & 1 deletion src/util.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {describe, it} from 'node:test';
import {deepStrictEqual, strictEqual} from 'node:assert';

import {base64Decode, base64Encode, xmlDecode} from './util';
import {base64Decode, base64Encode, xmlDecode} from './util.ts';

void describe('util', () => {
void describe('xmlDecode', () => {
Expand Down
6 changes: 3 additions & 3 deletions src/value.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import {describe, it} from 'node:test';
import {ok, strictEqual, throws} from 'node:assert';

import {IToXmlOptions} from './options';
import {IElement} from './util';
import {Value} from './value';
import {IToXmlOptions} from './options.ts';
import {IElement} from './util.ts';
import {Value} from './value.ts';

class ValueA extends Value {
public static readonly TYPE = 'ValueA';
Expand Down
4 changes: 2 additions & 2 deletions src/value.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {IToXmlOptions} from './options';
import {IElement, xmlDecode} from './util';
import {IToXmlOptions} from './options.ts';
import {IElement, xmlDecode} from './util.ts';

/**
* Value object.
Expand Down
4 changes: 2 additions & 2 deletions src/value/array.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import {describe, it} from 'node:test';
import {strictEqual, throws} from 'node:assert';

import {Value} from '../value';
import {Value} from '../value.ts';

import {ValueArray} from './array';
import {ValueArray} from './array.ts';

void describe('value/array', () => {
void describe('ValueArray', () => {
Expand Down
20 changes: 10 additions & 10 deletions src/value/array.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {INDENT_STRING, NEWLINE_STRING, IToXmlOptions} from '../options';
import {IElement, assertXmlTagName, xmlElementChildElements} from '../util';
import {Value} from '../value';

import {ValueBoolean} from './boolean';
import {ValueData} from './data';
import {ValueDict} from './dict';
import {ValueInteger} from './integer';
import {ValueReal} from './real';
import {ValueString} from './string';
import {INDENT_STRING, NEWLINE_STRING, IToXmlOptions} from '../options.ts';
import {IElement, assertXmlTagName, xmlElementChildElements} from '../util.ts';
import {Value} from '../value.ts';

import {ValueBoolean} from './boolean.ts';
import {ValueData} from './data.ts';
import {ValueDict} from './dict.ts';
import {ValueInteger} from './integer.ts';
import {ValueReal} from './real.ts';
import {ValueString} from './string.ts';

let childTagNames: Readonly<Map<string, new () => Value>>;

Expand Down
2 changes: 1 addition & 1 deletion src/value/boolean.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import {describe, it} from 'node:test';
import {strictEqual, throws} from 'node:assert';

import {ValueBoolean} from './boolean';
import {ValueBoolean} from './boolean.ts';

void describe('value/boolean', () => {
void describe('ValueBoolean', () => {
Expand Down
6 changes: 3 additions & 3 deletions src/value/boolean.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {INDENT_STRING, IToXmlOptions} from '../options';
import {INDENT_STRING, IToXmlOptions} from '../options.ts';
import {
IElement,
assertNoXmlElementChildNodes,
assertXmlTagName
} from '../util';
import {Value} from '../value';
} from '../util.ts';
import {Value} from '../value.ts';

/**
* ValueBoolean object.
Expand Down
2 changes: 1 addition & 1 deletion src/value/data.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import {describe, it} from 'node:test';
import {deepStrictEqual, strictEqual, throws} from 'node:assert';

import {ValueData} from './data';
import {ValueData} from './data.ts';

void describe('value/data', () => {
void describe('ValueData', () => {
Expand Down
6 changes: 3 additions & 3 deletions src/value/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import {
INDENT_STRING,
IToXmlOptions,
NEWLINE_STRING
} from '../options';
} from '../options.ts';
import {
IElement,
assertXmlTagName,
base64Decode,
base64Encode,
xmlElementText
} from '../util';
import {Value} from '../value';
} from '../util.ts';
import {Value} from '../value.ts';

/**
* ValueData object.
Expand Down
2 changes: 1 addition & 1 deletion src/value/date.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import {describe, it} from 'node:test';
import {deepStrictEqual, strictEqual, throws} from 'node:assert';

import {ValueDate} from './date';
import {ValueDate} from './date.ts';

void describe('value/integer', () => {
void describe('ValueDate', () => {
Expand Down
6 changes: 3 additions & 3 deletions src/value/date.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {INDENT_STRING, IToXmlOptions} from '../options';
import {IElement, assertXmlTagName, xmlElementText} from '../util';
import {Value} from '../value';
import {INDENT_STRING, IToXmlOptions} from '../options.ts';
import {IElement, assertXmlTagName, xmlElementText} from '../util.ts';
import {Value} from '../value.ts';

/**
* ValueDate object.
Expand Down
4 changes: 2 additions & 2 deletions src/value/dict.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import {describe, it} from 'node:test';
import {ok, strictEqual, throws} from 'node:assert';

import {Value} from '../value';
import {Value} from '../value.ts';

import {ValueDict} from './dict';
import {ValueDict} from './dict.ts';

void describe('value/dict', () => {
void describe('ValueDict', () => {
Expand Down
20 changes: 10 additions & 10 deletions src/value/dict.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import {INDENT_STRING, NEWLINE_STRING, IToXmlOptions} from '../options';
import {INDENT_STRING, NEWLINE_STRING, IToXmlOptions} from '../options.ts';
import {
IElement,
assertXmlTagName,
xmlElementChildElements,
xmlElementText
} from '../util';
import {Value} from '../value';

import {ValueArray} from './array';
import {ValueBoolean} from './boolean';
import {ValueData} from './data';
import {ValueInteger} from './integer';
import {ValueReal} from './real';
import {ValueString} from './string';
} from '../util.ts';
import {Value} from '../value.ts';

import {ValueArray} from './array.ts';
import {ValueBoolean} from './boolean.ts';
import {ValueData} from './data.ts';
import {ValueInteger} from './integer.ts';
import {ValueReal} from './real.ts';
import {ValueString} from './string.ts';

let childTagNames: Readonly<Map<string, new () => Value>>;

Expand Down
16 changes: 8 additions & 8 deletions src/value/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export * from './array';
export * from './boolean';
export * from './data';
export * from './date';
export * from './dict';
export * from './integer';
export * from './real';
export * from './string';
export * from './array.ts';
export * from './boolean.ts';
export * from './data.ts';
export * from './date.ts';
export * from './dict.ts';
export * from './integer.ts';
export * from './real.ts';
export * from './string.ts';
2 changes: 1 addition & 1 deletion src/value/integer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import {describe, it} from 'node:test';
import {strictEqual, throws} from 'node:assert';

import {ValueInteger} from './integer';
import {ValueInteger} from './integer.ts';

const small = '9007199254740991';
const smallPos = `+${small}`;
Expand Down
6 changes: 3 additions & 3 deletions src/value/integer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {INDENT_STRING, IToXmlOptions} from '../options';
import {IElement, assertXmlTagName, xmlElementText} from '../util';
import {Value} from '../value';
import {INDENT_STRING, IToXmlOptions} from '../options.ts';
import {IElement, assertXmlTagName, xmlElementText} from '../util.ts';
import {Value} from '../value.ts';

const MAX_NUM = 0x1fffffffffffff;

Expand Down
2 changes: 1 addition & 1 deletion src/value/real.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import {describe, it} from 'node:test';
import {strictEqual, throws} from 'node:assert';

import {ValueReal} from './real';
import {ValueReal} from './real.ts';

void describe('value/real', () => {
void describe('ValueReal', () => {
Expand Down
6 changes: 3 additions & 3 deletions src/value/real.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {INDENT_STRING, IToXmlOptions} from '../options';
import {IElement, assertXmlTagName, xmlElementText} from '../util';
import {Value} from '../value';
import {INDENT_STRING, IToXmlOptions} from '../options.ts';
import {IElement, assertXmlTagName, xmlElementText} from '../util.ts';
import {Value} from '../value.ts';

/**
* ValueReal object.
Expand Down
2 changes: 1 addition & 1 deletion src/value/string.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import {describe, it} from 'node:test';
import {strictEqual, throws} from 'node:assert';

import {ValueString} from './string';
import {ValueString} from './string.ts';

void describe('value/string', () => {
void describe('ValueString', () => {
Expand Down
6 changes: 3 additions & 3 deletions src/value/string.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {INDENT_STRING, IToXmlOptions} from '../options';
import {IElement, assertXmlTagName, xmlElementText} from '../util';
import {Value} from '../value';
import {INDENT_STRING, IToXmlOptions} from '../options.ts';
import {IElement, assertXmlTagName, xmlElementText} from '../util.ts';
import {Value} from '../value.ts';

/**
* ValueString object.
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "commonjs",
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true,
"allowImportingTsExtensions": true,
"lib": ["ESNext"],
"newLine": "lf",

Expand Down

0 comments on commit 6e2463d

Please sign in to comment.