Skip to content

Commit

Permalink
Merge pull request #12 from Next2D/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
ienaga authored Nov 7, 2023
2 parents fa31d7b + 4a45a70 commit ed5f211
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![release](https://img.shields.io/github/v/release/Next2D/vite-auto-loader-plugin)](https://github.com/Next2D/vite-auto-loader-plugin/releases)
[![license](https://img.shields.io/github/license/Next2D/vite-auto-loader-plugin)](https://github.com/Next2D/vite-auto-loader-plugin/blob/main/LICENSE)

Next2D Framework vite TypeScript Auto Loader plugin.
Next2D Framework Auto Loader plugin for `vite`.

```sh
npm i -D @next2d/vite-auto-loader-plugin
Expand Down
21 changes: 10 additions & 11 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as fs from "fs";
import type { ConfigObjectImpl } from "./interface/ConfigObjectImpl";
import type { ObjectImpl } from "./interface/ObjectImpl";

const useTypeScript: boolean = fs.existsSync(`${process.cwd()}/src/index.ts`);
const ext: string = useTypeScript ? "ts" : "js";
Expand All @@ -12,17 +11,18 @@ const ext: string = useTypeScript ? "ts" : "js";
let cacheConfig: string = "";

/**
* @param {object} object
* @return {void}
* @method
* @private
*/
const buildConfig = (object: ObjectImpl): void =>
const buildConfig = (): void =>
{
const configDir: string = `${process.cwd()}/src/config`;
const configDir: string = `${process.cwd()}/src/config`;
const environment: string = process.env.NEXT2D_EBUILD_ENVIRONMENT || "local";
const platform: string = process.env.NEXT2D_TARGET_PLATFORM || "web";

const config: ConfigObjectImpl = {
"platform": object.platform,
"platform": platform,
"stage" : {},
"routing": {}
};
Expand All @@ -35,8 +35,8 @@ const buildConfig = (object: ObjectImpl): void =>
fs.readFileSync(configPath, { "encoding": "utf8" })
);

if (object.environment in configObject) {
Object.assign(config, configObject[object.environment]);
if (environment in configObject) {
Object.assign(config, configObject[environment]);
}

if (configObject.all) {
Expand Down Expand Up @@ -278,19 +278,18 @@ export { packages };`;
};

/**
* @param {object} object
* @return {object}
* @method
* @public
*/
export default function autoLoader (object: ObjectImpl): any
export default function autoLoader (): any
{
return {
"name": "vite-typescript-auto-loader-plugin",
"buildStart": {
"order": "pre",
handler() {
buildConfig(object);
buildConfig();
buildPackage();
}
},
Expand All @@ -305,7 +304,7 @@ export default function autoLoader (object: ObjectImpl): any

server.watcher.on("change", () =>
{
buildConfig(object);
buildConfig();
});
}
};
Expand Down
4 changes: 0 additions & 4 deletions src/interface/ObjectImpl.ts

This file was deleted.

0 comments on commit ed5f211

Please sign in to comment.