@freqhole/playlistz 0.0.1
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/.changeset/config.json +11 -0
- package/.changeset/nice-wolves-thank.md +5 -0
- package/.freqhole-versions.json +4 -0
- package/.github/copilot-instructions.md +201 -0
- package/.github/workflows/changesets.yml +50 -0
- package/.github/workflows/npm-publish.yml +124 -0
- package/.github/workflows/pr-checks.yml +103 -0
- package/README.md +30 -0
- package/build-component.js +141 -0
- package/build-zip-bundle-lib.js +44 -0
- package/config/playwright.config.ts +47 -0
- package/config/vite.config.ts +44 -0
- package/config/vitest.config.ts +39 -0
- package/dist/assets/automerge_wasm_bg-Cik4BF9l.wasm +0 -0
- package/dist/assets/index-CbOXzGiA.js +216 -0
- package/dist/assets/index-CbOXzGiA.js.map +1 -0
- package/dist/assets/index-TvJ6RFpy.css +1 -0
- package/dist/assets/midden-DceCrT_L.js +2 -0
- package/dist/assets/midden-DceCrT_L.js.map +1 -0
- package/dist/assets/midden_bg-BLhfGIU-.wasm +0 -0
- package/dist/index.html +55 -0
- package/dist/sw.js +134 -0
- package/docs/AUTOMERGE_P2P_PLAN.md +233 -0
- package/docs/COLLABORATIVE_SHARING_PLAN.md +188 -0
- package/docs/E2E_TESTID_PLAN.md +234 -0
- package/docs/IROH_P2P_PLAN.md +302 -0
- package/docs/ROADMAP.md +695 -0
- package/docs/TODO.md +167 -0
- package/docs/bundle-embedding-plan.md +134 -0
- package/docs/standalone-refactor.md +184 -0
- package/e2e/all-playlists.spec.ts +220 -0
- package/e2e/audio-player.spec.ts +226 -0
- package/e2e/collaborative-features.spec.ts +229 -0
- package/e2e/contexts.ts +238 -0
- package/e2e/edit-panel.spec.ts +87 -0
- package/e2e/fixtures/bare-glitch-1s.m4a +0 -0
- package/e2e/fixtures/bare-glitch-1s.mp3 +0 -0
- package/e2e/fixtures/bare-glitch-1s.ogg +0 -0
- package/e2e/fixtures/chord-stack-3s.wav +0 -0
- package/e2e/fixtures/cover-anim.gif +0 -0
- package/e2e/fixtures/cover-blue.png +0 -0
- package/e2e/fixtures/cover-checkers.png +0 -0
- package/e2e/fixtures/cover-gradient.jpg +0 -0
- package/e2e/fixtures/cover-mono.gif +0 -0
- package/e2e/fixtures/cover-noise.png +0 -0
- package/e2e/fixtures/cover-plasma.webp +0 -0
- package/e2e/fixtures/cover-portrait.jpg +0 -0
- package/e2e/fixtures/cover-red.png +0 -0
- package/e2e/fixtures/cover-thumb.jpg +0 -0
- package/e2e/fixtures/cover-wide.webp +0 -0
- package/e2e/fixtures/generate.mjs +257 -0
- package/e2e/fixtures/long-drone-90s.mp3 +0 -0
- package/e2e/fixtures/noisy-binaural-8s.mp3 +0 -0
- package/e2e/fixtures/tagged-a3-4s.m4a +0 -0
- package/e2e/fixtures/tagged-a3-4s.mp3 +0 -0
- package/e2e/fixtures/tagged-a3-4s.ogg +0 -0
- package/e2e/fixtures/tagged-c5-3s.m4a +0 -0
- package/e2e/fixtures/tagged-c5-3s.mp3 +0 -0
- package/e2e/fixtures/tagged-c5-3s.ogg +0 -0
- package/e2e/fixtures/tagged-f4-6s.m4a +0 -0
- package/e2e/fixtures/tagged-f4-6s.mp3 +0 -0
- package/e2e/fixtures/tagged-f4-6s.ogg +0 -0
- package/e2e/fixtures/tone-220hz-10s.wav +0 -0
- package/e2e/fixtures/tone-440hz-2s.wav +0 -0
- package/e2e/fixtures/tone-880hz-5s.wav +0 -0
- package/e2e/fixtures/tone-stereo-3s.wav +0 -0
- package/e2e/fixtures/user-provided/README.md +1 -0
- package/e2e/helpers/app.ts +143 -0
- package/e2e/helpers/hooks.ts +133 -0
- package/e2e/helpers/index.ts +12 -0
- package/e2e/helpers/media.ts +125 -0
- package/e2e/helpers.ts +10 -0
- package/e2e/p2p-collaboration.spec.ts +356 -0
- package/e2e/p2p-multi-peer.spec.ts +723 -0
- package/e2e/p2p-states.spec.ts +302 -0
- package/e2e/playback.spec.ts +56 -0
- package/e2e/playlist-crud.spec.ts +126 -0
- package/e2e/share-link-autoplay.spec.ts +129 -0
- package/e2e/sharing-access.spec.ts +205 -0
- package/e2e/sharing.spec.ts +195 -0
- package/e2e/song-cache-state.spec.ts +202 -0
- package/e2e/zip-bundle.spec.ts +855 -0
- package/eslint.config.js +114 -0
- package/index.html +54 -0
- package/package.json +119 -0
- package/public/sw.js +134 -0
- package/scripts/use-local.mjs +37 -0
- package/scripts/use-published.mjs +37 -0
- package/src/App.tsx +9 -0
- package/src/cli/check.ts +164 -0
- package/src/cli/generate.ts +184 -0
- package/src/cli/http.ts +88 -0
- package/src/cli/index.ts +65 -0
- package/src/cli/init.ts +18 -0
- package/src/components/AllPlaylistsPanel.tsx +713 -0
- package/src/components/AudioPlayer.tsx +122 -0
- package/src/components/MarqueeText.tsx +101 -0
- package/src/components/PlaylistCoverModal.tsx +519 -0
- package/src/components/PlaylistEditPanel.tsx +803 -0
- package/src/components/PlaylistSharePanel.tsx +1020 -0
- package/src/components/ShareLinkKnockPanel.tsx +144 -0
- package/src/components/SharePanel.tsx +584 -0
- package/src/components/SongEditModal.tsx +453 -0
- package/src/components/SongEditPanel.tsx +578 -0
- package/src/components/SongRow.tsx +689 -0
- package/src/components/index.tsx +494 -0
- package/src/components/playlist/index.tsx +1203 -0
- package/src/context/PlaylistzContext.tsx +74 -0
- package/src/dev-hooks.ts +35 -0
- package/src/hooks/createDocIndexQuery.ts +53 -0
- package/src/hooks/createDocStore.test.ts +303 -0
- package/src/hooks/createDocStore.ts +90 -0
- package/src/hooks/useDragAndDrop.test.ts +474 -0
- package/src/hooks/useDragAndDrop.ts +400 -0
- package/src/hooks/useImageModal.test.ts +174 -0
- package/src/hooks/useImageModal.ts +201 -0
- package/src/hooks/usePlaylistManager.test.ts +453 -0
- package/src/hooks/usePlaylistManager.ts +685 -0
- package/src/hooks/usePlaylistsQuery.test.tsx +120 -0
- package/src/hooks/usePlaylistsQuery.ts +44 -0
- package/src/hooks/useSongState.test.ts +236 -0
- package/src/hooks/useSongState.ts +114 -0
- package/src/hooks/useUIState.ts +71 -0
- package/src/index.tsx +18 -0
- package/src/services/audioService.dev.ts +22 -0
- package/src/services/audioService.test.ts +1226 -0
- package/src/services/audioService.ts +1395 -0
- package/src/services/automergeRepo.test.ts +269 -0
- package/src/services/automergeRepo.ts +226 -0
- package/src/services/blobTransferService.dev.ts +119 -0
- package/src/services/blobTransferService.test.ts +441 -0
- package/src/services/blobTransferService.ts +702 -0
- package/src/services/docIndexService.test.ts +179 -0
- package/src/services/docIndexService.ts +118 -0
- package/src/services/fileProcessingService.test.ts +554 -0
- package/src/services/fileProcessingService.ts +239 -0
- package/src/services/imageService.test.ts +701 -0
- package/src/services/imageService.ts +365 -0
- package/src/services/indexedDBService.integration.test.ts +104 -0
- package/src/services/indexedDBService.test.ts +202 -0
- package/src/services/indexedDBService.ts +436 -0
- package/src/services/offlineService.test.ts +661 -0
- package/src/services/offlineService.ts +382 -0
- package/src/services/p2pService.test.ts +305 -0
- package/src/services/p2pService.ts +344 -0
- package/src/services/playlistDocService.test.ts +448 -0
- package/src/services/playlistDocService.ts +707 -0
- package/src/services/playlistDownloadService.test.ts +674 -0
- package/src/services/playlistDownloadService.ts +389 -0
- package/src/services/sharingService.test.ts +812 -0
- package/src/services/sharingService.ts +1073 -0
- package/src/services/sharingState.ts +161 -0
- package/src/services/songReactivity.test.ts +620 -0
- package/src/services/songReactivity.ts +145 -0
- package/src/services/standaloneService.test.ts +1025 -0
- package/src/services/standaloneService.ts +588 -0
- package/src/services/streamingAudioService.test.ts +275 -0
- package/src/services/streamingAudioService.ts +166 -0
- package/src/styles.css +428 -0
- package/src/test-setup.ts +547 -0
- package/src/types/global.d.ts +40 -0
- package/src/types/playlist.ts +99 -0
- package/src/utils/hashUtils.ts +41 -0
- package/src/utils/log.ts +97 -0
- package/src/utils/m3u.test.ts +172 -0
- package/src/utils/m3u.ts +136 -0
- package/src/utils/mockData.ts +166 -0
- package/src/utils/standaloneTemplates.test.ts +175 -0
- package/src/utils/standaloneTemplates.ts +83 -0
- package/src/utils/swTemplate.ts +84 -0
- package/src/utils/timeUtils.ts +166 -0
- package/src/utils/typeGuards.ts +171 -0
- package/src/web-component.tsx +98 -0
- package/src/zip-bundle/index.ts +7 -0
- package/src/zip-bundle/m3u.ts +45 -0
- package/src/zip-bundle/types.ts +50 -0
- package/src/zip-bundle/utils.ts +33 -0
- package/src/zip-bundle/zipBuilder.ts +309 -0
- package/tailwind.config.js +55 -0
- package/tsconfig.json +43 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// builds the ./zip-bundle export as a pure ESM library.
|
|
3
|
+
// uses esbuild (already a dep via vite) - no extra tooling needed.
|
|
4
|
+
// output: dist/zip-bundle/index.js + dist/zip-bundle/index.d.ts (via tsc)
|
|
5
|
+
|
|
6
|
+
/* global console, process */
|
|
7
|
+
import { build } from "esbuild";
|
|
8
|
+
import { execSync } from "child_process";
|
|
9
|
+
import fs from "fs";
|
|
10
|
+
import path from "path";
|
|
11
|
+
import { fileURLToPath } from "url";
|
|
12
|
+
|
|
13
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
14
|
+
|
|
15
|
+
const outDir = path.resolve(__dirname, "dist/zip-bundle");
|
|
16
|
+
if (fs.existsSync(outDir)) {
|
|
17
|
+
fs.rmSync(outDir, { recursive: true, force: true });
|
|
18
|
+
}
|
|
19
|
+
fs.mkdirSync(outDir, { recursive: true });
|
|
20
|
+
|
|
21
|
+
console.log("building dist/zip-bundle/index.js...");
|
|
22
|
+
|
|
23
|
+
await build({
|
|
24
|
+
entryPoints: [path.resolve(__dirname, "src/zip-bundle/index.ts")],
|
|
25
|
+
bundle: true,
|
|
26
|
+
format: "esm",
|
|
27
|
+
platform: "neutral",
|
|
28
|
+
outfile: path.resolve(outDir, "index.js"),
|
|
29
|
+
external: ["jszip", "zod"],
|
|
30
|
+
sourcemap: true,
|
|
31
|
+
minify: false,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
console.log("generating dist/zip-bundle type declarations...");
|
|
35
|
+
|
|
36
|
+
execSync(
|
|
37
|
+
"npx tsc --declaration --emitDeclarationOnly --noEmit false " +
|
|
38
|
+
"--moduleResolution bundler --module esnext " +
|
|
39
|
+
"--outDir dist/zip-bundle " +
|
|
40
|
+
"src/zip-bundle/index.ts",
|
|
41
|
+
{ cwd: __dirname, stdio: "inherit" },
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
console.log("done: dist/zip-bundle/");
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { defineConfig, devices } from "@playwright/test";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
|
|
4
|
+
// e2e tests for playlistz. run with `npm run test:e2e`.
|
|
5
|
+
// the dev server is started automatically on a dedicated port.
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
testDir: "../e2e",
|
|
8
|
+
fullyParallel: false,
|
|
9
|
+
forbidOnly: !!process.env.CI,
|
|
10
|
+
retries: process.env.CI ? 2 : 0,
|
|
11
|
+
// single worker: tests share the dev server origin's indexeddb state,
|
|
12
|
+
// and each test resets storage in beforeEach
|
|
13
|
+
workers: 1,
|
|
14
|
+
reporter: [["list"]],
|
|
15
|
+
// default per-test timeout: 30s for normal tests.
|
|
16
|
+
// tests that need more (two-browser p2p, standalone build) use test.setTimeout()
|
|
17
|
+
timeout: 30_000,
|
|
18
|
+
expect: { timeout: 5000 },
|
|
19
|
+
use: {
|
|
20
|
+
baseURL: "http://localhost:5917",
|
|
21
|
+
trace: "on-first-retry",
|
|
22
|
+
viewport: { width: 1400, height: 900 },
|
|
23
|
+
// action timeout: how long to wait for a single locator action (click, fill, etc.)
|
|
24
|
+
actionTimeout: 10_000,
|
|
25
|
+
// navigation timeout: how long page.goto / page.waitForURL waits
|
|
26
|
+
navigationTimeout: 15_000,
|
|
27
|
+
},
|
|
28
|
+
projects: [
|
|
29
|
+
{
|
|
30
|
+
name: "chromium",
|
|
31
|
+
use: {
|
|
32
|
+
...devices["Desktop Chrome"],
|
|
33
|
+
launchOptions: {
|
|
34
|
+
// allow audio playback without a user gesture in headless runs
|
|
35
|
+
args: ["--autoplay-policy=no-user-gesture-required"],
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
webServer: {
|
|
41
|
+
command: "npx vite --config config/vite.config.ts --port 5917",
|
|
42
|
+
// cwd defaults to the config file's directory; run from the repo root
|
|
43
|
+
cwd: fileURLToPath(new URL("..", import.meta.url)),
|
|
44
|
+
port: 5917,
|
|
45
|
+
reuseExistingServer: !process.env.CI,
|
|
46
|
+
},
|
|
47
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { defineConfig } from "vite";
|
|
2
|
+
import solid from "vite-plugin-solid";
|
|
3
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
4
|
+
import wasm from "vite-plugin-wasm";
|
|
5
|
+
import topLevelAwait from "vite-plugin-top-level-await";
|
|
6
|
+
import fs from "node:fs";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
|
|
9
|
+
// serve built dist/ assets (e.g. freqhole-playlistz.js) during dev
|
|
10
|
+
function serveDistAssets() {
|
|
11
|
+
return {
|
|
12
|
+
name: "serve-dist-assets",
|
|
13
|
+
configureServer(server: import("vite").ViteDevServer) {
|
|
14
|
+
server.middlewares.use((req, res, next) => {
|
|
15
|
+
const url = req.url?.split("?")[0] ?? "/";
|
|
16
|
+
const distPath = path.resolve(__dirname, "../dist", url.replace(/^\//, ""));
|
|
17
|
+
if (fs.existsSync(distPath) && fs.statSync(distPath).isFile()) {
|
|
18
|
+
const ext = path.extname(distPath);
|
|
19
|
+
const mime = ext === ".js" || ext === ".mjs" ? "application/javascript"
|
|
20
|
+
: ext === ".map" ? "application/json"
|
|
21
|
+
: "application/octet-stream";
|
|
22
|
+
res.setHeader("Content-Type", mime);
|
|
23
|
+
fs.createReadStream(distPath).pipe(res);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
next();
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default defineConfig({
|
|
33
|
+
plugins: [wasm(), topLevelAwait(), solid(), tailwindcss(), serveDistAssets()],
|
|
34
|
+
server: {
|
|
35
|
+
port: 3000,
|
|
36
|
+
host: true,
|
|
37
|
+
open: true,
|
|
38
|
+
},
|
|
39
|
+
build: {
|
|
40
|
+
target: "esnext",
|
|
41
|
+
minify: true,
|
|
42
|
+
sourcemap: true,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { defineConfig } from "vitest/config";
|
|
2
|
+
import solid from "vite-plugin-solid";
|
|
3
|
+
import wasm from "vite-plugin-wasm";
|
|
4
|
+
import topLevelAwait from "vite-plugin-top-level-await";
|
|
5
|
+
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
plugins: [wasm(), topLevelAwait(), solid()],
|
|
8
|
+
resolve: {
|
|
9
|
+
// use browser build of solid-js in tests so reactive signals/memos work correctly
|
|
10
|
+
conditions: ["browser", "solid", "development"],
|
|
11
|
+
},
|
|
12
|
+
test: {
|
|
13
|
+
globals: true,
|
|
14
|
+
environment: "jsdom",
|
|
15
|
+
include: ["src/**/*.test.ts", "src/**/*.test.tsx", "src/**/*.spec.ts"],
|
|
16
|
+
setupFiles: ["src/test-setup.ts"],
|
|
17
|
+
// silence app log output during tests - only errors surface
|
|
18
|
+
env: {
|
|
19
|
+
VITE_LOG_LEVEL: "error",
|
|
20
|
+
},
|
|
21
|
+
coverage: {
|
|
22
|
+
provider: "v8",
|
|
23
|
+
reporter: ["text", "lcov", "html"],
|
|
24
|
+
include: ["src/**/*.ts", "src/**/*.tsx"],
|
|
25
|
+
exclude: [
|
|
26
|
+
"src/**/*.test.ts",
|
|
27
|
+
"src/**/*.test.tsx",
|
|
28
|
+
"src/**/*.spec.ts",
|
|
29
|
+
"src/test-setup.ts",
|
|
30
|
+
],
|
|
31
|
+
thresholds: {
|
|
32
|
+
branches: 70,
|
|
33
|
+
functions: 70,
|
|
34
|
+
lines: 70,
|
|
35
|
+
statements: 70,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
});
|
|
Binary file
|