spotifyplus 0.1.2 → 0.1.3
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.
- package/dev.cjs +22 -1
- package/package.json +1 -1
package/dev.cjs
CHANGED
|
@@ -119,7 +119,7 @@ async function readManifest(scriptDir) {
|
|
|
119
119
|
}
|
|
120
120
|
async function bundleScript(scriptDir) {
|
|
121
121
|
const manifest = await readManifest(scriptDir);
|
|
122
|
-
const entryPath =
|
|
122
|
+
const entryPath = await resolveEntryPath(scriptDir, manifest);
|
|
123
123
|
const result = await (0, import_esbuild.build)({
|
|
124
124
|
entryPoints: [entryPath],
|
|
125
125
|
bundle: true,
|
|
@@ -139,6 +139,27 @@ async function bundleScript(scriptDir) {
|
|
|
139
139
|
source
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
|
+
async function resolveEntryPath(scriptDir, manifest) {
|
|
143
|
+
const manifestEntry = import_node_path.default.resolve(scriptDir, manifest.main);
|
|
144
|
+
if (import_node_fs.default.existsSync(manifestEntry)) return manifestEntry;
|
|
145
|
+
const candidates = [
|
|
146
|
+
"src/index.tsx",
|
|
147
|
+
"src/index.ts",
|
|
148
|
+
"src/index.jsx",
|
|
149
|
+
"src/index.js",
|
|
150
|
+
"index.tsx",
|
|
151
|
+
"index.ts",
|
|
152
|
+
"index.jsx"
|
|
153
|
+
];
|
|
154
|
+
for (const candidate of candidates) {
|
|
155
|
+
const candidatePath = import_node_path.default.resolve(scriptDir, candidate);
|
|
156
|
+
if (import_node_fs.default.existsSync(candidatePath)) {
|
|
157
|
+
console.warn(`[spotifyplus] manifest.main points to missing ${manifest.main}; using ${candidate} as the dev entry`);
|
|
158
|
+
return candidatePath;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
throw new Error(`Could not resolve ${manifestEntry}. Set manifest.main to a real source file, or add src/index.tsx.`);
|
|
162
|
+
}
|
|
142
163
|
function createReloadServer(state, port) {
|
|
143
164
|
const server = import_node_http.default.createServer((request, response) => {
|
|
144
165
|
const url = new URL(request.url ?? "/", `http://127.0.0.1:${port}`);
|