diff --git a/packages/commandkit/bin/index.cjs b/packages/commandkit/bin/index.cjs index ff47fee..c3aa932 100644 --- a/packages/commandkit/bin/index.cjs +++ b/packages/commandkit/bin/index.cjs @@ -1,3 +1,4 @@ #!/usr/bin/env node -require('source-map-support').install(); + +// require('source-map-support').install(); import('commandkit/cli'); diff --git a/packages/commandkit/package.json b/packages/commandkit/package.json index 94eb876..124f203 100644 --- a/packages/commandkit/package.json +++ b/packages/commandkit/package.json @@ -46,6 +46,7 @@ "event handler" ], "dependencies": { + "chokidar": "^3.5.3", "dotenv-cra": "^3.0.3", "ora": "^8.0.1", "rfdc": "^1.3.1", diff --git a/packages/commandkit/src/bootstrap/client.ts b/packages/commandkit/src/bootstrap/client.ts index 444e9ac..3da364a 100644 --- a/packages/commandkit/src/bootstrap/client.ts +++ b/packages/commandkit/src/bootstrap/client.ts @@ -1,7 +1,32 @@ import { Client } from 'discord.js'; -import { getConfig } from '../config'; +import { watch } from 'chokidar'; +import { CommandKitConfig, getConfig } from '../config'; +import { CommandKit, Environment } from '..'; +import { notification } from '../environment/actions/development'; +import { CKitActionType, CKitNotification } from '../environment/actions/common'; +import { join } from 'path'; -let discord_client: Client; +let discord_client: Client, commandkit: CommandKit; + +export const DisposableCallbacksRegistry = new Set(); + +type DisposableCallback = () => Awaited; + +/** + * Registers a callback that will be executed when the the process is about restart. This is useful for cleaning up resources. + * This will only be executed in development mode. + */ +export function disposable(callback: DisposableCallback) { + const cb = async () => { + try { + await callback(); + } finally { + DisposableCallbacksRegistry.delete(cb); + } + }; + + DisposableCallbacksRegistry.add(cb); +} /** * @internal @@ -10,6 +35,22 @@ export function getClient() { return discord_client; } +/** + * @internal + */ +export function getCommandKit() { + return commandkit; +} + +export function registerClient(client: Client) { + if (discord_client) return; + if (Environment.isDevelopment()) { + throw new Error('Cannot register client in development mode.'); + } + + discord_client = client; +} + /** * Fetches the client instance. If the client instance is not initialized, an error will be thrown. */ @@ -30,3 +71,79 @@ export function createClient() { return discord_client; } + +export function setupCommandKit(client: Client) { + const config = getConfig(); + + const getPath = (to: string) => join(process.cwd(), '.commandkit', to); + + commandkit = new CommandKit({ + ...config.commandHandler, + commandsPath: getPath('commands'), + eventsPath: getPath('events'), + validationsPath: getPath('validations'), + client, + }); + + registerWatcher(commandkit, config); + + return commandkit; +} + +function registerWatcher(commandkit: CommandKit, config: CommandKitConfig) { + if (!config.watch) return; + + // handles changes made to commands + _initCommandsWatcher(commandkit); + // handles changes made to events + _initEventsWatcher(commandkit); + // handles changes made to validations + _initValidationsWatcher(commandkit); +} + +const _ignorable = (str: string) => /^_/.test(str) || /\.(map|d\.ts)$/.test(str); + +function _initEventsWatcher(commandkit: CommandKit) { + if (!commandkit.eventsPath) return; + + const watcher = watch(commandkit.eventsPath, { + ignoreInitial: true, + ignored: (testString) => _ignorable(testString), + }); + + watcher.on('all', async (event) => { + if (event === 'change') { + notification.emit(CKitNotification.Reload, CKitActionType.ReloadEvents); + } + }); +} + +function _initValidationsWatcher(commandkit: CommandKit) { + if (!commandkit.validationsPath) return; + + const watcher = watch(commandkit.validationsPath, { + ignoreInitial: true, + ignored: (testString) => _ignorable(testString), + }); + + watcher.on('all', async (event) => { + if (event === 'change') { + notification.emit(CKitNotification.Reload, CKitActionType.ReloadValidators); + } + }); +} + +function _initCommandsWatcher(commandkit: CommandKit) { + if (!commandkit.commandsPath) return; + + const watcher = watch(commandkit.commandsPath, { + ignoreInitial: true, + ignored: (testString) => _ignorable(testString), + }); + + watcher.on('all', async (event) => { + if (event === 'change') { + notification.emit(CKitNotification.Reload, CKitActionType.ReloadCommands); + } + }); +} diff --git a/packages/commandkit/src/bootstrap/loadEnv.ts b/packages/commandkit/src/bootstrap/loadEnv.ts index 6c3c452..36c2e40 100644 --- a/packages/commandkit/src/bootstrap/loadEnv.ts +++ b/packages/commandkit/src/bootstrap/loadEnv.ts @@ -1,6 +1,9 @@ import { config } from 'dotenv-cra'; +import { Environment } from '../environment/env'; + +export function loadEnv() { + const type = Environment.getType(); -export function loadEnv(type: 'development' | 'production') { process.env.NODE_ENV = type; const result = config(); diff --git a/packages/commandkit/src/config.ts b/packages/commandkit/src/config.ts index 127ce9d..2af1517 100644 --- a/packages/commandkit/src/config.ts +++ b/packages/commandkit/src/config.ts @@ -1,10 +1,18 @@ import type { ClientOptions } from 'discord.js'; +import { CommandKitOptions } from './typings'; export interface CommandKitConfig { /** * The Discord client options. */ clientOptions: ClientOptions; + /** + * The command handler options. + */ + commandHandler?: Omit< + CommandKitOptions, + 'client' | 'commandsPath' | 'validationsPath' | 'eventsPath' + >; /** * The Discord bot token. Defaults to `process.env.DISCORD_TOKEN`. */ @@ -57,7 +65,7 @@ let globalConfig: Partial = { nodeOptions: [], antiCrash: true, requirePolyfill: true, - token: process.env.DISCORD_TOKEN, + token: undefined, }; export function getConfig(): CommandKitConfig { diff --git a/packages/commandkit/src/environment/actions/common.ts b/packages/commandkit/src/environment/actions/common.ts new file mode 100644 index 0000000..061aadd --- /dev/null +++ b/packages/commandkit/src/environment/actions/common.ts @@ -0,0 +1,11 @@ +export enum CKitActionType { + ReloadAll, + ReloadCommands, + ReloadEvents, + ReloadValidators, +} + +export enum CKitNotification { + Reload = 'reload', + ReloadAck = 'reload-ack', +} diff --git a/packages/commandkit/src/environment/actions/development.ts b/packages/commandkit/src/environment/actions/development.ts index 024dbff..60b0348 100644 --- a/packages/commandkit/src/environment/actions/development.ts +++ b/packages/commandkit/src/environment/actions/development.ts @@ -3,11 +3,22 @@ import { findConfigPath, importConfig } from '../common/config'; import colors from '../../utils/colors'; import { Logger } from '../common/logger'; import { loadEnv } from '../../bootstrap/loadEnv'; -import { createClient, getClient } from '../../bootstrap/client'; +import { + DisposableCallbacksRegistry, + createClient, + getClient, + getCommandKit, + setupCommandKit, +} from '../../bootstrap/client'; import { bundle } from '../bundler/bundle'; +import { EventEmitter } from 'node:events'; +import { CKitActionType, CKitNotification } from './common'; +import { CKitInternalEnvState } from '../env'; const commandkitVersion = '[VI]{{inject}}[/VI]'; +export const notification = new EventEmitter(); + function printBanner() { const banner = colors.magenta(`${String.fromCharCode(9670)} CommandKit ${commandkitVersion}`); Logger.Log(banner); @@ -27,7 +38,9 @@ export async function initializeDevelopmentEnvironment( return; } - const envErr = loadEnv('development'); + CKitInternalEnvState.$env__type = 'development'; + + const envErr = loadEnv(); if (envErr) { Logger.Warning('Failed to load .env', envErr); @@ -40,8 +53,7 @@ export async function initializeDevelopmentEnvironment( const msg = `Could not locate the commandkit config file${ args.config ? ' at ' + args.config : ' in the current working directory' }.`; - Logger.Fatal(msg); - return; + return Logger.Fatal(msg); } try { @@ -54,15 +66,51 @@ export async function initializeDevelopmentEnvironment( } const client = createClient(); + setupCommandKit(client); - // build the project - const entrypoint = await bundle('development'); + notification.once(CKitNotification.ReloadAck, async () => { + await client.login(config.token); + }); try { - // load the client entrypoint - await import(`file://${entrypoint}`); - await client.login(config.token); + notification.emit(CKitNotification.Reload, CKitActionType.ReloadAll); } catch (e) { Logger.Fatal('Failed to load the client entrypoint', e); } } + +const ensureCommandKit = () => { + const commandkit = getCommandKit(); + + if (!commandkit) { + return Logger.Fatal('CommandKit is not initialized.'); + } + + return commandkit; +}; + +notification.on(CKitNotification.Reload, async (action: CKitActionType) => { + const entrypoint = await bundle(); + + try { + switch (action) { + case CKitActionType.ReloadAll: + // dispose before reloading to clean up any resources + await Promise.all([...DisposableCallbacksRegistry.values()].map((cb) => cb())); + await import(`file://${entrypoint}?t=${Date.now()}`); + notification.emit(CKitNotification.ReloadAck); + break; + case CKitActionType.ReloadCommands: + await ensureCommandKit().reloadCommands(); + break; + case CKitActionType.ReloadEvents: + await ensureCommandKit().reloadEvents(); + break; + case CKitActionType.ReloadValidators: + await ensureCommandKit().reloadValidations(); + break; + } + } catch (e) { + Logger.Fatal('Failed to load the client entrypoint', e); + } +}); diff --git a/packages/commandkit/src/environment/bundler/bundle.ts b/packages/commandkit/src/environment/bundler/bundle.ts index 2116e02..dee9ee0 100644 --- a/packages/commandkit/src/environment/bundler/bundle.ts +++ b/packages/commandkit/src/environment/bundler/bundle.ts @@ -1,10 +1,12 @@ import { build } from 'tsup'; import { getConfig } from '../../config'; import { join } from 'path'; +import { injectShims } from './shims'; +import { Environment } from '../env'; -export function bundle(mode: 'development' | 'production') { - switch (mode) { - case 'development': +export function bundle() { + switch (true) { + case Environment.isDevelopment(): return buildDevelopment(); default: throw new Error('Not implemented'); @@ -12,28 +14,27 @@ export function bundle(mode: 'development' | 'production') { } function buildDevelopment() { - const { watch } = getConfig(); + return new Promise((resolve) => { + const { requirePolyfill } = getConfig(); - const outDir = join(process.cwd(), '.commandkit'); - - return build({ - clean: true, - format: ['esm'], - bundle: false, - dts: false, - skipNodeModulesBundle: true, - minify: false, - shims: true, - sourcemap: 'inline', - keepNames: true, - outDir: '.commandkit', - silent: true, - entry: ['src'], - watch, - async onSuccess() { - // return await injectShims('.commandkit', main, false, requirePolyfill); - }, - }).then(() => { - return join(outDir, 'client.mjs'); + return build({ + clean: true, + format: ['esm'], + bundle: false, + dts: false, + skipNodeModulesBundle: true, + minify: false, + shims: true, + sourcemap: 'inline', + keepNames: true, + outDir: '.commandkit', + silent: true, + entry: ['src'], + async onSuccess() { + const root = join(process.cwd(), '.commandkit'); + await injectShims(root, 'client.mjs', false, requirePolyfill); + resolve(join(root, 'client.mjs')); + }, + }); }); } diff --git a/packages/commandkit/src/environment/bundler/codegen.ts b/packages/commandkit/src/environment/bundler/codegen.ts new file mode 100644 index 0000000..ba1b4d0 --- /dev/null +++ b/packages/commandkit/src/environment/bundler/codegen.ts @@ -0,0 +1,45 @@ +import { type ClientOptions, IntentsBitField } from 'discord.js'; +import { getConfig } from '../../config'; + +function stripIndents(strings: TemplateStringsArray, ...values: any[]) { + const raw = strings.raw; + let result = ''; + + for (let i = 0; i < raw.length; i++) { + result += strings[i].replace(/\\`/g, '`') + (values[i] ?? ''); + } + + return result; +} + +function maybeEncrypt(token?: string) { + if (!token) return ''; + + // make the token less obvious + const value = JSON.stringify([...token].map((c) => c.charCodeAt(0))); + + // this should only occur if token is specified in the config file, otherwise it will directly lookup `process.env.DISCORD_TOKEN` + return `process.env.DISCORD_TOKEN ??= String.fromCharCode(...${value})`; +} + +// TODO: make this work +export function generateClientScript() { + const { clientOptions, token } = getConfig(); + + const config: ClientOptions = { + ...clientOptions, + intents: IntentsBitField.resolve(clientOptions.intents), + }; + + const src = stripIndents`// Auto-generated by CommandKit. Do not modify. + import { Client } from 'discord.js'; + import { registerClient } from 'commandkit'; + + ${maybeEncrypt(token)} + + const client = new Client(${JSON.stringify(config)}); + + await registerClient(client); + await client.login(); + `; +} diff --git a/packages/commandkit/src/environment/bundler/shims.ts b/packages/commandkit/src/environment/bundler/shims.ts index 363165d..c269707 100644 --- a/packages/commandkit/src/environment/bundler/shims.ts +++ b/packages/commandkit/src/environment/bundler/shims.ts @@ -1,5 +1,5 @@ import { readFile, writeFile } from 'node:fs/promises'; -import { join } from 'node:path'; +import { isAbsolute, join } from 'node:path'; export async function injectShims( outDir: string, @@ -7,7 +7,7 @@ export async function injectShims( antiCrash: boolean, polyfillRequire: boolean, ) { - const path = join(process.cwd(), outDir, main); + const path = isAbsolute(outDir) ? join(outDir, main) : join(process.cwd(), outDir, main); const head = ['\n\n;await (async()=>{', " 'use strict';"].join('\n'); const tail = '\n})();'; diff --git a/packages/commandkit/src/environment/env.ts b/packages/commandkit/src/environment/env.ts new file mode 100644 index 0000000..ed4eb1d --- /dev/null +++ b/packages/commandkit/src/environment/env.ts @@ -0,0 +1,23 @@ +export const CKitInternalEnvState = { + $env__type: 'unknown', +}; + +export const Environment = Object.preventExtensions({ + isDevelopment() { + return CKitInternalEnvState.$env__type === 'development'; + }, + isProduction() { + return CKitInternalEnvState.$env__type === 'production'; + }, + isUnknown() { + const { $env__type } = CKitInternalEnvState; + return $env__type !== 'development' && $env__type !== 'production'; + }, + getType() { + if (Environment.isUnknown()) { + return 'development'; + } + + return CKitInternalEnvState.$env__type; + }, +} as const); diff --git a/packages/commandkit/src/index.ts b/packages/commandkit/src/index.ts index 0e95629..688a5eb 100644 --- a/packages/commandkit/src/index.ts +++ b/packages/commandkit/src/index.ts @@ -3,7 +3,8 @@ export * from './components'; export * from './config'; export * from './utils/signal'; export * from './hooks'; -export { client } from './bootstrap/client'; +export { Environment } from './environment/env'; +export { client, disposable, registerClient } from './bootstrap/client'; export type * from './types'; /** diff --git a/packages/commandkit/tests/src/client.ts b/packages/commandkit/tests/src/client.ts index 2c60bf7..f2f0d5a 100644 --- a/packages/commandkit/tests/src/client.ts +++ b/packages/commandkit/tests/src/client.ts @@ -1,11 +1 @@ -import { client, CommandKit } from '../../dist/index.mjs'; - -new CommandKit({ - client: client(), - commandsPath: `${__dirname}/commands`, - eventsPath: `${__dirname}/events`, - validationsPath: `${__dirname}/validations`, - // devGuildIds: process.env.DEV_GUILD_ID?.split(',') ?? [], - // devUserIds: process.env.DEV_USER_ID?.split(',') ?? [], - bulkRegister: true, -}); +console.log('Hello from main file!'); diff --git a/packages/commandkit/tsup.config.bundled_bbvi4u4kk9s.mjs b/packages/commandkit/tsup.config.bundled_bbvi4u4kk9s.mjs new file mode 100644 index 0000000..2838f00 --- /dev/null +++ b/packages/commandkit/tsup.config.bundled_bbvi4u4kk9s.mjs @@ -0,0 +1,18 @@ +// ../tsup.config.ts +import { defineConfig } from "tsup"; +import { esbuildPluginVersionInjector } from "esbuild-plugin-version-injector"; +var tsup_config_default = defineConfig({ + format: ["esm"], + entry: ["./src"], + sourcemap: true, + keepNames: true, + dts: true, + shims: true, + skipNodeModulesBundle: true, + clean: true, + esbuildPlugins: [esbuildPluginVersionInjector()] +}); +export { + tsup_config_default as default +}; +//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vdHN1cC5jb25maWcudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9faW5qZWN0ZWRfZmlsZW5hbWVfXyA9IFwiRTpcXFxcY21ka2l0XFxcXGNvbW1hbmRraXRcXFxccGFja2FnZXNcX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BQSxFQUNQLHVCQUF1QjtBQUFBLEVBQ3ZCLE9BQU87QUFBQSxFQUNQLGdCQUFnQixDQUFDLDZCQUE2QixDQUFDO0FBQ25ELENBQUM7IiwKICAibmFtZXMiOiBbXQp9Cg== diff --git a/packages/commandkit/tsup.config.bundled_c5sp03q1jea.mjs b/packages/commandkit/tsup.config.bundled_c5sp03q1jea.mjs new file mode 100644 index 0000000..2838f00 --- /dev/null +++ b/packages/commandkit/tsup.config.bundled_c5sp03q1jea.mjs @@ -0,0 +1,18 @@ +// ../tsup.config.ts +import { defineConfig } from "tsup"; +import { esbuildPluginVersionInjector } from "esbuild-plugin-version-injector"; +var tsup_config_default = defineConfig({ + format: ["esm"], + entry: ["./src"], + sourcemap: true, + keepNames: true, + dts: true, + shims: true, + skipNodeModulesBundle: true, + clean: true, + esbuildPlugins: [esbuildPluginVersionInjector()] +}); +export { + tsup_config_default as default +}; +//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vdHN1cC5jb25maWcudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9faW5qZWN0ZWRfZmlsZW5hbWVfXyA9IFwiRTpcXFxcY21ka2l0XFxcXGNvbW1hbmRraXRcXFxccGFja2FnZXNcXFxcY29tbWFuZGtpdFxcXFx0c3VwLmNvbmZpZy50c1wiO2NvbnN0IF9faW5qZWN0ZWRfZGlybmFtZV9fID0gXCJFOlxcXFxjbWRraXRcXFxcY29tbWFuZGtpdFxcXFxwYWNrYWdlc1xcXFxjb21tYW5ka2l0XCI7Y29uc3QgX19pbmplY3RlZF9pbXBvcnRfbWV0YV91cmxfXyA9IFwiZmlsZTovLy9FOi9jbWRraXQvY29tbWFuZGtpdC9wYWNrYWdlcy9jb21tYW5ka2l0L3RzdXAuY29uZmlnLnRzXCI7aW1wb3J0IHsgZGVmaW5lQ29uZmlnIH0gZnJvbSAndHN1cCc7XG5pbXBvcnQgeyBlc2J1aWxkUGx1Z2luVmVyc2lvbkluamVjdG9yIH0gZnJvbSAnZXNidWlsZC1wbHVnaW4tdmVyc2lvbi1pbmplY3Rvcic7XG5cbmV4cG9ydCBkZWZhdWx0IGRlZmluZUNvbmZpZyh7XG4gICAgZm9ybWF0OiBbJ2VzbSddLFxuICAgIGVudHJ5OiBbJy4vc3JjJ10sXG4gICAgc291cmNlbWFwOiB0cnVlLFxuICAgIGtlZXBOYW1lczogdHJ1ZSxcbiAgICBkdHM6IHRydWUsXG4gICAgc2hpbXM6IHRydWUsXG4gICAgc2tpcE5vZGVNb2R1bGVzQnVuZGxlOiB0cnVlLFxuICAgIGNsZWFuOiB0cnVlLFxuICAgIGVzYnVpbGRQbHVnaW5zOiBbZXNidWlsZFBsdWdpblZlcnNpb25JbmplY3RvcigpXSxcbn0pO1xuIl0sCiAgIm1hcHBpbmdzIjogIjtBQUFnUixTQUFTLG9CQUFvQjtBQUM3UyxTQUFTLG9DQUFvQztBQUU3QyxJQUFPLHNCQUFRLGFBQWE7QUFBQSxFQUN4QixRQUFRLENBQUMsS0FBSztBQUFBLEVBQ2QsT0FBTyxDQUFDLE9BQU87QUFBQSxFQUNmLFdBQVc7QUFBQSxFQUNYLFdBQVc7QUFBQSxFQUNYLEtBQUs7QUFBQSxFQUNMLE9BQU87QUFBQSxFQUNQLHVCQUF1QjtBQUFBLEVBQ3ZCLE9BQU87QUFBQSxFQUNQLGdCQUFnQixDQUFDLDZCQUE2QixDQUFDO0FBQ25ELENBQUM7IiwKICAibmFtZXMiOiBbXQp9Cg== diff --git a/packages/commandkit/tsup.config.bundled_epmid2hjynd.mjs b/packages/commandkit/tsup.config.bundled_epmid2hjynd.mjs new file mode 100644 index 0000000..2838f00 --- /dev/null +++ b/packages/commandkit/tsup.config.bundled_epmid2hjynd.mjs @@ -0,0 +1,18 @@ +// ../tsup.config.ts +import { defineConfig } from "tsup"; +import { esbuildPluginVersionInjector } from "esbuild-plugin-version-injector"; +var tsup_config_default = defineConfig({ + format: ["esm"], + entry: ["./src"], + sourcemap: true, + keepNames: true, + dts: true, + shims: true, + skipNodeModulesBundle: true, + clean: true, + esbuildPlugins: [esbuildPluginVersionInjector()] +}); +export { + tsup_config_default as default +}; +//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vdHN1cC5jb25maWcudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9faW5qZWN0ZWRfZmlsZW5hbWVfXyA9IFwiRTpcXFxcY21ka2l0XFxcXGNvbW1hbmRraXRcXFxccGFja2FnZXNcXFxcY29tbWFuZGtpdFxcXFx0c3VwLmNvbmZpZy50c1wiO2NvbnN0IF9faW5qZWN0ZWRfZGlybmFtZV9fID0gXCJFOlxcXFxjbWRraXRcXFxcY29tbWFuZGtpdFxcXFxwYWNrYWdlc1xcXFxjb21tYW5ka2l0XCI7Y29uc3QgX19pbmplY3RlZF9pbXBvcnRfbWV0YV91cmxfXyA9IFwiZmlsZTovLy9FOi9jbWRraXQvY29tbWFuZGtpdC9wYWNrYWdlcy9jb21tYW5ka2l0L3RzdXAuY29uZmlnLnRzXCI7aW1wb3J0IHsgZGVmaW5lQ29uZmlnIH0gZnJvbSAndHN1cCc7XG5pbXBvcnQgeyBlc2J1aWxkUGx1Z2luVmVyc2lvbkluamVjdG9yIH0gZnJvbSAnZXNidWlsZC1wbHVnaW4tdmVyc2lvbi1pbmplY3Rvcic7XG5cbmV4cG9ydCBkZWZhdWx0IGRlZmluZUNvbmZpZyh7XG4gICAgZm9ybWF0OiBbJ2VzbSddLFxuICAgIGVudHJ5OiBbJy4vc3JjJ10sXG4gICAgc291cmNlbWFwOiB0cnVlLFxuICAgIGtlZXBOYW1lczogdHJ1ZSxcbiAgICBkdHM6IHRydWUsXG4gICAgc2hpbXM6IHRydWUsXG4gICAgc2tpcE5vZGVNb2R1bGVzQnVuZGxlOiB0cnVlLFxuICAgIGNsZWFuOiB0cnVlLFxuICAgIGVzYnVpbGRQbHVnaW5zOiBbZXNidWlsZFBsdWdpblZlcnNpb25JbmplY3RvcigpXSxcbn0pO1xuIl0sCiAgIm1hcHBpbmdzIjogIjtBQUFnUixTQUFTLG9CQUFvQjtBQUM3UyxTQUFTLG9DQUFvQztBQUU3QyxJQUFPLHNCQUFRLGFBQWE7QUFBQSxFQUN4QixRQUFRLENBQUMsS0FBSztBQUFBLEVBQ2QsT0FBTyxDQUFDLE9BQU87QUFBQSxFQUNmLFdBQVc7QUFBQSxFQUNYLFdBQVc7QUFBQSxFQUNYLEtBQUs7QUFBQSxFQUNMLE9BQU87QUFBQSxFQUNQLHVCQUF1QjtBQUFBLEVBQ3ZCLE9BQU87QUFBQSxFQUNQLGdCQUFnQixDQUFDLDZCQUE2QixDQUFDO0FBQ25ELENBQUM7IiwKICAibmFtZXMiOiBbXQp9Cg== diff --git a/packages/commandkit/tsup.config.bundled_fwdrth5y8eg.mjs b/packages/commandkit/tsup.config.bundled_fwdrth5y8eg.mjs new file mode 100644 index 0000000..2838f00 --- /dev/null +++ b/packages/commandkit/tsup.config.bundled_fwdrth5y8eg.mjs @@ -0,0 +1,18 @@ +// ../tsup.config.ts +import { defineConfig } from "tsup"; +import { esbuildPluginVersionInjector } from "esbuild-plugin-version-injector"; +var tsup_config_default = defineConfig({ + format: ["esm"], + entry: ["./src"], + sourcemap: true, + keepNames: true, + dts: true, + shims: true, + skipNodeModulesBundle: true, + clean: true, + esbuildPlugins: [esbuildPluginVersionInjector()] +}); +export { + tsup_config_default as default +}; +//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vdHN1cC5jb25maWcudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9faW5qZWN0ZWRfZmlsZW5hbWVfXyA9IFwiRTpcXFxcY21ka2l0XFxcXGNvbW1hbmRraXRcXFxccGFja2FnZXNcXFxcY29tbWFuZGtpdFxcXFx0c3VwLmNvbmZpZy50c1wiO2NvbnN0I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QUNQLGdCQUFnQixDQUFDLDZCQUE2QixDQUFDO0FBQ25ELENBQUM7IiwKICAibmFtZXMiOiBbXQp9Cg== diff --git a/packages/commandkit/tsup.config.bundled_t78774kmmbi.mjs b/packages/commandkit/tsup.config.bundled_t78774kmmbi.mjs new file mode 100644 index 0000000..e69de29 diff --git a/packages/commandkit/tsup.config.bundled_vljyo2oo22e.mjs b/packages/commandkit/tsup.config.bundled_vljyo2oo22e.mjs new file mode 100644 index 0000000..2838f00 --- /dev/null +++ b/packages/commandkit/tsup.config.bundled_vljyo2oo22e.mjs @@ -0,0 +1,18 @@ +// ../tsup.config.ts +import { defineConfig } from "tsup"; +import { esbuildPluginVersionInjector } from "esbuild-plugin-version-injector"; +var tsup_config_default = defineConfig({ + format: ["esm"], + entry: ["./src"], + sourcemap: true, + keepNames: true, + dts: true, + shims: true, + skipNodeModulesBundle: true, + clean: true, + esbuildPlugins: [esbuildPluginVersionInjector()] +}); +export { + tsup_config_default as default +}; +//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vdHN1cC5jb25maWcudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9faW5qZWN0ZWRfZmlsZW5hbWVfXyA9IFwiRTpcXFxcY21ka2l0XFxcXGNvbW1hbmRraXRcXFxccGFja2FnZXNcXFxcY29tbWFuZGtpdFxcXFx0c3VwLmNvbmZpZy50c1wiO2NvbnN0IF9faW5qZWN0ZWRfZGlybmFtZV9fID0gXCJFOlxcXFxjbWRraXRcXFxcY29tbWFuZGtpdFxcXFxwYWNrYWdlc1xcXFxjb21tYW5ka2l0XCI7Y29uc3QgX19pbmplY3RlZF9pbXBvcnRfbWV0YV91cmxfXyA9IFwiZmlsZTovLy9FOi9jbWRraXQvY29tbWFuZGtpdC9wYWNrYWdlcy9jb21tYW5ka2l0L3RzdXAuY29uZmlnLnRzXCI7aW1wb3J0IHsgZGVmaW5lQ29uZmlnIH0gZnJvbSAndHN1cCc7XG5pbXBvcnQgeyBlc2J1aWxkUGx1Z2luVmVyc2lvbkluamVjdG9yIH0gZnJvbSAnZXNidWlsZC1wbHVnaW4tdmVyc2lvbi1pbmplY3Rvcic7XG5cbmV4cG9ydCBkZWZhdWx0IGRlZmluZUNvbmZpZyh7XG4gICAgZm9ybWF0OiBbJ2VzbSddLFxuICAgIGVudHJ5OiBbJy4vc3JjJ10sXG4gICAgc291cmNlbWFwOiB0cnVlLFxuICAgIGtlZXBOYW1lczogdHJ1ZSxcbiAgICBkdHM6IHRydWUsXG4gICAgc2hpbXM6IHRydWUsXG4gICAgc2tpcE5vZGVNb2R1bGVzQnVuZGxlOiB0cnVlLFxuICAgIGNsZWFuOiB0cnVlLFxuICAgIGVzYnVpbGRQbHVnaW5zOiBbZXNidWlsZFBsdWdpblZlcnNpb25JbmplY3RvcigpXSxcbn0pO1xuIl0sCiAgIm1hcHBpbmdzIjogIjtBQUFnUixTQUFTLG9CQUFvQjtBQUM3UyxTQUFTLG9DQUFvQztBQUU3QyxJQUFPLHNCQUFRLGFBQWE7QUFBQSxFQUN4QixRQUFRLENBQUMsS0FBSztBQUFBLEVBQ2QsT0FBTyxDQUFDLE9BQU87QUFBQSxFQUNmLFdBQVc7QUFBQSxFQUNYLFdBQVc7QUFBQSxFQUNYLEtBQUs7QUFBQSxFQUNMLE9BQU87QUFBQSxFQUNQLHVCQUF1QjtBQUFBLEVBQ3ZCLE9BQU87QUFBQSxFQUNQLGdCQUFnQixDQUFDLDZCQUE2QixDQUFDO0FBQ25ELENBQUM7IiwKICAibmFtZXMiOiBbXQp9Cg== diff --git a/packages/commandkit/tsup.config.bundled_xd9rbji7u1.mjs b/packages/commandkit/tsup.config.bundled_xd9rbji7u1.mjs new file mode 100644 index 0000000..2838f00 --- /dev/null +++ b/packages/commandkit/tsup.config.bundled_xd9rbji7u1.mjs @@ -0,0 +1,18 @@ +// ../tsup.config.ts +import { defineConfig } from "tsup"; +import { esbuildPluginVersionInjector } from "esbuild-plugin-version-injector"; +var tsup_config_default = defineConfig({ + format: ["esm"], + entry: ["./src"], + sourcemap: true, + keepNames: true, + dts: true, + shims: true, + skipNodeModulesBundle: true, + clean: true, + esbuildPlugins: [esbuildPluginVersionInjector()] +}); +export { + tsup_config_default as default +}; +//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vdHN1cC5jb25maWcudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9faW5qZWN0ZWRfZmlsZW5hbWVfXyA9IFwiRTpcXFxcY21ka2l0XFxcXGNvbW1hbmRraXRcXFxccGFja2FnZXNcXFxcY29tbWFuZGtpdFxcXFx0c3VwLmNvbmZpZy50c1wiO2NvbnN0IF9faW5qZWN0ZWRfZGlybmFtZV9fID0gXCJFOlxcXFxjbWRraXRcXFxcY29tbWFuZGtpdFxcXFxwYWNrYWdlc1xcXFxjb21tYW5ka2l0XCI7Y29uc3QgX19pbmplY3RlZF9pbXBvcnRfbWV0YV91cmxfXyA9IFwiZmlsZTovLy9FOi9jbWRraXQvY29tbWFuZGtpdC9wYWNrYWdlcy9jb21tYW5ka2l0L3RzdXAuY29uZmlnLnRzXCI7aW1wb3J0IHsgZGVmaW5lQ29uZmlnIH0gZnJvbSAndHN1cCc7XG5pbXBvcnQgeyBlc2J1aWxkUGx1Z2luVmVyc2lvbkluamVjdG9yIH0gZnJvbSAnZXNidWlsZC1wbHVnaW4tdmVyc2lvbi1pbmplY3Rvcic7XG5cbmV4cG9ydCBkZWZhdWx0IGRlZmluZUNvbmZpZyh7XG4gICAgZm9ybWF0OiBbJ2VzbSddLFxuICAgIGVudHJ5OiBbJy4vc3JjJ10sXG4gICAgc291cmNlbWFwOiB0cnVlLFxuICAgIGtlZXBOYW1lczogdHJ1ZSxcbiAgICBkdHM6IHRydWUsXG4gICAgc2hpbXM6IHRydWUsXG4gICAgc2tpcE5vZGVNb2R1bGVzQnVuZGxlOiB0cnVlLFxuICAgIGNsZWFuOiB0cnVlLFxuICAgIGVzYnVpbGRQbHVnaW5zOiBbZXNidWlsZFBsdWdpblZlcnNpb25JbmplY3RvcigpXSxcbn0pO1xuIl0sCiAgIm1hcHBpbmdzIjogIjtBQUFnUixTQUFTLG9CQUFvQjtBQUM3UyxTQUFTLG9DQUFvQztBQUU3QyxJQUFPLHNCQUFRLGFBQWE7QUFBQSxFQUN4QixRQUFRLENBQUMsS0FBSztBQUFBLEVBQ2QsT0FBTyxDQUFDLE9BQU87QUFBQSxFQUNmLFdBQVc7QUFBQSxFQUNYLFdBQVc7QUFBQSxFQUNYLEtBQUs7QUFBQSxFQUNMLE9BQU87QUFBQSxFQUNQLHVCQUF1QjtBQUFBLEVBQ3ZCLE9BQU87QUFBQSxFQUNQLGdCQUFnQixDQUFDLDZCQUE2QixDQUFDO0FBQ25ELENBQUM7IiwKICAibmFtZXMiOiBbXQp9Cg== diff --git a/packages/commandkit/tsup.config.ts b/packages/commandkit/tsup.config.ts index 56f41f5..01478fd 100644 --- a/packages/commandkit/tsup.config.ts +++ b/packages/commandkit/tsup.config.ts @@ -2,12 +2,9 @@ import { defineConfig } from 'tsup'; import { esbuildPluginVersionInjector } from 'esbuild-plugin-version-injector'; export default defineConfig({ - format: ['cjs', 'esm'], + format: ['esm'], entry: ['./src'], sourcemap: true, - minifyIdentifiers: false, - minifySyntax: true, - minifyWhitespace: true, keepNames: true, dts: true, shims: true, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 84cf293..fd6b06b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -56,6 +56,9 @@ importers: packages/commandkit: dependencies: + chokidar: + specifier: ^3.5.3 + version: 3.5.3 dotenv-cra: specifier: ^3.0.3 version: 3.0.3