@pipelab/plugin-minify 1.0.0-beta.1 → 1.0.0-beta.4

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/package.json CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "name": "@pipelab/plugin-minify",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.4",
4
4
  "license": "FSL-1.1-MIT",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/CynToolkit/pipelab.git",
8
8
  "directory": "plugins/plugin-minify"
9
9
  },
10
+ "files": [
11
+ "dist"
12
+ ],
10
13
  "type": "module",
11
14
  "main": "./dist/index.cjs",
12
15
  "module": "./dist/index.mjs",
@@ -16,12 +19,12 @@
16
19
  },
17
20
  "dependencies": {
18
21
  "@types/node": "^24.12.2",
19
- "@pipelab/plugin-core": "1.0.0-beta.1"
22
+ "@pipelab/plugin-core": "1.0.0-beta.4"
20
23
  },
21
24
  "devDependencies": {
22
25
  "tsdown": "0.21.2",
23
26
  "typescript": "5.9.3",
24
- "@pipelab/tsconfig": "1.0.0-beta.0"
27
+ "@pipelab/tsconfig": "1.0.0-beta.2"
25
28
  },
26
29
  "scripts": {
27
30
  "format": "oxfmt .",
package/CHANGELOG.md DELETED
@@ -1,18 +0,0 @@
1
- # @pipelab/plugin-minify
2
-
3
- ## 1.0.0-beta.1
4
-
5
- ### Patch Changes
6
-
7
- - @pipelab/plugin-core@1.0.0-beta.1
8
-
9
- ## 1.0.0-beta.0
10
-
11
- ### Major Changes
12
-
13
- - e1befbf: initial release
14
-
15
- ### Patch Changes
16
-
17
- - Updated dependencies [e1befbf]
18
- - @pipelab/plugin-core@1.0.0-beta.0
package/src/code.ts DELETED
@@ -1,62 +0,0 @@
1
- import { readdir, mkdir, access, chmod } from "node:fs/promises";
2
- import { join, dirname } from "node:path";
3
- import esbuild from "esbuild";
4
- import { createAction, createActionRunner, createPathParam } from "@pipelab/plugin-core";
5
-
6
- export const ID = "minify:code";
7
-
8
- export const minifyCode = createAction({
9
- id: ID,
10
- name: "Minify code",
11
- description: "",
12
- icon: "",
13
- displayString: "`Minify code`",
14
- meta: {},
15
- params: {
16
- "input-folder": createPathParam("", {
17
- required: true,
18
- label: "Folder to compress",
19
- control: {
20
- type: "path",
21
- options: {
22
- properties: ["openDirectory"],
23
- },
24
- },
25
- }),
26
- },
27
- outputs: {},
28
- });
29
-
30
- const getAllJsFiles = async (dir: string): Promise<string[]> => {
31
- const files = await readdir(dir, { withFileTypes: true });
32
- return files.flatMap((file) => {
33
- const fullPath = join(dir, file.name);
34
- if (file.isDirectory()) {
35
- return getAllJsFiles(fullPath);
36
- } else if (file.isFile() && fullPath.endsWith(".js")) {
37
- return fullPath;
38
- }
39
- return [];
40
- });
41
- };
42
-
43
- export const minifyCodeRunner = createActionRunner<typeof minifyCode>(
44
- async ({ log, inputs, cwd, abortSignal }) => {
45
- const jsFiles = await getAllJsFiles(inputs["input-folder"]);
46
-
47
- for (const file of jsFiles) {
48
- await esbuild.build({
49
- entryPoints: [file], // Process one file at a time
50
- outfile: file, // Write directly to the original file
51
- minify: true, // Minify the content
52
- bundle: false, // Don't bundle dependencies
53
- sourcemap: false, // No source maps (optional)
54
- format: "esm", // Optional: Specify output format
55
- write: true, // Ensure the file is overwritten
56
- });
57
- console.log(`Minified: ${file}`);
58
- }
59
-
60
- log("Minified code");
61
- },
62
- );
package/src/images.ts DELETED
@@ -1,35 +0,0 @@
1
- import { join, dirname } from "node:path";
2
- import { mkdir, access, chmod } from "node:fs/promises";
3
- import { createAction, createActionRunner, createPathParam } from "@pipelab/plugin-core";
4
-
5
- export const ID = "minify:images";
6
-
7
- export const minifyImages = createAction({
8
- id: ID,
9
- name: "Minify images",
10
- description: "",
11
- icon: "",
12
- displayString: "`Minify`",
13
- meta: {},
14
- params: {
15
- "input-folder": createPathParam("", {
16
- required: true,
17
- label: "Folder to Upload",
18
- control: {
19
- type: "path",
20
- options: {
21
- properties: ["openDirectory"],
22
- },
23
- },
24
- }),
25
- },
26
- outputs: {},
27
- });
28
-
29
- export const minifyImagesRunner = createActionRunner<typeof minifyImages>(
30
- async ({ log, inputs, cwd, abortSignal }) => {
31
- // TODO: https://github.com/imagemin/imagemin
32
-
33
- log("Minified images");
34
- },
35
- );
package/src/index.ts DELETED
@@ -1,25 +0,0 @@
1
- import { minifyCode, minifyCodeRunner } from "./code";
2
- import { minifyImages, minifyImagesRunner } from "./images";
3
-
4
- import { createNodeDefinition } from "@pipelab/plugin-core";
5
-
6
- export default createNodeDefinition({
7
- description: "Minify and compress code and images",
8
- name: "Minifyer",
9
- id: "poki",
10
- icon: {
11
- type: "icon",
12
- icon: "mdi-zip-box",
13
- },
14
- nodes: [
15
- // make and package
16
- {
17
- node: minifyCode,
18
- runner: minifyCodeRunner,
19
- },
20
- {
21
- node: minifyImages,
22
- runner: minifyImagesRunner,
23
- },
24
- ],
25
- });
package/tsconfig.json DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "extends": "@pipelab/tsconfig/vue.json",
3
- "compilerOptions": {
4
- "outDir": "dist",
5
- "rootDir": "src"
6
- },
7
- "include": ["src"]
8
- }
package/tsdown.config.ts DELETED
@@ -1,15 +0,0 @@
1
- import { defineConfig } from "tsdown";
2
-
3
- export default defineConfig({
4
- entry: ["src/index.ts"],
5
- format: ["esm", "cjs"],
6
- dts: true,
7
- clean: true,
8
- loader: {
9
- ".webp": "dataurl",
10
- ".png": "dataurl",
11
- ".jpg": "dataurl",
12
- ".jpeg": "dataurl",
13
- ".svg": "dataurl",
14
- },
15
- });