dxf-json 0.0.21 → 0.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. package/package.json +5 -2
  2. package/.github/FUNDING.yml +0 -1
  3. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
  4. package/.github/ISSUE_TEMPLATE/custom.md +0 -10
  5. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  6. package/.github/pull_request_template.md +0 -23
  7. package/.github/workflows/npm-publish.yml +0 -55
  8. package/.swcrc +0 -8
  9. package/jest.config.js +0 -20
  10. package/src/consts/block.ts +0 -22
  11. package/src/consts/color.ts +0 -6
  12. package/src/consts/config.ts +0 -2
  13. package/src/consts/dimension.ts +0 -69
  14. package/src/consts/hatch.ts +0 -52
  15. package/src/consts/header.ts +0 -10
  16. package/src/consts/index.ts +0 -9
  17. package/src/consts/lineweight.ts +0 -5
  18. package/src/consts/measurement.ts +0 -4
  19. package/src/consts/obscuredLineTypes.ts +0 -21
  20. package/src/consts/scene.ts +0 -2
  21. package/src/consts/viewport.ts +0 -62
  22. package/src/index.ts +0 -3
  23. package/src/parser/AutoCadColorIndex.ts +0 -265
  24. package/src/parser/DxfArrayScanner.ts +0 -161
  25. package/src/parser/DxfParser.ts +0 -109
  26. package/src/parser/ParseHelpers.ts +0 -124
  27. package/src/parser/blocks/blocks.test.ts +0 -97
  28. package/src/parser/blocks/index.ts +0 -88
  29. package/src/parser/blocks/types.ts +0 -15
  30. package/src/parser/entities/arc/index.ts +0 -2
  31. package/src/parser/entities/arc/parser.ts +0 -67
  32. package/src/parser/entities/arc/types.ts +0 -13
  33. package/src/parser/entities/attdef/consts.ts +0 -12
  34. package/src/parser/entities/attdef/index.ts +0 -3
  35. package/src/parser/entities/attdef/parser.ts +0 -119
  36. package/src/parser/entities/attdef/types.ts +0 -19
  37. package/src/parser/entities/attribute/consts.ts +0 -6
  38. package/src/parser/entities/attribute/index.ts +0 -3
  39. package/src/parser/entities/attribute/parser.ts +0 -198
  40. package/src/parser/entities/attribute/types.ts +0 -31
  41. package/src/parser/entities/circle/index.ts +0 -2
  42. package/src/parser/entities/circle/parser.ts +0 -58
  43. package/src/parser/entities/circle/types.ts +0 -11
  44. package/src/parser/entities/dimension/common.ts +0 -98
  45. package/src/parser/entities/dimension/index.ts +0 -24
  46. package/src/parser/entities/dimension/types.ts +0 -65
  47. package/src/parser/entities/ellipse/index.ts +0 -2
  48. package/src/parser/entities/ellipse/parser.ts +0 -66
  49. package/src/parser/entities/ellipse/types.ts +0 -13
  50. package/src/parser/entities/entities.test.ts +0 -86
  51. package/src/parser/entities/hatch/boundaryPathData/edge.ts +0 -190
  52. package/src/parser/entities/hatch/boundaryPathData/index.ts +0 -27
  53. package/src/parser/entities/hatch/boundaryPathData/polyline.ts +0 -43
  54. package/src/parser/entities/hatch/boundaryPathData/shared.ts +0 -16
  55. package/src/parser/entities/hatch/index.ts +0 -189
  56. package/src/parser/entities/hatch/patternData.ts +0 -57
  57. package/src/parser/entities/hatch/types/boundaryPath.ts +0 -72
  58. package/src/parser/entities/hatch/types/definitionLine.ts +0 -14
  59. package/src/parser/entities/hatch/types/hatch.ts +0 -47
  60. package/src/parser/entities/hatch/types/index.ts +0 -3
  61. package/src/parser/entities/index.ts +0 -87
  62. package/src/parser/entities/insert/index.ts +0 -2
  63. package/src/parser/entities/insert/parser.ts +0 -106
  64. package/src/parser/entities/insert/types.ts +0 -19
  65. package/src/parser/entities/leader/consts.ts +0 -6
  66. package/src/parser/entities/leader/index.ts +0 -3
  67. package/src/parser/entities/leader/parser.ts +0 -119
  68. package/src/parser/entities/leader/types.ts +0 -24
  69. package/src/parser/entities/line/index.ts +0 -2
  70. package/src/parser/entities/line/parser.ts +0 -55
  71. package/src/parser/entities/line/types.ts +0 -11
  72. package/src/parser/entities/lwpolyline/consts.ts +0 -4
  73. package/src/parser/entities/lwpolyline/index.ts +0 -3
  74. package/src/parser/entities/lwpolyline/parser.ts +0 -122
  75. package/src/parser/entities/lwpolyline/types.ts +0 -21
  76. package/src/parser/entities/mtext/consts.ts +0 -5
  77. package/src/parser/entities/mtext/index.ts +0 -3
  78. package/src/parser/entities/mtext/parser.ts +0 -195
  79. package/src/parser/entities/mtext/types.ts +0 -34
  80. package/src/parser/entities/point/index.ts +0 -2
  81. package/src/parser/entities/point/parser.ts +0 -60
  82. package/src/parser/entities/point/types.ts +0 -10
  83. package/src/parser/entities/polyline/consts.ts +0 -17
  84. package/src/parser/entities/polyline/index.ts +0 -3
  85. package/src/parser/entities/polyline/parser.ts +0 -126
  86. package/src/parser/entities/polyline/types.ts +0 -20
  87. package/src/parser/entities/section/index.ts +0 -2
  88. package/src/parser/entities/section/parser.ts +0 -104
  89. package/src/parser/entities/section/types.ts +0 -20
  90. package/src/parser/entities/shared.ts +0 -166
  91. package/src/parser/entities/solid/index.ts +0 -2
  92. package/src/parser/entities/solid/parser.ts +0 -56
  93. package/src/parser/entities/solid/types.ts +0 -10
  94. package/src/parser/entities/spline/consts.ts +0 -8
  95. package/src/parser/entities/spline/index.ts +0 -3
  96. package/src/parser/entities/spline/parser.ts +0 -121
  97. package/src/parser/entities/spline/types.ts +0 -22
  98. package/src/parser/entities/text/consts.ts +0 -21
  99. package/src/parser/entities/text/index.ts +0 -3
  100. package/src/parser/entities/text/parser.ts +0 -117
  101. package/src/parser/entities/text/types.ts +0 -21
  102. package/src/parser/entities/vertex/consts.ts +0 -10
  103. package/src/parser/entities/vertex/index.ts +0 -3
  104. package/src/parser/entities/vertex/parser.ts +0 -90
  105. package/src/parser/entities/vertex/types.ts +0 -17
  106. package/src/parser/entities/viewport/index.ts +0 -178
  107. package/src/parser/entities/viewport/types.ts +0 -58
  108. package/src/parser/filterDummyBlocks.ts +0 -49
  109. package/src/parser/header/index.ts +0 -30
  110. package/src/parser/objects/common.ts +0 -55
  111. package/src/parser/objects/dictionary.ts +0 -61
  112. package/src/parser/objects/index.ts +0 -45
  113. package/src/parser/objects/layout.ts +0 -136
  114. package/src/parser/objects/plotSettings.ts +0 -231
  115. package/src/parser/objects/treefy.ts +0 -53
  116. package/src/parser/objects/types.ts +0 -17
  117. package/src/parser/shared/index.ts +0 -21
  118. package/src/parser/shared/parsePoint.ts +0 -37
  119. package/src/parser/shared/parserGenerator.test.ts +0 -164
  120. package/src/parser/shared/parserGenerator.ts +0 -180
  121. package/src/parser/shared/xdata/index.ts +0 -3
  122. package/src/parser/shared/xdata/interpreter.test.ts +0 -85
  123. package/src/parser/shared/xdata/interpreter.ts +0 -65
  124. package/src/parser/shared/xdata/parser.test.ts +0 -66
  125. package/src/parser/shared/xdata/parser.ts +0 -140
  126. package/src/parser/shared/xdata/types.ts +0 -22
  127. package/src/parser/tables/blockRecord/index.ts +0 -2
  128. package/src/parser/tables/blockRecord/parser.ts +0 -49
  129. package/src/parser/tables/blockRecord/types.ts +0 -11
  130. package/src/parser/tables/dimStyle/consts.ts +0 -428
  131. package/src/parser/tables/dimStyle/index.ts +0 -3
  132. package/src/parser/tables/dimStyle/parser.ts +0 -37
  133. package/src/parser/tables/dimStyle/types.ts +0 -164
  134. package/src/parser/tables/index.ts +0 -2
  135. package/src/parser/tables/layer/index.ts +0 -2
  136. package/src/parser/tables/layer/parser.ts +0 -58
  137. package/src/parser/tables/layer/types.ts +0 -14
  138. package/src/parser/tables/ltype/consts.ts +0 -6
  139. package/src/parser/tables/ltype/index.ts +0 -3
  140. package/src/parser/tables/ltype/parser.ts +0 -110
  141. package/src/parser/tables/ltype/types.ts +0 -23
  142. package/src/parser/tables/parser.ts +0 -100
  143. package/src/parser/tables/shared.ts +0 -32
  144. package/src/parser/tables/style/index.ts +0 -2
  145. package/src/parser/tables/style/parser.ts +0 -70
  146. package/src/parser/tables/style/types.ts +0 -15
  147. package/src/parser/tables/types.ts +0 -15
  148. package/src/parser/tables/vport/index.ts +0 -2
  149. package/src/parser/tables/vport/parser.ts +0 -205
  150. package/src/parser/tables/vport/types.ts +0 -48
  151. package/src/parser/types.ts +0 -30
  152. package/src/types/color.ts +0 -5
  153. package/src/types/dxfHeader.ts +0 -21
  154. package/src/types/entity.ts +0 -7
  155. package/src/types/index.ts +0 -30
  156. package/src/utils/binarySearch.ts +0 -20
  157. package/src/utils/disjointSet.ts +0 -52
  158. package/src/utils/flooding.ts +0 -37
  159. package/src/utils/functional.ts +0 -124
  160. package/src/utils/graph.ts +0 -53
  161. package/src/utils/index.ts +0 -102
  162. package/src/utils/queue.ts +0 -77
  163. package/src/utils/triangle.ts +0 -28
  164. package/tsconfig.json +0 -37
  165. package/webpack.config.js +0 -53
@@ -1,7 +0,0 @@
1
- import type { Matrix3 } from 'three';
2
-
3
- export interface CommonEntityDecomposeOption {
4
- layer?: string;
5
- color: number;
6
- extrusionTransform?: Matrix3;
7
- }
@@ -1,30 +0,0 @@
1
- export * from './color';
2
- export * from './dxfHeader';
3
- export * from './entity';
4
-
5
- export interface Point2D {
6
- x: number;
7
- y: number;
8
- }
9
-
10
- export interface Point3D {
11
- x: number;
12
- y: number;
13
- z: number;
14
- }
15
-
16
- export interface Bound {
17
- minX: number;
18
- minY: number;
19
- maxX: number;
20
- maxY: number;
21
- }
22
-
23
- export type MakeOptional<T, K extends keyof T> = Omit<T, K> &
24
- Partial<Pick<T, K>>;
25
-
26
- export type Indexed<T, P extends string> = {
27
- [key in P]: T;
28
- } & {
29
- index: number;
30
- };
@@ -1,20 +0,0 @@
1
- export function createMaxLessOrEqualFinder<T>(comp: (a: T, b: T) => number) {
2
- return (list: T[], target: T) => {
3
- let l = 0;
4
- let r = list.length - 1;
5
-
6
- while (l < r) {
7
- const m = Math.ceil((l + r) / 2);
8
-
9
- if (comp(list[m], target) > 0) {
10
- r = m - 1;
11
- } else {
12
- l = m;
13
- }
14
- }
15
-
16
- if (comp(list[r], target) > 0) return -1;
17
-
18
- return r;
19
- };
20
- }
@@ -1,52 +0,0 @@
1
- export function createDisjointSet(initialSize: number) {
2
- const roots = Array.from(new Array(initialSize), (_, index) => index);
3
- const sizes = roots.map(() => 1);
4
- let groups = initialSize;
5
-
6
- // return the id of the set which given index-th element exists.
7
- // but set id may changes if further union operations are done.
8
- function find(index: number): number {
9
- if (roots[index] === index) return index;
10
- return (roots[index] = find(roots[index]));
11
- }
12
-
13
- function union(ia: number, ib: number): void {
14
- let ra = find(ia);
15
- let rb = find(ib);
16
-
17
- if (ra === rb) return;
18
-
19
- if (sizes[ra] < sizes[rb]) {
20
- [ra, rb] = [rb, ra];
21
- }
22
-
23
- roots[rb] = ra;
24
- sizes[ra] += sizes[rb];
25
- groups -= 1;
26
- }
27
-
28
- // return the size of the set which has index-th element.
29
- // if index is not given, return the number of dijoint sets.
30
- function size(index?: number): number {
31
- if (index === undefined) return groups;
32
- return sizes[find(index)];
33
- }
34
-
35
- function getSets() {
36
- const map: Record<number, number[]> = {};
37
- for (let i = 0; i < roots.length; ++i) {
38
- const rootIndex = find(i);
39
-
40
- map[rootIndex] ??= [];
41
- map[rootIndex].push(i);
42
- }
43
- return map;
44
- }
45
-
46
- return {
47
- find,
48
- union,
49
- size,
50
- getSets,
51
- };
52
- }
@@ -1,37 +0,0 @@
1
- interface FloodingParams<T> {
2
- seeds: T[];
3
- spanner(seed: T): T[];
4
- serializer(seed: T): number | string;
5
- iterationLimit?: number;
6
- }
7
-
8
- export function flooding<T>({
9
- seeds,
10
- spanner,
11
- serializer,
12
- iterationLimit = Infinity,
13
- }: FloodingParams<T>) {
14
- const memo = new Set<string | number>();
15
- let iterations = 0;
16
-
17
- return seeds
18
- .map((seed) => {
19
- const group: T[] = [];
20
- const stack: [T, string | number][] = [[seed, serializer(seed)]];
21
-
22
- while (stack.length && iterations++ < iterationLimit) {
23
- const [current, key] = stack.pop()!;
24
-
25
- if (memo.has(key)) continue;
26
- memo.add(key);
27
- group.push(current);
28
-
29
- for (const next of spanner(current)) {
30
- stack.push([next, serializer(next)]);
31
- }
32
- }
33
-
34
- return group;
35
- })
36
- .filter((group) => group.length);
37
- }
@@ -1,124 +0,0 @@
1
- export function* adjacentPairs<T>(
2
- itr: Iterable<T>,
3
- n: number,
4
- isClosed?: boolean,
5
- ) {
6
- const first = new Array(n - 1) as T[];
7
- const buffer = new Array(n) as T[];
8
- let count = 0;
9
- for (const value of itr) {
10
- pull(buffer, value);
11
-
12
- if (++count >= n) {
13
- yield [...buffer];
14
- } else if (count < n) {
15
- first[count - 1] = value;
16
- }
17
- }
18
- if (count >= n && isClosed) {
19
- for (const value of first) {
20
- pull(buffer, value);
21
- yield [...buffer];
22
- }
23
- }
24
- }
25
-
26
- function pull<T>(values: T[], newValue: T) {
27
- for (let i = 0; i < values.length - 1; ++i) {
28
- values[i] = values[i + 1];
29
- }
30
- values[values.length - 1] = newValue;
31
- }
32
-
33
- export function argmin<T>(itr: Iterable<T>, evaluator: (value: T) => number) {
34
- let score = Infinity;
35
- let target: T = null as T;
36
- let index = -1;
37
- let count = 0;
38
-
39
- for (const value of itr) {
40
- const newScore = evaluator(value);
41
-
42
- if (score > newScore) {
43
- score = newScore;
44
- target = value;
45
- index = count;
46
- }
47
-
48
- ++count;
49
- }
50
-
51
- return { target, score, index };
52
- }
53
-
54
- export function* subIterator<T>(array: T[], start: number, end: number) {
55
- for (let i = start; i <= end; ++i) {
56
- yield array[i];
57
- }
58
- }
59
-
60
- export function* reverseIterator<T>(array: T[]) {
61
- for (let i = array.length - 1; i >= 0; --i) {
62
- yield array[i];
63
- }
64
- }
65
-
66
- export function separate<T>(
67
- predicate: (value: T) => boolean,
68
- itr: Iterable<T>,
69
- ) {
70
- const truthy: T[] = [];
71
- const falsy: T[] = [];
72
-
73
- for (const value of itr) {
74
- if (predicate(value)) {
75
- truthy.push(value);
76
- } else {
77
- falsy.push(value);
78
- }
79
- }
80
-
81
- return [truthy, falsy];
82
- }
83
-
84
- export function findLast<T>(
85
- predicate: (value: T) => boolean,
86
- isIncremental: boolean, // true일 경우, predicate가 실패하는 즉시 종료
87
- itr: Iterable<T>,
88
- ): [T | undefined, number] {
89
- let lastSatisfyingIndex = -1;
90
- let lastSatisfying: T | undefined = undefined;
91
- let index = 0;
92
-
93
- for (const value of itr) {
94
- if (predicate(value)) {
95
- lastSatisfyingIndex = index;
96
- lastSatisfying = value;
97
- } else if (isIncremental) {
98
- break;
99
- }
100
- index += 1;
101
- }
102
-
103
- return [lastSatisfying, lastSatisfyingIndex];
104
- }
105
-
106
- /**
107
- * size개씩 자른 것을 생성한다. 만약 마지막에 size개가 안되면 그냥 되는대로 준다.
108
- * @param size
109
- * @param iterable
110
- */
111
- export function* groupPairs<T>(size: number, iterable: Iterable<T>) {
112
- let pairs: T[] = [];
113
- for (const value of iterable) {
114
- pairs.push(value);
115
-
116
- if (pairs.length >= size) {
117
- yield pairs;
118
- pairs = [];
119
- }
120
- }
121
- if (pairs.length) {
122
- yield pairs;
123
- }
124
- }
@@ -1,53 +0,0 @@
1
- // index로 연결하는 복수 개의 간선을 갖는 것들
2
- export interface Edge<E> {
3
- index: number; // vertex
4
- values: E[];
5
- }
6
-
7
- /**
8
- * 정수로 표현하는 무향 비단순 그래프
9
- * 두 정점 사이에 간선이 여러 개 존재할 수 있음
10
- * 인접 리스트를 사용
11
- * 간선에 값을 할당할 수 있음
12
- */
13
- export class UndirectedMultiGraph<T> {
14
- vertices = new Set<number>();
15
- edges = [] as Edge<T>[][];
16
-
17
- addEdge(u: number, v: number, value: T) {
18
- this.vertices.add(u);
19
- this.vertices.add(v);
20
- this.connectDirected(u, v, value);
21
- this.connectDirected(v, u, value);
22
- }
23
-
24
- getDegree(v: number) {
25
- return this.edges[v].reduce(
26
- (acc, neighbor) => neighbor.values.length + acc,
27
- 0,
28
- );
29
- }
30
-
31
- getEdgeCount(u: number, v: number) {
32
- return (
33
- this.edges[u]?.find(({ index }) => index === v)?.values.length ?? 0
34
- );
35
- }
36
-
37
- *getNeighbors(u: number) {
38
- if (this.edges[u]?.length) {
39
- yield* this.edges[u][Symbol.iterator]();
40
- }
41
- }
42
-
43
- private connectDirected(u: number, v: number, value: T) {
44
- this.edges[u] ??= [];
45
-
46
- let neighbor = this.edges[u].find(({ index }) => index === v);
47
- if (!neighbor) {
48
- neighbor = { index: v, values: [] };
49
- this.edges[u].push(neighbor);
50
- }
51
- neighbor.values.push(value);
52
- }
53
- }
@@ -1,102 +0,0 @@
1
- export * from './binarySearch';
2
- export * from './disjointSet';
3
- export * from './graph';
4
- export * from './functional';
5
- export * from './flooding';
6
- export * from './triangle';
7
- export * from './queue';
8
-
9
- import { reduce } from '@fxts/core';
10
- import { Vector2, Vector3 } from 'three';
11
- import type { Bound, Point2D, Point3D } from '../types';
12
-
13
- export function pointToVector2(point: Point3D | Point2D): Vector2 {
14
- return new Vector2(point.x, point.y);
15
- }
16
-
17
- export function pointToVector3(point: Point3D | Point2D): Vector3 {
18
- return new Vector3(point.x, point.y, (point as Point3D).z ?? 0);
19
- }
20
-
21
- export function swapVector(v1: Vector2, v2: Vector2): void {
22
- let temp = v1.x;
23
- v1.x = v2.x;
24
- v2.x = temp;
25
- temp = v1.y;
26
- v1.y = v2.y;
27
- v2.y = temp;
28
- }
29
-
30
- export function classify<T>(
31
- iterable: Iterable<T>,
32
- keySelector: (value: T) => string | undefined,
33
- ) {
34
- const result: Record<string, T[]> = {};
35
- for (const value of iterable) {
36
- const key = keySelector(value);
37
-
38
- if (key != null) {
39
- result[key] ??= [];
40
- result[key].push(value);
41
- }
42
- }
43
- return result;
44
- }
45
-
46
- export function updateBounds(v: Point2D, bounds?: Bound) {
47
- bounds ??= { minX: v.x, maxX: v.x, minY: v.y, maxY: v.y };
48
- bounds.minX = Math.min(bounds.minX, v.x);
49
- bounds.maxX = Math.max(bounds.maxX, v.x);
50
- bounds.minY = Math.min(bounds.minY, v.y);
51
- bounds.maxY = Math.max(bounds.maxY, v.y);
52
- return bounds;
53
- }
54
-
55
- export function getBoundBox(vertices: Iterable<Point2D>) {
56
- return reduce(
57
- (bound, v) => updateBounds(v, bound),
58
- {
59
- minX: Infinity,
60
- maxX: -Infinity,
61
- minY: Infinity,
62
- maxY: -Infinity,
63
- },
64
- vertices,
65
- );
66
- }
67
-
68
- /**
69
- * 정수 생성기
70
- *
71
- * @param start Inclusive
72
- * @param end Exclusive
73
- * @param increment Default = 1
74
- */
75
- export function* generateIntegers(
76
- start: number,
77
- end: number = Infinity,
78
- increment: number = 1,
79
- ) {
80
- for (let n = start; n !== end; n += increment) {
81
- yield n;
82
- }
83
- }
84
-
85
- export function swap<T>(list: T[], i1: number, i2: number) {
86
- const temp = list[i1];
87
- list[i1] = list[i2];
88
- list[i2] = temp;
89
- }
90
-
91
- export function pushIfNotEqual(v: Vector2, vertices: Vector2[]) {
92
- if (!vertices.length) {
93
- vertices.push(v);
94
- return;
95
- }
96
-
97
- const u = vertices.at(-1)!;
98
-
99
- if (v.x !== u.x || v.y !== u.y) {
100
- vertices.push(v);
101
- }
102
- }
@@ -1,77 +0,0 @@
1
- export class Queue<T> implements Iterable<T> {
2
- private data: T[] = new Array(4);
3
- private head: number = 0;
4
- private tail: number = 0;
5
- private _size: number = 0;
6
-
7
- constructor(public readonly growthRate: number = 2) {}
8
-
9
- private grow(): void {
10
- const length = this.data.length;
11
- this.data = this.data
12
- .slice(this.head, length)
13
- .concat(this.data.slice(0, this.head))
14
- .concat(
15
- new Array(Math.max(1, Math.floor(length * this.growthRate))),
16
- );
17
- this.head = 0;
18
- this.tail = length;
19
- }
20
-
21
- public push(el: T): T {
22
- this.data[this.tail] = el;
23
- this.tail = (this.tail + 1) % this.data.length;
24
- if (this.tail === this.head) {
25
- this.grow();
26
- }
27
- this._size += 1;
28
- return el;
29
- }
30
-
31
- public pop(): T | undefined {
32
- if (this._size <= 0) return undefined;
33
- const result = this.data[this.head];
34
- this.head = (this.head + 1) % this.data.length;
35
- this._size -= 1;
36
- return result;
37
- }
38
-
39
- public front(): T | undefined {
40
- if (this._size <= 0) return undefined;
41
- return this.data[this.head];
42
- }
43
-
44
- public size(): number {
45
- return this._size;
46
- }
47
-
48
- public [Symbol.iterator](): IterableIterator<T> {
49
- const data = [...this.data];
50
- const tail = this.tail;
51
- let currentIndex = this.head;
52
-
53
- return {
54
- next(): IteratorResult<T> {
55
- if (currentIndex === tail)
56
- return { value: undefined, done: true };
57
- const oldIndex = currentIndex;
58
- currentIndex = (currentIndex + 1) % data.length;
59
- return {
60
- value: data[oldIndex],
61
- done: false,
62
- };
63
- },
64
- [Symbol.iterator]() {
65
- return this;
66
- },
67
- };
68
- }
69
-
70
- public isNotEmpty(): this is NonEmptyQueue<T> {
71
- return this._size > 0;
72
- }
73
- }
74
-
75
- interface NonEmptyQueue<T> extends Queue<T> {
76
- pop(): T;
77
- }
@@ -1,28 +0,0 @@
1
- import { Vector2 } from 'three';
2
-
3
- const ZeroVector = new Vector2();
4
-
5
- // 끝점을 position을 가리키도록 설정
6
- export function createTriangle(
7
- position: Vector2,
8
- angle: number,
9
- width: number,
10
- height: number,
11
- ): Vector2[] {
12
- return [
13
- position.clone(),
14
- position
15
- .clone()
16
- .add(
17
- new Vector2(-width, height / 2).rotateAround(ZeroVector, angle),
18
- ),
19
- position
20
- .clone()
21
- .add(
22
- new Vector2(-width, -height / 2).rotateAround(
23
- ZeroVector,
24
- angle,
25
- ),
26
- ),
27
- ];
28
- }
package/tsconfig.json DELETED
@@ -1,37 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "es2019", // 어떤 버전으로 컴파일
4
- "allowSyntheticDefaultImports": true, // default export가 없는 모듈에서 default imports를 허용
5
- "experimentalDecorators": true, // decorator 실험적 허용
6
- "emitDecoratorMetadata": true, // 데코레이터가 있는 선언에 대해 특정 타입의 메타 데이터를 내보내는 실험적인 지원
7
- "skipLibCheck": true, // 정의 파일 타입 체크 여부
8
- "moduleResolution": "node", // commonJS -> node 에서 동작
9
- "module": "commonjs", // import 문법
10
- "strict": true, // 타입 검사 엄격하게
11
- "pretty": true, // error 메시지 예쁘게
12
- "sourceMap": true, // 소스맵 파일 생성 -> .ts가 .js 파일로 트랜스 시 .js.map 생성
13
- "outDir": "./dist", // 트랜스 파일 (.js) 저장 경로
14
- "allowJs": true, // js 파일 ts에서 import 허용
15
- "esModuleInterop": true, // ES6 모듈 사양을 준수하여 CommonJS 모듈을 가져올 수 있게 허용
16
- "typeRoots": [
17
- "./src/types/express.d.ts", // 타입(*.d.ts)파일을 가져올 디렉토리 설정
18
- "./node_modules/@types" // 설정 안할시 기본적으로 ./node_modules/@types
19
- ],
20
- "baseUrl": "./src",
21
- "declaration": true,
22
- "declarationDir": "./dist",
23
- "emitDeclarationOnly": true,
24
- "plugins": [
25
- {
26
- "transform": "typia/lib/transform"
27
- }
28
- ]
29
- },
30
- "include": [
31
- "./src/**/*" // build 시 포함
32
- ],
33
- "exclude": [
34
- "node_modules", // build 시 제외
35
- "tests"
36
- ]
37
- }
package/webpack.config.js DELETED
@@ -1,53 +0,0 @@
1
- import path from "path";
2
-
3
- const __dirname = path.resolve();
4
-
5
- export default {
6
- mode: 'production',
7
- output: {
8
- path: `${__dirname}/dist`,
9
- filename: 'bundle.js',
10
- publicPath: '/',
11
- },
12
- entry: './src/index.ts',
13
- resolve: {
14
- alias: {
15
- '@src': path.resolve(__dirname, './src/'),
16
- },
17
- extensions: [
18
- '.webpack.js',
19
- '.web.js',
20
- '.ts',
21
- '.js',
22
- '.d.ts',
23
- '...',
24
- ],
25
- modules: ['src', 'node_modules'],
26
- },
27
- module: {
28
- rules: [
29
- {
30
- test: /\.(js|ts)?$/,
31
- exclude: /(node_modules|__tests__)/,
32
- use: {
33
- loader: 'swc-loader',
34
- options: {
35
- jsc: {
36
- parser: {
37
- syntax: "typescript"
38
- }
39
- }
40
- }
41
- },
42
- resolve: {
43
- fullySpecified: false,
44
- }
45
- },
46
- ],
47
- },
48
- performance: {
49
- hints: false,
50
- maxEntrypointSize: 512000,
51
- maxAssetSize: 512000
52
- }
53
- }