dopesheet 0.0.0-stage → 0.1.0-beta.0

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 @@
1
+ export { t as mount, n as mountDocked } from "./src-D2ttZ_j7.js";
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ import { createUnplugin } from "unplugin";
2
+ import { t as dopesheet$1 } from "./shared-CdhNdlQj.js";
3
+ // src/index.ts
4
+ /** Dopesheet for webpack and Rspack: `plugins: [dopesheet.webpack()]`. Only active in watch mode. */
5
+ var dopesheet = createUnplugin((options, meta) => dopesheet$1.raw({
6
+ client: "dopesheet/client",
7
+ ...options
8
+ }, meta));
9
+ var webpack = dopesheet.webpack;
10
+ var rspack = dopesheet.rspack;
11
+ export { dopesheet as default, dopesheet, rspack, webpack };
@@ -0,0 +1,24 @@
1
+ // webpack / Turbopack loader: the Dopesheet build transform. Options: { root, server, client, sourcesDir }.
2
+ // The transform is an ES module, loaded once with import() so any Node version can run it.
3
+ let load;
4
+ module.exports = function dopesheetLoader(source, map) {
5
+ const callback = this.async();
6
+ const options = (this.getOptions ? this.getOptions() : this.query) || {};
7
+ const file = this.resourcePath;
8
+ const warn = (e) => this.emitWarning && this.emitWarning(new Error(`[dopesheet] ${e && e.message ? e.message : e}`));
9
+ (load ||= import("./transform.js"))
10
+ .then(({ transform }) => {
11
+ let out = null;
12
+ try {
13
+ out = transform(String(source), file, options);
14
+ } catch (e) {
15
+ warn(e);
16
+ }
17
+ if (!out) callback(null, source, map);
18
+ else callback(null, out.code, out.map);
19
+ })
20
+ .catch((e) => {
21
+ warn(e);
22
+ callback(null, source, map);
23
+ });
24
+ };
package/dist/next.js ADDED
@@ -0,0 +1,81 @@
1
+ import { fileURLToPath } from "node:url";
2
+ import { createRequire } from "node:module";
3
+ import { resolve } from "node:path";
4
+ import { t as startServer } from "./shared-E9l6ZbF6.js";
5
+ // ../unplugin/src/next.ts
6
+ var require = createRequire(import.meta.url);
7
+ /**
8
+ * Next.js: `export default withDopesheet(nextConfig)`. In `next dev` (Turbopack or --webpack) it
9
+ * adds the build transform as a loader and starts the save server; `next build` is untouched.
10
+ */
11
+ function withDopesheet$1(config = {}, options = {}) {
12
+ if (process.env.NODE_ENV === "production") return config;
13
+ const root = options.root ?? process.cwd();
14
+ const port = options.port ?? 4855;
15
+ const sourcesDir = resolve(root, "node_modules/.cache/dopesheet");
16
+ const loaderOptions = {
17
+ root,
18
+ server: `http://127.0.0.1:${port}`,
19
+ sourcesDir,
20
+ ...options.client ? { client: options.client } : {}
21
+ };
22
+ const loader = options.loader ?? require.resolve("./loader.cjs");
23
+ startServer({
24
+ root,
25
+ port,
26
+ sourcesDir
27
+ });
28
+ const rule = {
29
+ loaders: [{
30
+ loader,
31
+ options: loaderOptions
32
+ }],
33
+ condition: { not: "foreign" }
34
+ };
35
+ const rules = { ...config.turbopack?.rules ?? {} };
36
+ for (const ext of [
37
+ "tsx",
38
+ "ts",
39
+ "jsx",
40
+ "js",
41
+ "mjs"
42
+ ]) {
43
+ const glob = `*.${ext}`;
44
+ const own = rules[glob];
45
+ rules[glob] = [...own ? Array.isArray(own) ? own : [own] : [], {
46
+ ...rule,
47
+ as: glob
48
+ }];
49
+ }
50
+ const userWebpack = config.webpack;
51
+ return {
52
+ ...config,
53
+ turbopack: {
54
+ ...config.turbopack,
55
+ rules
56
+ },
57
+ webpack(webpackConfig, ctx) {
58
+ const out = typeof userWebpack === "function" ? userWebpack(webpackConfig, ctx) : webpackConfig;
59
+ if (ctx?.dev) out.module.rules.unshift({
60
+ test: /\.[cm]?[jt]sx?$/,
61
+ exclude: /node_modules/,
62
+ enforce: "pre",
63
+ use: [{
64
+ loader,
65
+ options: loaderOptions
66
+ }]
67
+ });
68
+ return out;
69
+ }
70
+ };
71
+ }
72
+ // src/next.ts
73
+ /** Next.js: `export default withDopesheet(nextConfig)`. Only active in `next dev`. */
74
+ function withDopesheet(config = {}, options = {}) {
75
+ return withDopesheet$1(config, {
76
+ client: "dopesheet/client",
77
+ loader: fileURLToPath(new URL("./loader.cjs", import.meta.url)),
78
+ ...options
79
+ });
80
+ }
81
+ export { withDopesheet as default, withDopesheet };
@@ -0,0 +1,47 @@
1
+ import { createUnplugin } from "unplugin";
2
+ import { r as transform, t as startServer } from "./shared-E9l6ZbF6.js";
3
+ // ../unplugin/src/index.ts
4
+ /**
5
+ * Dopesheet for webpack and Rspack (Vite has its own plugin, @dopesheet/vite-plugin). In watch
6
+ * mode it tags GSAP calls, boots the editor in the page, and starts the save server.
7
+ */
8
+ var dopesheet = createUnplugin((options = {}) => {
9
+ const port = options.port ?? 4855;
10
+ const opts = {
11
+ server: `http://127.0.0.1:${port}`,
12
+ ...options
13
+ };
14
+ let started = false;
15
+ const serve = (server) => {
16
+ if (started) return;
17
+ started = true;
18
+ startServer(server);
19
+ };
20
+ return {
21
+ name: "dopesheet",
22
+ enforce: "pre",
23
+ transformInclude: (id) => /\.[cm]?[jt]sx?$/.test(id) && !id.includes("node_modules"),
24
+ transform(code, id) {
25
+ return transform(code, id, opts);
26
+ },
27
+ webpack(compiler) {
28
+ if (compiler.options.mode === "production") return;
29
+ compiler.hooks.watchRun.tap("dopesheet", () => serve({
30
+ root: opts.root ?? compiler.context,
31
+ port,
32
+ sourcesDir: opts.sourcesDir
33
+ }));
34
+ },
35
+ rspack(compiler) {
36
+ if (compiler.options.mode === "production") return;
37
+ compiler.hooks.watchRun.tap("dopesheet", () => serve({
38
+ root: opts.root ?? compiler.context,
39
+ port,
40
+ sourcesDir: opts.sourcesDir
41
+ }));
42
+ }
43
+ };
44
+ });
45
+ dopesheet.webpack;
46
+ dopesheet.rspack;
47
+ export { dopesheet as t };