@next2d/vite-plugin-next2d-auto-loader 3.0.4 → 3.0.6

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.
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @description config ディレクトリのjsonファイルを読み込み、Config.[ts|js]を生成します。
3
+ * Reads JSON files from the config directory and generates Config.[ts|js].
4
+ *
5
+ * @return {void}
6
+ * @method
7
+ */
8
+ export declare const buildConfig: () => void;
@@ -0,0 +1,87 @@
1
+ import * as fs from "fs";
2
+ /**
3
+ * @type {boolean}
4
+ * @private
5
+ */
6
+ const useTypeScript = fs.existsSync(`${process.cwd()}/src/index.ts`);
7
+ /**
8
+ * @type {string}
9
+ * @private
10
+ */
11
+ const ext = useTypeScript ? "ts" : "js";
12
+ /**
13
+ * @type {string}
14
+ * @private
15
+ */
16
+ let $cacheConfig = "";
17
+ /**
18
+ * @description config ディレクトリのjsonファイルを読み込み、Config.[ts|js]を生成します。
19
+ * Reads JSON files from the config directory and generates Config.[ts|js].
20
+ *
21
+ * @return {void}
22
+ * @method
23
+ */
24
+ export const buildConfig = () => {
25
+ const configDir = `${process.cwd()}/src/config`;
26
+ const environment = process.env.NEXT2D_EBUILD_ENVIRONMENT || "local";
27
+ const platform = process.env.NEXT2D_TARGET_PLATFORM || "web";
28
+ const config = {
29
+ "platform": platform,
30
+ "stage": {},
31
+ "routing": {}
32
+ };
33
+ // load config.json
34
+ const configPath = `${configDir}/config.json`;
35
+ if (fs.existsSync(configPath)) {
36
+ const configObject = JSON.parse(fs.readFileSync(configPath, { "encoding": "utf8" }));
37
+ if (environment in configObject) {
38
+ Object.assign(config, configObject[environment]);
39
+ }
40
+ if (configObject.all) {
41
+ Object.assign(config, configObject.all);
42
+ }
43
+ }
44
+ // load stage.json
45
+ const stagePath = `${configDir}/stage.json`;
46
+ if (fs.existsSync(stagePath)) {
47
+ Object.assign(config.stage, JSON.parse(fs.readFileSync(stagePath, { "encoding": "utf8" })));
48
+ }
49
+ // load routing.json
50
+ const routingPath = `${configDir}/routing.json`;
51
+ if (fs.existsSync(routingPath)) {
52
+ Object.assign(config.routing, JSON.parse(fs.readFileSync(routingPath, { "encoding": "utf8" })));
53
+ }
54
+ const regexp = new RegExp(/{{(.*?)}}/, "g");
55
+ let configString = JSON.stringify(config, null, 4);
56
+ const values = configString.match(regexp);
57
+ if (values) {
58
+ for (let idx = 0; idx < values.length; ++idx) {
59
+ const value = values[idx];
60
+ const names = value
61
+ .replace(/\{|\{|\}|\}/g, "")
62
+ .replace(/\s+/g, "")
63
+ .split(".");
64
+ if (!names.length) {
65
+ continue;
66
+ }
67
+ let configValue = config;
68
+ for (let idx = 0; idx < names.length; ++idx) {
69
+ const name = names[idx];
70
+ if (name in configValue) {
71
+ configValue = configValue[name];
72
+ }
73
+ }
74
+ if (config === configValue) {
75
+ continue;
76
+ }
77
+ configString = configString.replace(value, configValue);
78
+ }
79
+ }
80
+ if ($cacheConfig !== configString) {
81
+ // cache update
82
+ $cacheConfig = configString;
83
+ const source = `const config = ${configString};
84
+ export { config };`;
85
+ fs.writeFileSync(`${configDir}/Config.${ext}`, source);
86
+ }
87
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @description view、 model ディレクトリ配下のファイルを読み込み、Package.[ts|js]を生成します。
3
+ * Reads files under the view and model directories and generates Package.[ts|js].
4
+ *
5
+ * @return {void}
6
+ * @method
7
+ */
8
+ export declare const buildPackage: () => void;
@@ -0,0 +1,139 @@
1
+ import fs from "fs";
2
+ /**
3
+ * @type {boolean}
4
+ * @private
5
+ */
6
+ const useTypeScript = fs.existsSync(`${process.cwd()}/src/index.ts`);
7
+ /**
8
+ * @type {string}
9
+ * @private
10
+ */
11
+ const ext = useTypeScript ? "ts" : "js";
12
+ /**
13
+ * @typem {string}
14
+ * @private
15
+ */
16
+ let $cachePackages = "";
17
+ /**
18
+ * @type {string}
19
+ * @private
20
+ */
21
+ const EOL = "\n";
22
+ /**
23
+ * @description 指定されたパスのファイルタイプを返却します。
24
+ * Returns the file type of the specified path.
25
+ *
26
+ * @param {string} path
27
+ * @return {string}
28
+ * @method
29
+ */
30
+ const getFileType = (path) => {
31
+ try {
32
+ const stat = fs.statSync(path);
33
+ switch (true) {
34
+ case stat.isFile():
35
+ return "file";
36
+ case stat.isDirectory():
37
+ return "directory";
38
+ default:
39
+ return "unknown";
40
+ }
41
+ }
42
+ catch (error) {
43
+ console.error(error);
44
+ return "unknown";
45
+ }
46
+ };
47
+ /**
48
+ * @description 指定されたディレクトリパス内のファイルパスリストを返却します。
49
+ * Returns a list of file paths in the specified directory path.
50
+ *
51
+ * @param {string} dir_path
52
+ * @return {string[]}
53
+ * @method
54
+ */
55
+ const getFilePathList = (dir_path) => {
56
+ const files = [];
57
+ const paths = fs.readdirSync(dir_path);
58
+ for (let idx = 0; idx < paths.length; ++idx) {
59
+ const path = `${dir_path}/${paths[idx]}`;
60
+ switch (getFileType(path)) {
61
+ case "file":
62
+ files.push(path);
63
+ break;
64
+ case "directory":
65
+ files.push(...getFilePathList(path));
66
+ break;
67
+ default:
68
+ break;
69
+ }
70
+ }
71
+ return files;
72
+ };
73
+ /**
74
+ * @description view、 model ディレクトリ配下のファイルを読み込み、Package.[ts|js]を生成します。
75
+ * Reads files under the view and model directories and generates Package.[ts|js].
76
+ *
77
+ * @return {void}
78
+ * @method
79
+ */
80
+ export const buildPackage = () => {
81
+ const dir = process.cwd();
82
+ const filePaths = getFilePathList(`${dir}/src`);
83
+ let imports = "";
84
+ let packages = `[${EOL}`;
85
+ for (let idx = 0; idx < filePaths.length; ++idx) {
86
+ const filePath = filePaths[idx];
87
+ // ts, js 以外はスキップ
88
+ if (filePath.indexOf(`.${ext}`) === -1) {
89
+ continue;
90
+ }
91
+ const js = fs.readFileSync(filePath, { "encoding": "utf-8" });
92
+ const lines = js.split("\n");
93
+ const path = filePath.replace(`${dir}/`, "");
94
+ for (let idx = 0; idx < lines.length; ++idx) {
95
+ const line = lines[idx];
96
+ // クラス定義以外はスキップ
97
+ if (line.indexOf("export class ") === -1) {
98
+ continue;
99
+ }
100
+ const name = line.split(" ")[2];
101
+ switch (true) {
102
+ case path.indexOf("src/view/") > -1:
103
+ imports += `import { ${name} } from "@/${path.split("src/")[1].split(`.${ext}`)[0]}";${EOL}`;
104
+ packages += ` ["${name}", ${name}],${EOL}`;
105
+ break;
106
+ case path.indexOf("src/model/") > -1:
107
+ {
108
+ const key = filePath
109
+ .split("src/model/")[1]
110
+ .split("/")
111
+ .join(".")
112
+ .slice(0, -3);
113
+ const asName = filePath
114
+ .split("src/model/")[1]
115
+ .split("/")
116
+ .join("_")
117
+ .slice(0, -3);
118
+ imports += `import { ${name} as ${asName} } from "@/${path.split("src/")[1].split(`.${ext}`)[0]}";${EOL}`;
119
+ packages += ` ["${key}", ${asName}],${EOL}`;
120
+ }
121
+ break;
122
+ default:
123
+ break;
124
+ }
125
+ break;
126
+ }
127
+ }
128
+ packages = packages.slice(0, -2);
129
+ packages += `${EOL}]`;
130
+ let source = `${imports}${EOL}`;
131
+ source += ext === "ts"
132
+ ? `const packages: Array<Array<string | Function>> = ${packages};${EOL}`
133
+ : `const packages = ${packages};${EOL}`;
134
+ source += "export { packages };";
135
+ if ($cachePackages !== source) {
136
+ $cachePackages = source;
137
+ fs.writeFileSync(`${dir}/src/Packages.${ext}`, source);
138
+ }
139
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import { buildConfig } from "./BuildConfig";
2
+ import { buildPackage } from "./BuildPackage";
3
+ buildConfig();
4
+ buildPackage();
package/dist/index.js CHANGED
@@ -1,224 +1,238 @@
1
- import * as fs from "fs";
2
- /**
3
- * @type {boolean}
4
- * @private
5
- */
6
- const useTypeScript = fs.existsSync(`${process.cwd()}/src/index.ts`);
7
- /**
8
- * @type {string}
9
- * @private
10
- */
11
- const ext = useTypeScript ? "ts" : "js";
12
- /**
13
- * @type {string}
14
- * @private
15
- */
16
- let $cacheConfig = "";
17
- /**
18
- * @typem {string}
19
- * @private
20
- */
21
- let $cachePackages = "";
22
- /**
23
- * @type {string}
24
- * @private
25
- */
26
- const EOL = "\n";
1
+ // import type { IConfigObject } from "./interface/IConfigObject";
2
+ // import * as fs from "fs";
3
+ // /**
4
+ // * @type {boolean}
5
+ // * @private
6
+ // */
7
+ // const useTypeScript: boolean = fs.existsSync(`${process.cwd()}/src/index.ts`);
8
+ // /**
9
+ // * @type {string}
10
+ // * @private
11
+ // */
12
+ // const ext: "ts" | "js" = useTypeScript ? "ts" : "js";
13
+ // /**
14
+ // * @type {string}
15
+ // * @private
16
+ // */
17
+ // let $cacheConfig: string = "";
18
+ // /**
19
+ // * @typem {string}
20
+ // * @private
21
+ // */
22
+ // let $cachePackages: string = "";
23
+ // /**
24
+ // * @type {string}
25
+ // * @private
26
+ // */
27
+ // const EOL: string = "\n";
28
+ // /**
29
+ // * @description 指定されたパスのファイルタイプを返却します。
30
+ // * Returns the file type of the specified path.
31
+ // *
32
+ // * @param {string} path
33
+ // * @return {string}
34
+ // * @method
35
+ // */
36
+ // const getFileType = (path: string): string =>
37
+ // {
38
+ // try {
39
+ // const stat = fs.statSync(path);
40
+ // switch (true) {
41
+ // case stat.isFile():
42
+ // return "file";
43
+ // case stat.isDirectory():
44
+ // return "directory";
45
+ // default:
46
+ // return "unknown";
47
+ // }
48
+ // } catch (error) {
49
+ // console.error(error);
50
+ // return "unknown";
51
+ // }
52
+ // };
53
+ // /**
54
+ // * @description 指定されたディレクトリパス内のファイルパスリストを返却します。
55
+ // * Returns a list of file paths in the specified directory path.
56
+ // *
57
+ // * @param {string} dir_path
58
+ // * @return {string[]}
59
+ // * @method
60
+ // */
61
+ // const getFilePathList = (dir_path: string): string[] =>
62
+ // {
63
+ // const files: string[] = [];
64
+ // const paths: string[] = fs.readdirSync(dir_path);
65
+ // for (let idx = 0; idx < paths.length; ++idx) {
66
+ // const path = `${dir_path}/${paths[idx]}`;
67
+ // switch (getFileType(path)) {
68
+ // case "file":
69
+ // files.push(path);
70
+ // break;
71
+ // case "directory":
72
+ // files.push(...getFilePathList(path));
73
+ // break;
74
+ // default:
75
+ // break;
76
+ // }
77
+ // }
78
+ // return files;
79
+ // };
80
+ // /**
81
+ // * @description config ディレクトリのjsonファイルを読み込み、Config.[ts|js]を生成します。
82
+ // * Reads JSON files from the config directory and generates Config.[ts|js].
83
+ // *
84
+ // * @return {void}
85
+ // * @method
86
+ // */
87
+ // const buildConfig = (): void =>
88
+ // {
89
+ // const configDir = `${process.cwd()}/src/config`;
90
+ // const environment = process.env.NEXT2D_EBUILD_ENVIRONMENT || "local";
91
+ // const platform = process.env.NEXT2D_TARGET_PLATFORM || "web";
92
+ // const config: IConfigObject = {
93
+ // "platform": platform,
94
+ // "stage" : {},
95
+ // "routing": {}
96
+ // };
97
+ // // load config.json
98
+ // const configPath = `${configDir}/config.json`;
99
+ // if (fs.existsSync(configPath)) {
100
+ // const configObject: any = JSON.parse(
101
+ // fs.readFileSync(configPath, { "encoding": "utf8" })
102
+ // );
103
+ // if (environment in configObject) {
104
+ // Object.assign(config, configObject[environment]);
105
+ // }
106
+ // if (configObject.all) {
107
+ // Object.assign(config, configObject.all);
108
+ // }
109
+ // }
110
+ // // load stage.json
111
+ // const stagePath = `${configDir}/stage.json`;
112
+ // if (fs.existsSync(stagePath)) {
113
+ // Object.assign(
114
+ // config.stage,
115
+ // JSON.parse(fs.readFileSync(stagePath, { "encoding": "utf8" }))
116
+ // );
117
+ // }
118
+ // // load routing.json
119
+ // const routingPath = `${configDir}/routing.json`;
120
+ // if (fs.existsSync(routingPath)) {
121
+ // Object.assign(
122
+ // config.routing,
123
+ // JSON.parse(fs.readFileSync(routingPath, { "encoding": "utf8" }))
124
+ // );
125
+ // }
126
+ // const regexp: RegExp = new RegExp(/{{(.*?)}}/, "g");
127
+ // let configString = JSON.stringify(config, null, 4);
128
+ // const values: RegExpMatchArray | null = configString.match(regexp);
129
+ // if (values) {
130
+ // for (let idx = 0; idx < values.length; ++idx) {
131
+ // const value = values[idx];
132
+ // const names = value
133
+ // .replace(/\{|\{|\}|\}/g, "")
134
+ // .replace(/\s+/g, "")
135
+ // .split(".");
136
+ // if (!names.length) {
137
+ // continue;
138
+ // }
139
+ // let configValue: any = config;
140
+ // for (let idx = 0; idx < names.length; ++idx) {
141
+ // const name = names[idx];
142
+ // if (name in configValue) {
143
+ // configValue = configValue[name];
144
+ // }
145
+ // }
146
+ // if (config === configValue) {
147
+ // continue;
148
+ // }
149
+ // configString = configString.replace(value, configValue);
150
+ // }
151
+ // }
152
+ // if ($cacheConfig !== configString) {
153
+ // // cache update
154
+ // $cacheConfig = configString;
155
+ // const source = `const config = ${configString};
156
+ // export { config };`;
157
+ // fs.writeFileSync(`${configDir}/Config.${ext}`, source);
158
+ // }
159
+ // };
160
+ // /**
161
+ // * @description view、 model ディレクトリ配下のファイルを読み込み、Package.[ts|js]を生成します。
162
+ // * Reads files under the view and model directories and generates Package.[ts|js].
163
+ // *
164
+ // * @return {void}
165
+ // * @method
166
+ // */
167
+ // const buildPackage = (): void =>
168
+ // {
169
+ // const dir = process.cwd();
170
+ // const filePaths = getFilePathList(`${dir}/src`);
171
+ // let imports = "";
172
+ // let packages = `[${EOL}`;
173
+ // for (let idx = 0; idx < filePaths.length; ++idx) {
174
+ // const filePath = filePaths[idx];
175
+ // // ts, js 以外はスキップ
176
+ // if (filePath.indexOf(`.${ext}`) === -1) {
177
+ // continue;
178
+ // }
179
+ // const js = fs.readFileSync(filePath, { "encoding": "utf-8" });
180
+ // const lines = js.split("\n");
181
+ // const path = filePath.replace(`${dir}/`, "");
182
+ // for (let idx = 0; idx < lines.length; ++idx) {
183
+ // const line = lines[idx];
184
+ // // クラス定義以外はスキップ
185
+ // if (line.indexOf("export class ") === -1) {
186
+ // continue;
187
+ // }
188
+ // const name = line.split(" ")[2];
189
+ // switch (true) {
190
+ // case path.indexOf("src/view/") > -1:
191
+ // imports += `import { ${name} } from "@/${path.split("src/")[1].split(`.${ext}`)[0]}";${EOL}`;
192
+ // packages += ` ["${name}", ${name}],${EOL}`;
193
+ // break;
194
+ // case path.indexOf("src/model/") > -1:
195
+ // {
196
+ // const key = filePath
197
+ // .split("src/model/")[1]
198
+ // .split("/")
199
+ // .join(".")
200
+ // .slice(0, -3);
201
+ // const asName = filePath
202
+ // .split("src/model/")[1]
203
+ // .split("/")
204
+ // .join("_")
205
+ // .slice(0, -3);
206
+ // imports += `import { ${name} as ${asName} } from "@/${path.split("src/")[1].split(`.${ext}`)[0]}";${EOL}`;
207
+ // packages += ` ["${key}", ${asName}],${EOL}`;
208
+ // }
209
+ // break;
210
+ // default:
211
+ // break;
212
+ // }
213
+ // break;
214
+ // }
215
+ // }
216
+ // packages = packages.slice(0, -2);
217
+ // packages += `${EOL}]`;
218
+ // let source = `${imports}${EOL}`;
219
+ // source += ext === "ts"
220
+ // ? `const packages: Array<Array<string | Function>> = ${packages};${EOL}`
221
+ // : `const packages = ${packages};${EOL}`;
222
+ // source += "export { packages };";
223
+ // if ($cachePackages !== source) {
224
+ // $cachePackages = source;
225
+ // fs.writeFileSync(`${dir}/src/Packages.${ext}`, source);
226
+ // }
227
+ // };
228
+ import { buildConfig } from "./BuildConfig";
229
+ import { buildPackage } from "./BuildPackage";
27
230
  /**
28
231
  * @return {object}
29
232
  * @method
30
233
  * @public
31
234
  */
32
235
  export default function autoLoader() {
33
- /**
34
- * @description 指定されたパスのファイルタイプを返却します。
35
- * Returns the file type of the specified path.
36
- *
37
- * @param {string} path
38
- * @return {string}
39
- * @method
40
- */
41
- const getFileType = (path) => {
42
- try {
43
- const stat = fs.statSync(path);
44
- switch (true) {
45
- case stat.isFile():
46
- return "file";
47
- case stat.isDirectory():
48
- return "directory";
49
- default:
50
- return "unknown";
51
- }
52
- }
53
- catch (error) {
54
- console.error(error);
55
- return "unknown";
56
- }
57
- };
58
- /**
59
- * @description 指定されたディレクトリパス内のファイルパスリストを返却します。
60
- * Returns a list of file paths in the specified directory path.
61
- *
62
- * @param {string} dir_path
63
- * @return {string[]}
64
- * @method
65
- */
66
- const getFilePathList = (dir_path) => {
67
- const files = [];
68
- const paths = fs.readdirSync(dir_path);
69
- for (let idx = 0; idx < paths.length; ++idx) {
70
- const path = `${dir_path}/${paths[idx]}`;
71
- switch (getFileType(path)) {
72
- case "file":
73
- files.push(path);
74
- break;
75
- case "directory":
76
- files.push(...getFilePathList(path));
77
- break;
78
- default:
79
- break;
80
- }
81
- }
82
- return files;
83
- };
84
- /**
85
- * @description config ディレクトリのjsonファイルを読み込み、Config.[ts|js]を生成します。
86
- * Reads JSON files from the config directory and generates Config.[ts|js].
87
- *
88
- * @return {void}
89
- * @method
90
- */
91
- const buildConfig = () => {
92
- const configDir = `${process.cwd()}/src/config`;
93
- const environment = process.env.NEXT2D_EBUILD_ENVIRONMENT || "local";
94
- const platform = process.env.NEXT2D_TARGET_PLATFORM || "web";
95
- const config = {
96
- "platform": platform,
97
- "stage": {},
98
- "routing": {}
99
- };
100
- // load config.json
101
- const configPath = `${configDir}/config.json`;
102
- if (fs.existsSync(configPath)) {
103
- const configObject = JSON.parse(fs.readFileSync(configPath, { "encoding": "utf8" }));
104
- if (environment in configObject) {
105
- Object.assign(config, configObject[environment]);
106
- }
107
- if (configObject.all) {
108
- Object.assign(config, configObject.all);
109
- }
110
- }
111
- // load stage.json
112
- const stagePath = `${configDir}/stage.json`;
113
- if (fs.existsSync(stagePath)) {
114
- Object.assign(config.stage, JSON.parse(fs.readFileSync(stagePath, { "encoding": "utf8" })));
115
- }
116
- // load routing.json
117
- const routingPath = `${configDir}/routing.json`;
118
- if (fs.existsSync(routingPath)) {
119
- Object.assign(config.routing, JSON.parse(fs.readFileSync(routingPath, { "encoding": "utf8" })));
120
- }
121
- const regexp = new RegExp(/{{(.*?)}}/, "g");
122
- let configString = JSON.stringify(config, null, 4);
123
- const values = configString.match(regexp);
124
- if (values) {
125
- for (let idx = 0; idx < values.length; ++idx) {
126
- const value = values[idx];
127
- const names = value
128
- .replace(/\{|\{|\}|\}/g, "")
129
- .replace(/\s+/g, "")
130
- .split(".");
131
- if (!names.length) {
132
- continue;
133
- }
134
- let configValue = config;
135
- for (let idx = 0; idx < names.length; ++idx) {
136
- const name = names[idx];
137
- if (name in configValue) {
138
- configValue = configValue[name];
139
- }
140
- }
141
- if (config === configValue) {
142
- continue;
143
- }
144
- configString = configString.replace(value, configValue);
145
- }
146
- }
147
- if ($cacheConfig !== configString) {
148
- // cache update
149
- $cacheConfig = configString;
150
- const source = `const config = ${configString};
151
- export { config };`;
152
- fs.writeFileSync(`${configDir}/Config.${ext}`, source);
153
- }
154
- };
155
- /**
156
- * @description view、 model ディレクトリ配下のファイルを読み込み、Package.[ts|js]を生成します。
157
- * Reads files under the view and model directories and generates Package.[ts|js].
158
- *
159
- * @return {void}
160
- * @method
161
- */
162
- const buildPackage = () => {
163
- const dir = process.cwd();
164
- const filePaths = getFilePathList(`${dir}/src`);
165
- let imports = "";
166
- let packages = `[${EOL}`;
167
- for (let idx = 0; idx < filePaths.length; ++idx) {
168
- const filePath = filePaths[idx];
169
- // ts, js 以外はスキップ
170
- if (filePath.indexOf(`.${ext}`) === -1) {
171
- continue;
172
- }
173
- const js = fs.readFileSync(filePath, { "encoding": "utf-8" });
174
- const lines = js.split("\n");
175
- const path = filePath.replace(`${dir}/`, "");
176
- for (let idx = 0; idx < lines.length; ++idx) {
177
- const line = lines[idx];
178
- // クラス定義以外はスキップ
179
- if (line.indexOf("export class ") === -1) {
180
- continue;
181
- }
182
- const name = line.split(" ")[2];
183
- switch (true) {
184
- case path.indexOf("src/view/") > -1:
185
- imports += `import { ${name} } from "@/${path.split("src/")[1].split(`.${ext}`)[0]}";${EOL}`;
186
- packages += ` ["${name}", ${name}],${EOL}`;
187
- break;
188
- case path.indexOf("src/model/") > -1:
189
- {
190
- const key = filePath
191
- .split("src/model/")[1]
192
- .split("/")
193
- .join(".")
194
- .slice(0, -3);
195
- const asName = filePath
196
- .split("src/model/")[1]
197
- .split("/")
198
- .join("_")
199
- .slice(0, -3);
200
- imports += `import { ${name} as ${asName} } from "@/${path.split("src/")[1].split(`.${ext}`)[0]}";${EOL}`;
201
- packages += ` ["${key}", ${asName}],${EOL}`;
202
- }
203
- break;
204
- default:
205
- break;
206
- }
207
- break;
208
- }
209
- }
210
- packages = packages.slice(0, -2);
211
- packages += `${EOL}]`;
212
- let source = `${imports}${EOL}`;
213
- source += ext === "ts"
214
- ? `const packages: Array<Array<string | Function>> = ${packages};${EOL}`
215
- : `const packages = ${packages};${EOL}`;
216
- source += "export { packages };";
217
- if ($cachePackages !== source) {
218
- $cachePackages = source;
219
- fs.writeFileSync(`${dir}/src/Packages.${ext}`, source);
220
- }
221
- };
222
236
  return {
223
237
  "name": "vite-plugin-next2d-auto-loader",
224
238
  "buildStart": {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@next2d/vite-plugin-next2d-auto-loader",
3
3
  "description": "Next2D Framework vite TypeScript Auto Loader plugin.",
4
- "version": "3.0.4",
4
+ "version": "3.0.6",
5
5
  "homepage": "https://next2d.app",
6
6
  "bugs": "https://github.com/Next2D/vite-plugin-next2d-auto-loader/issues",
7
7
  "author": "Toshiyuki Ienaga<ienaga@next2d.app>",
@@ -24,7 +24,7 @@
24
24
  "release": "tsc"
25
25
  },
26
26
  "bin": {
27
- "@next2d/vite-plugin-next2d-auto-loader": "dist/index.js"
27
+ "@next2d/vite-plugin-next2d-auto-loader": "dist/execute.js"
28
28
  },
29
29
  "repository": {
30
30
  "type": "git",