esbuild-tailwind-ssr-plugin 0.1.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/README.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Plugin } from 'esbuild';
|
|
2
|
+
import { StaticFileMapperBuild } from 'static-file-mapper-build';
|
|
3
|
+
export interface TailwindPluginOptions {
|
|
4
|
+
css: string;
|
|
5
|
+
staticFileMapper: StaticFileMapperBuild;
|
|
6
|
+
}
|
|
7
|
+
declare const pluginFactory: (opts: TailwindPluginOptions) => Plugin;
|
|
8
|
+
export default pluginFactory;
|
|
9
|
+
//# sourceMappingURL=tailwindPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tailwindPlugin.d.ts","sourceRoot":"","sources":["../../src/tailwindPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,MAAM,EAAe,MAAM,SAAS,CAAC;AAGxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAKjE,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,EAAE,qBAAqB,CAAC;CACzC;AAuCD,QAAA,MAAM,aAAa,SAAU,qBAAqB,KAAG,MAEpD,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import postcss from 'postcss';
|
|
2
|
+
import autoprefixer from 'autoprefixer';
|
|
3
|
+
import tailwindcss from 'tailwindcss';
|
|
4
|
+
const tailwindPlugin = (opts) => {
|
|
5
|
+
return {
|
|
6
|
+
name: 'tailwind',
|
|
7
|
+
setup: (build) => {
|
|
8
|
+
// build.onLoad(
|
|
9
|
+
// {
|
|
10
|
+
// filter: /.tsx$/,
|
|
11
|
+
// },
|
|
12
|
+
// async (args: OnLoadArgs): Promise<OnLoadResult> => {
|
|
13
|
+
// console.log(args.path);
|
|
14
|
+
// return {};
|
|
15
|
+
// }
|
|
16
|
+
// );
|
|
17
|
+
build.onEnd(async () => {
|
|
18
|
+
await new Promise((resolve, reject) => {
|
|
19
|
+
postcss([tailwindcss(), autoprefixer()])
|
|
20
|
+
.process(opts.css, {
|
|
21
|
+
from: 'root.css',
|
|
22
|
+
to: 'tailwind.css',
|
|
23
|
+
})
|
|
24
|
+
.then(async (val) => {
|
|
25
|
+
await opts.staticFileMapper.put({
|
|
26
|
+
name: 'tailwind.css',
|
|
27
|
+
generatedName: 'tailwind.[hash].css',
|
|
28
|
+
content: val.css,
|
|
29
|
+
});
|
|
30
|
+
resolve();
|
|
31
|
+
})
|
|
32
|
+
.catch((err) => {
|
|
33
|
+
reject(err);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
const pluginFactory = (opts) => {
|
|
41
|
+
return tailwindPlugin(opts);
|
|
42
|
+
};
|
|
43
|
+
export default pluginFactory;
|
|
44
|
+
//# sourceMappingURL=tailwindPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tailwindPlugin.js","sourceRoot":"","sources":["../../src/tailwindPlugin.ts"],"names":[],"mappings":"AAEA,OAAO,OAAO,MAAM,SAAS,CAAC;AAG9B,OAAO,YAAY,MAAM,cAAc,CAAC;AACxC,OAAO,WAAW,MAAM,aAAa,CAAC;AAOtC,MAAM,cAAc,GAAG,CAAC,IAA2B,EAAE,EAAE;IACrD,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,CAAC,KAAkB,EAAE,EAAE;YAC5B,gBAAgB;YAChB,MAAM;YACN,uBAAuB;YACvB,OAAO;YACP,yDAAyD;YACzD,8BAA8B;YAC9B,iBAAiB;YACjB,MAAM;YACN,KAAK;YACL,KAAK,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE;gBACrB,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;oBAC1C,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE,YAAY,EAAE,CAAC,CAAC;yBACrC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE;wBACjB,IAAI,EAAE,UAAU;wBAChB,EAAE,EAAE,cAAc;qBACnB,CAAC;yBACD,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;wBAClB,MAAM,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC;4BAC9B,IAAI,EAAE,cAAc;4BACpB,aAAa,EAAE,qBAAqB;4BACpC,OAAO,EAAE,GAAG,CAAC,GAAG;yBACjB,CAAC,CAAC;wBACH,OAAO,EAAE,CAAC;oBACZ,CAAC,CAAC;yBACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;wBACb,MAAM,CAAC,GAAG,CAAC,CAAC;oBACd,CAAC,CAAC,CAAC;gBACP,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,IAA2B,EAAU,EAAE;IAC5D,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "esbuild-tailwind-ssr-plugin",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "esbuild plugin for compiling Tailwind CSS",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"node",
|
|
7
|
+
"javascript",
|
|
8
|
+
"css modules",
|
|
9
|
+
"esbuild",
|
|
10
|
+
"ssr",
|
|
11
|
+
"css"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/goldstack/goldstack/tree/master/workspaces/utils/packages/esbuild-tailwind-ssr-plugin",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/goldstack/goldstack/issues"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/goldstack/goldstack.git"
|
|
20
|
+
},
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"author": "Max Rohde",
|
|
23
|
+
"sideEffects": false,
|
|
24
|
+
"main": "dist/src/tailwindPlugin.js",
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "yarn clean && yarn compile",
|
|
27
|
+
"build:watch": "yarn clean && yarn compile-watch",
|
|
28
|
+
"clean": "rimraf ./dist",
|
|
29
|
+
"compile": "tsc -p tsconfig.json",
|
|
30
|
+
"compile-watch": "tsc -p tsconfig.json --watch",
|
|
31
|
+
"compile-watch:light": "nodemon --watch ./src/ -e '*' --exec 'yarn compile'",
|
|
32
|
+
"coverage": "jest --collect-coverage --passWithNoTests --config=./jest.config.js --runInBand",
|
|
33
|
+
"prepublishOnly": "yarn run build",
|
|
34
|
+
"publish": "utils-git changed --exec \"yarn npm publish $@\"",
|
|
35
|
+
"test": "jest --passWithNoTests --config=./jest.config.js --runInBand",
|
|
36
|
+
"version:apply": "utils-git changed --exec \"yarn version $@ && yarn version apply\""
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"autoprefixer": "^10.4.11",
|
|
40
|
+
"esbuild": "^0.17.18",
|
|
41
|
+
"postcss": "^8.4.21",
|
|
42
|
+
"static-file-mapper-build": "0.3.22",
|
|
43
|
+
"tailwindcss": "^3.4.16"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@goldstack/utils-git": "0.2.11",
|
|
47
|
+
"@swc/core": "^1.9.3",
|
|
48
|
+
"@swc/jest": "^0.2.37",
|
|
49
|
+
"@types/jest": "^29.5.14",
|
|
50
|
+
"@types/node": "^22.10.0",
|
|
51
|
+
"depcheck": "^1.4.3",
|
|
52
|
+
"jest": "^29.3.1",
|
|
53
|
+
"rimraf": "^3.0.2",
|
|
54
|
+
"typescript": "^5.7.2"
|
|
55
|
+
},
|
|
56
|
+
"publishConfig": {
|
|
57
|
+
"main": "dist/src/tailwindPlugin.js"
|
|
58
|
+
},
|
|
59
|
+
"packageManager": "yarn@3.5.0"
|
|
60
|
+
}
|