reactivated 0.29.0 → 0.30.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.
- package/dist/build.client.js +21 -5
- package/dist/build.client.js.map +1 -1
- package/dist/build.renderer.js +35 -20
- package/dist/build.renderer.js.map +1 -1
- package/dist/linaria.d.ts +14 -0
- package/dist/linaria.js +127 -0
- package/dist/linaria.js.map +1 -0
- package/package.json +8 -4
- package/src/build.client.tsx +10 -4
- package/src/build.renderer.tsx +27 -23
- package/src/linaria.tsx +150 -0
package/dist/build.client.js
CHANGED
|
@@ -23,11 +23,20 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
__setModuleDefault(result, mod);
|
|
24
24
|
return result;
|
|
25
25
|
};
|
|
26
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
27
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
28
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
29
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
30
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
31
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
32
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
33
|
+
});
|
|
34
|
+
};
|
|
26
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
37
|
};
|
|
29
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
const
|
|
39
|
+
const linaria_1 = __importDefault(require("./linaria"));
|
|
31
40
|
const esbuild_plugin_1 = require("@vanilla-extract/esbuild-plugin");
|
|
32
41
|
const esbuild = __importStar(require("esbuild"));
|
|
33
42
|
const esbuild_plugin_import_glob_1 = __importDefault(require("esbuild-plugin-import-glob"));
|
|
@@ -41,7 +50,7 @@ const env = {
|
|
|
41
50
|
TAG_VERSION: process.env.TAG_VERSION,
|
|
42
51
|
};
|
|
43
52
|
esbuild
|
|
44
|
-
.
|
|
53
|
+
.context({
|
|
45
54
|
entryPoints,
|
|
46
55
|
bundle: true,
|
|
47
56
|
// We use terser to minify because esbuild breaks safari sourcemaps.
|
|
@@ -54,7 +63,6 @@ esbuild
|
|
|
54
63
|
sourcemap: true,
|
|
55
64
|
target: "es2018",
|
|
56
65
|
preserveSymlinks: true,
|
|
57
|
-
watch: production === false,
|
|
58
66
|
external: ["moment", "@client/generated/images"],
|
|
59
67
|
define: {
|
|
60
68
|
// You need both. The one from the stringified JSON is not picked
|
|
@@ -82,8 +90,16 @@ esbuild
|
|
|
82
90
|
// Instead of set it manually instead of relying on minification
|
|
83
91
|
// settings.
|
|
84
92
|
(0, esbuild_plugin_1.vanillaExtractPlugin)({ identifiers }),
|
|
85
|
-
(0,
|
|
93
|
+
(0, linaria_1.default)({ sourceMap: true, esbuildOptions: { sourcemap: "inline" } }),
|
|
86
94
|
],
|
|
87
95
|
})
|
|
88
|
-
.
|
|
96
|
+
.then((context) => __awaiter(void 0, void 0, void 0, function* () {
|
|
97
|
+
if (production === false) {
|
|
98
|
+
context.watch();
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
yield context.rebuild();
|
|
102
|
+
process.exit();
|
|
103
|
+
}
|
|
104
|
+
}));
|
|
89
105
|
//# sourceMappingURL=build.client.js.map
|
package/dist/build.client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.client.js","sourceRoot":"","sources":["../src/build.client.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build.client.js","sourceRoot":"","sources":["../src/build.client.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,wDAAgC;AAChC,oEAAqE;AACrE,iDAAmC;AACnC,4FAA0D;AAE1D,MA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MAAM,EAAE,MAAM;QACd,MAAM,EAAE,MAAM;QACd,MAAM,EAAE,MAAM;QACd,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,MAAM;QACf,QAAQ,EAAE,MAAM;KACnB;IACD,OAAO,EAAE;QACL,IAAA,oCAAgB,GAAE;QAClB,4DAA4D;QAC5D,gEAAgE;QAChE,UAAU;QACV,gEAAgE;QAChE,YAAY;QACZ,IAAA,qCAAoB,EAAC,EAAC,WAAW,EAAC,CAAC;QACnC,IAAA,iBAAO,EAAC,EAAC,SAAS,EAAE,IAAI,EAAE,cAAc,EAAE,EAAC,SAAS,EAAE,QAAQ,EAAC,EAAC,CAAC;KACpE;CACJ,CAAC;KACD,IAAI,CAAC,CAAO,OAAO,EAAE,EAAE;IACpB,IAAI,UAAU,KAAK,KAAK,EAAE;QACtB,OAAO,CAAC,KAAK,EAAE,CAAC;KACnB;SAAM;QACH,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;QACxB,OAAO,CAAC,IAAI,EAAE,CAAC;KAClB;AACL,CAAC,CAAA,CAAC,CAAC"}
|
package/dist/build.renderer.js
CHANGED
|
@@ -23,11 +23,20 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
__setModuleDefault(result, mod);
|
|
24
24
|
return result;
|
|
25
25
|
};
|
|
26
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
27
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
28
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
29
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
30
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
31
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
32
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
33
|
+
});
|
|
34
|
+
};
|
|
26
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
37
|
};
|
|
29
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
const
|
|
39
|
+
const linaria_1 = __importDefault(require("./linaria"));
|
|
31
40
|
const esbuild_plugin_1 = require("@vanilla-extract/esbuild-plugin");
|
|
32
41
|
const esbuild = __importStar(require("esbuild"));
|
|
33
42
|
const esbuild_plugin_import_glob_1 = __importDefault(require("esbuild-plugin-import-glob"));
|
|
@@ -35,8 +44,15 @@ let server = null;
|
|
|
35
44
|
const CACHE_KEY = `${process.cwd()}/node_modules/_reactivated/renderer.js`;
|
|
36
45
|
const production = process.env.NODE_ENV === "production";
|
|
37
46
|
const identifiers = production ? "short" : "debug";
|
|
47
|
+
const restartServer = () => {
|
|
48
|
+
if (server != null) {
|
|
49
|
+
server.close();
|
|
50
|
+
}
|
|
51
|
+
delete require.cache[CACHE_KEY];
|
|
52
|
+
server = require(CACHE_KEY).server;
|
|
53
|
+
};
|
|
38
54
|
esbuild
|
|
39
|
-
.
|
|
55
|
+
.context({
|
|
40
56
|
stdin: {
|
|
41
57
|
contents: `
|
|
42
58
|
export {server} from "reactivated/dist/renderer";
|
|
@@ -55,13 +71,6 @@ esbuild
|
|
|
55
71
|
// of the location of reactivated being in the cwd node_modules or
|
|
56
72
|
// above as in monorepos.
|
|
57
73
|
nodePaths: [`${process.cwd()}/node_modules`],
|
|
58
|
-
watch: production === true
|
|
59
|
-
? false
|
|
60
|
-
: {
|
|
61
|
-
onRebuild: () => {
|
|
62
|
-
restartServer();
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
74
|
plugins: [
|
|
66
75
|
(0, esbuild_plugin_import_glob_1.default)(),
|
|
67
76
|
// We manually pass in identifiers because the client is not
|
|
@@ -70,20 +79,26 @@ esbuild
|
|
|
70
79
|
// Instead of set it manually instead of relying on minification
|
|
71
80
|
// settings.
|
|
72
81
|
(0, esbuild_plugin_1.vanillaExtractPlugin)({ identifiers }),
|
|
73
|
-
(0,
|
|
82
|
+
(0, linaria_1.default)({ sourceMap: true }),
|
|
83
|
+
{
|
|
84
|
+
name: "restartServer",
|
|
85
|
+
setup: (build) => {
|
|
86
|
+
if (production === false) {
|
|
87
|
+
build.onEnd((result) => {
|
|
88
|
+
restartServer();
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
},
|
|
74
93
|
],
|
|
75
94
|
})
|
|
76
|
-
.then(() => {
|
|
95
|
+
.then((context) => __awaiter(void 0, void 0, void 0, function* () {
|
|
77
96
|
if (production === false) {
|
|
78
|
-
|
|
97
|
+
context.watch();
|
|
79
98
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
if (server != null) {
|
|
84
|
-
server.close();
|
|
99
|
+
else {
|
|
100
|
+
yield context.rebuild();
|
|
101
|
+
process.exit();
|
|
85
102
|
}
|
|
86
|
-
|
|
87
|
-
server = require(CACHE_KEY).server;
|
|
88
|
-
};
|
|
103
|
+
}));
|
|
89
104
|
//# sourceMappingURL=build.renderer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.renderer.js","sourceRoot":"","sources":["../src/build.renderer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build.renderer.js","sourceRoot":"","sources":["../src/build.renderer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,wDAAgC;AAChC,oEAAqE;AACrE,iDAAmC;AACnC,4FAA0D;AAI1D,IAAI,MAAM,GAAuB,IAAI,CAAC;AAEtC,MAAM,SAAS,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,wCAAwC,CAAC;AAC3E,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAC;AACzD,MAAM,WAAW,GAAG,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,O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AE;QACtB,OAAO,CAAC,KAAK,EAAE,CAAC;KACnB;SAAM;QACH,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;QACxB,OAAO,CAAC,IAAI,EAAE,CAAC;KAClB;AACL,CAAC,CAAA,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains an esbuild loader for Linaria.
|
|
3
|
+
* It uses the transform.ts function to generate class names from source code,
|
|
4
|
+
* returns transformed code without template literals and attaches generated source maps
|
|
5
|
+
*/
|
|
6
|
+
import type { Plugin, TransformOptions } from "esbuild";
|
|
7
|
+
import type { PluginOptions, Preprocessor } from "@linaria/babel-preset";
|
|
8
|
+
type EsbuildPluginOptions = {
|
|
9
|
+
sourceMap?: boolean;
|
|
10
|
+
preprocessor?: Preprocessor;
|
|
11
|
+
esbuildOptions?: TransformOptions;
|
|
12
|
+
} & Partial<PluginOptions>;
|
|
13
|
+
export default function linaria({ sourceMap, preprocessor, esbuildOptions, ...rest }?: EsbuildPluginOptions): Plugin;
|
|
14
|
+
export {};
|
package/dist/linaria.js
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file contains an esbuild loader for Linaria.
|
|
4
|
+
* It uses the transform.ts function to generate class names from source code,
|
|
5
|
+
* returns transformed code without template literals and attaches generated source maps
|
|
6
|
+
*/
|
|
7
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
9
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
13
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
17
|
+
var t = {};
|
|
18
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
19
|
+
t[p] = s[p];
|
|
20
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
21
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
22
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
23
|
+
t[p[i]] = s[p[i]];
|
|
24
|
+
}
|
|
25
|
+
return t;
|
|
26
|
+
};
|
|
27
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
28
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
29
|
+
};
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
const fs_1 = __importDefault(require("fs"));
|
|
32
|
+
const path_1 = __importDefault(require("path"));
|
|
33
|
+
const esbuild_1 = require("esbuild");
|
|
34
|
+
const babel_preset_1 = require("@linaria/babel-preset");
|
|
35
|
+
const nodeModulesRegex = /^(?:.*[\\/])?node_modules(?:[\\/].*)?$/;
|
|
36
|
+
function linaria(_a = {}) {
|
|
37
|
+
var { sourceMap, preprocessor, esbuildOptions } = _a, rest = __rest(_a, ["sourceMap", "preprocessor", "esbuildOptions"]);
|
|
38
|
+
let options = esbuildOptions;
|
|
39
|
+
return {
|
|
40
|
+
name: "linaria",
|
|
41
|
+
setup(build) {
|
|
42
|
+
const cssLookup = new Map();
|
|
43
|
+
const asyncResolve = (token, importer) => __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
const context = path_1.default.isAbsolute(importer)
|
|
45
|
+
? path_1.default.dirname(importer)
|
|
46
|
+
: path_1.default.join(process.cwd(), path_1.default.dirname(importer));
|
|
47
|
+
const result = yield build.resolve(token, {
|
|
48
|
+
kind: "entry-point",
|
|
49
|
+
resolveDir: context,
|
|
50
|
+
});
|
|
51
|
+
if (result.errors.length > 0) {
|
|
52
|
+
throw new Error(`Cannot resolve ${token}`);
|
|
53
|
+
}
|
|
54
|
+
return result.path;
|
|
55
|
+
});
|
|
56
|
+
build.onResolve({ filter: /\.linaria\.css$/ }, (args) => {
|
|
57
|
+
return {
|
|
58
|
+
namespace: "linaria",
|
|
59
|
+
path: args.path,
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
build.onLoad({ filter: /.*/, namespace: "linaria" }, (args) => {
|
|
63
|
+
return {
|
|
64
|
+
contents: cssLookup.get(args.path),
|
|
65
|
+
loader: "css",
|
|
66
|
+
resolveDir: path_1.default.basename(args.path),
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
build.onLoad({ filter: /\.(js|jsx|ts|tsx)$/ }, (args) => __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
const rawCode = fs_1.default.readFileSync(args.path, "utf8");
|
|
71
|
+
const { ext, name: filename } = path_1.default.parse(args.path);
|
|
72
|
+
const loader = ext.replace(/^\./, "");
|
|
73
|
+
if (nodeModulesRegex.test(args.path)) {
|
|
74
|
+
return {
|
|
75
|
+
loader,
|
|
76
|
+
contents: rawCode,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
if (!options) {
|
|
80
|
+
options = {};
|
|
81
|
+
if ("jsxFactory" in build.initialOptions) {
|
|
82
|
+
options.jsxFactory = build.initialOptions.jsxFactory;
|
|
83
|
+
}
|
|
84
|
+
if ("jsxFragment" in build.initialOptions) {
|
|
85
|
+
options.jsxFragment = build.initialOptions.jsxFragment;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const transformed = (0, esbuild_1.transformSync)(rawCode, Object.assign(Object.assign({}, options), { sourcefile: args.path, sourcemap: sourceMap, loader }));
|
|
89
|
+
let { code } = transformed;
|
|
90
|
+
if (sourceMap) {
|
|
91
|
+
const esbuildMap = Buffer.from(transformed.map).toString("base64");
|
|
92
|
+
code += `/*# sourceMappingURL=data:application/json;base64,${esbuildMap}*/`;
|
|
93
|
+
}
|
|
94
|
+
const result = yield (0, babel_preset_1.transform)(code, {
|
|
95
|
+
filename: args.path,
|
|
96
|
+
preprocessor,
|
|
97
|
+
pluginOptions: rest,
|
|
98
|
+
}, asyncResolve);
|
|
99
|
+
if (!result.cssText) {
|
|
100
|
+
return {
|
|
101
|
+
contents: code,
|
|
102
|
+
loader,
|
|
103
|
+
resolveDir: path_1.default.dirname(args.path),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
let { cssText } = result;
|
|
107
|
+
const slug = (0, babel_preset_1.slugify)(cssText);
|
|
108
|
+
const cssFilename = `${filename}_${slug}.linaria.css`;
|
|
109
|
+
let contents = `import ${JSON.stringify(cssFilename)}; ${result.code}`;
|
|
110
|
+
if (sourceMap && result.cssSourceMapText) {
|
|
111
|
+
const map = Buffer.from(result.cssSourceMapText).toString("base64");
|
|
112
|
+
cssText += `/*# sourceMappingURL=data:application/json;base64,${map}*/`;
|
|
113
|
+
const linariaMap = Buffer.from(JSON.stringify(result.sourceMap)).toString("base64");
|
|
114
|
+
contents += `/*# sourceMappingURL=data:application/json;base64,${linariaMap}*/`;
|
|
115
|
+
}
|
|
116
|
+
cssLookup.set(cssFilename, cssText);
|
|
117
|
+
return {
|
|
118
|
+
contents,
|
|
119
|
+
loader,
|
|
120
|
+
resolveDir: path_1.default.dirname(args.path),
|
|
121
|
+
};
|
|
122
|
+
}));
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
exports.default = linaria;
|
|
127
|
+
//# sourceMappingURL=linaria.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linaria.js","sourceRoot":"","sources":["../src/linaria.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4CAAoB;AACpB,gDAAwB;AAGxB,qCAAsC;AAGtC,w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DAAqD,UAAU,IAAI,CAAC;iBACnF;gBAED,SAAS,CAAC,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;gBAEpC,OAAO;oBACH,QAAQ;oBACR,MAAM;oBACN,UAAU,EAAE,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;iBACtC,CAAC;YACN,CAAC,CAAA,CAAC,CAAC;QACP,CAAC;KACJ,CAAC;AACN,CAAC;AA9HD,0BA8HC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reactivated",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -30,10 +30,14 @@
|
|
|
30
30
|
"@types/react-dom": "^18.0.5",
|
|
31
31
|
"@typescript-eslint/eslint-plugin": "^5.59.6",
|
|
32
32
|
"@typescript-eslint/parser": "^5.59.6",
|
|
33
|
-
"@vanilla-extract/css": "^1.
|
|
34
|
-
"@vanilla-extract/
|
|
33
|
+
"@vanilla-extract/css": "^1.11.0",
|
|
34
|
+
"@vanilla-extract/css-utils": "^0.1.3",
|
|
35
|
+
"@vanilla-extract/dynamic": "^2.0.3",
|
|
36
|
+
"@vanilla-extract/esbuild-plugin": "^2.2.2",
|
|
37
|
+
"@vanilla-extract/recipes": "^0.4.0",
|
|
38
|
+
"@vanilla-extract/sprinkles": "^1.6.0",
|
|
35
39
|
"babel-plugin-module-resolver": "^5.0.0",
|
|
36
|
-
"esbuild": "^0.
|
|
40
|
+
"esbuild": "^0.17.19",
|
|
37
41
|
"esbuild-plugin-import-glob": "^0.1.1",
|
|
38
42
|
"eslint": "^8.40.0",
|
|
39
43
|
"eslint-config-prettier": "^8.8.0",
|
package/src/build.client.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import linaria from "
|
|
3
|
+
import linaria from "./linaria";
|
|
4
4
|
import {vanillaExtractPlugin} from "@vanilla-extract/esbuild-plugin";
|
|
5
5
|
import * as esbuild from "esbuild";
|
|
6
6
|
import ImportGlobPlugin from "esbuild-plugin-import-glob";
|
|
@@ -21,7 +21,7 @@ const env = {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
esbuild
|
|
24
|
-
.
|
|
24
|
+
.context({
|
|
25
25
|
entryPoints,
|
|
26
26
|
bundle: true,
|
|
27
27
|
// We use terser to minify because esbuild breaks safari sourcemaps.
|
|
@@ -34,7 +34,6 @@ esbuild
|
|
|
34
34
|
sourcemap: true,
|
|
35
35
|
target: "es2018",
|
|
36
36
|
preserveSymlinks: true,
|
|
37
|
-
watch: production === false,
|
|
38
37
|
external: ["moment", "@client/generated/images"],
|
|
39
38
|
define: {
|
|
40
39
|
// You need both. The one from the stringified JSON is not picked
|
|
@@ -66,4 +65,11 @@ esbuild
|
|
|
66
65
|
linaria({sourceMap: true, esbuildOptions: {sourcemap: "inline"}}),
|
|
67
66
|
],
|
|
68
67
|
})
|
|
69
|
-
.
|
|
68
|
+
.then(async (context) => {
|
|
69
|
+
if (production === false) {
|
|
70
|
+
context.watch();
|
|
71
|
+
} else {
|
|
72
|
+
await context.rebuild();
|
|
73
|
+
process.exit();
|
|
74
|
+
}
|
|
75
|
+
});
|
package/src/build.renderer.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import linaria from "
|
|
3
|
+
import linaria from "./linaria";
|
|
4
4
|
import {vanillaExtractPlugin} from "@vanilla-extract/esbuild-plugin";
|
|
5
5
|
import * as esbuild from "esbuild";
|
|
6
6
|
import ImportGlobPlugin from "esbuild-plugin-import-glob";
|
|
@@ -13,8 +13,17 @@ const CACHE_KEY = `${process.cwd()}/node_modules/_reactivated/renderer.js`;
|
|
|
13
13
|
const production = process.env.NODE_ENV === "production";
|
|
14
14
|
const identifiers = production ? "short" : "debug";
|
|
15
15
|
|
|
16
|
+
const restartServer = () => {
|
|
17
|
+
if (server != null) {
|
|
18
|
+
server.close();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
delete require.cache[CACHE_KEY];
|
|
22
|
+
server = require(CACHE_KEY).server;
|
|
23
|
+
};
|
|
24
|
+
|
|
16
25
|
esbuild
|
|
17
|
-
.
|
|
26
|
+
.context({
|
|
18
27
|
stdin: {
|
|
19
28
|
contents: `
|
|
20
29
|
export {server} from "reactivated/dist/renderer";
|
|
@@ -33,14 +42,6 @@ esbuild
|
|
|
33
42
|
// of the location of reactivated being in the cwd node_modules or
|
|
34
43
|
// above as in monorepos.
|
|
35
44
|
nodePaths: [`${process.cwd()}/node_modules`],
|
|
36
|
-
watch:
|
|
37
|
-
production === true
|
|
38
|
-
? false
|
|
39
|
-
: {
|
|
40
|
-
onRebuild: () => {
|
|
41
|
-
restartServer();
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
45
|
plugins: [
|
|
45
46
|
ImportGlobPlugin(),
|
|
46
47
|
// We manually pass in identifiers because the client is not
|
|
@@ -50,20 +51,23 @@ esbuild
|
|
|
50
51
|
// settings.
|
|
51
52
|
vanillaExtractPlugin({identifiers}),
|
|
52
53
|
linaria({sourceMap: true}),
|
|
54
|
+
{
|
|
55
|
+
name: "restartServer",
|
|
56
|
+
setup: (build) => {
|
|
57
|
+
if (production === false) {
|
|
58
|
+
build.onEnd((result) => {
|
|
59
|
+
restartServer();
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
},
|
|
53
64
|
],
|
|
54
65
|
})
|
|
55
|
-
.then(() => {
|
|
66
|
+
.then(async (context) => {
|
|
56
67
|
if (production === false) {
|
|
57
|
-
|
|
68
|
+
context.watch();
|
|
69
|
+
} else {
|
|
70
|
+
await context.rebuild();
|
|
71
|
+
process.exit();
|
|
58
72
|
}
|
|
59
|
-
})
|
|
60
|
-
.catch(() => process.exit(1));
|
|
61
|
-
|
|
62
|
-
const restartServer = () => {
|
|
63
|
-
if (server != null) {
|
|
64
|
-
server.close();
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
delete require.cache[CACHE_KEY];
|
|
68
|
-
server = require(CACHE_KEY).server;
|
|
69
|
-
};
|
|
73
|
+
});
|
package/src/linaria.tsx
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains an esbuild loader for Linaria.
|
|
3
|
+
* It uses the transform.ts function to generate class names from source code,
|
|
4
|
+
* returns transformed code without template literals and attaches generated source maps
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import fs from "fs";
|
|
8
|
+
import path from "path";
|
|
9
|
+
|
|
10
|
+
import type {Plugin, TransformOptions, Loader} from "esbuild";
|
|
11
|
+
import {transformSync} from "esbuild";
|
|
12
|
+
|
|
13
|
+
import type {PluginOptions, Preprocessor} from "@linaria/babel-preset";
|
|
14
|
+
import {slugify, transform} from "@linaria/babel-preset";
|
|
15
|
+
|
|
16
|
+
type EsbuildPluginOptions = {
|
|
17
|
+
sourceMap?: boolean;
|
|
18
|
+
preprocessor?: Preprocessor;
|
|
19
|
+
esbuildOptions?: TransformOptions;
|
|
20
|
+
} & Partial<PluginOptions>;
|
|
21
|
+
|
|
22
|
+
const nodeModulesRegex = /^(?:.*[\\/])?node_modules(?:[\\/].*)?$/;
|
|
23
|
+
|
|
24
|
+
export default function linaria({
|
|
25
|
+
sourceMap,
|
|
26
|
+
preprocessor,
|
|
27
|
+
esbuildOptions,
|
|
28
|
+
...rest
|
|
29
|
+
}: EsbuildPluginOptions = {}): Plugin {
|
|
30
|
+
let options = esbuildOptions;
|
|
31
|
+
return {
|
|
32
|
+
name: "linaria",
|
|
33
|
+
setup(build) {
|
|
34
|
+
const cssLookup = new Map<string, string>();
|
|
35
|
+
|
|
36
|
+
const asyncResolve = async (
|
|
37
|
+
token: string,
|
|
38
|
+
importer: string,
|
|
39
|
+
): Promise<string> => {
|
|
40
|
+
const context = path.isAbsolute(importer)
|
|
41
|
+
? path.dirname(importer)
|
|
42
|
+
: path.join(process.cwd(), path.dirname(importer));
|
|
43
|
+
|
|
44
|
+
const result = await build.resolve(token, {
|
|
45
|
+
kind: "entry-point",
|
|
46
|
+
resolveDir: context,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
if (result.errors.length > 0) {
|
|
50
|
+
throw new Error(`Cannot resolve ${token}`);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return result.path;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
build.onResolve({filter: /\.linaria\.css$/}, (args) => {
|
|
57
|
+
return {
|
|
58
|
+
namespace: "linaria",
|
|
59
|
+
path: args.path,
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
build.onLoad({filter: /.*/, namespace: "linaria"}, (args) => {
|
|
64
|
+
return {
|
|
65
|
+
contents: cssLookup.get(args.path),
|
|
66
|
+
loader: "css",
|
|
67
|
+
resolveDir: path.basename(args.path),
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
build.onLoad({filter: /\.(js|jsx|ts|tsx)$/}, async (args) => {
|
|
72
|
+
const rawCode = fs.readFileSync(args.path, "utf8");
|
|
73
|
+
const {ext, name: filename} = path.parse(args.path);
|
|
74
|
+
const loader = ext.replace(/^\./, "") as Loader;
|
|
75
|
+
|
|
76
|
+
if (nodeModulesRegex.test(args.path)) {
|
|
77
|
+
return {
|
|
78
|
+
loader,
|
|
79
|
+
contents: rawCode,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (!options) {
|
|
84
|
+
options = {};
|
|
85
|
+
if ("jsxFactory" in build.initialOptions) {
|
|
86
|
+
options.jsxFactory = build.initialOptions.jsxFactory;
|
|
87
|
+
}
|
|
88
|
+
if ("jsxFragment" in build.initialOptions) {
|
|
89
|
+
options.jsxFragment = build.initialOptions.jsxFragment;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const transformed = transformSync(rawCode, {
|
|
94
|
+
...options,
|
|
95
|
+
sourcefile: args.path,
|
|
96
|
+
sourcemap: sourceMap,
|
|
97
|
+
loader,
|
|
98
|
+
});
|
|
99
|
+
let {code} = transformed;
|
|
100
|
+
|
|
101
|
+
if (sourceMap) {
|
|
102
|
+
const esbuildMap = Buffer.from(transformed.map).toString("base64");
|
|
103
|
+
code += `/*# sourceMappingURL=data:application/json;base64,${esbuildMap}*/`;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const result = await transform(
|
|
107
|
+
code,
|
|
108
|
+
{
|
|
109
|
+
filename: args.path,
|
|
110
|
+
preprocessor,
|
|
111
|
+
pluginOptions: rest,
|
|
112
|
+
},
|
|
113
|
+
asyncResolve,
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
if (!result.cssText) {
|
|
117
|
+
return {
|
|
118
|
+
contents: code,
|
|
119
|
+
loader,
|
|
120
|
+
resolveDir: path.dirname(args.path),
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
let {cssText} = result;
|
|
125
|
+
|
|
126
|
+
const slug = slugify(cssText);
|
|
127
|
+
const cssFilename = `${filename}_${slug}.linaria.css`;
|
|
128
|
+
|
|
129
|
+
let contents = `import ${JSON.stringify(cssFilename)}; ${result.code}`;
|
|
130
|
+
|
|
131
|
+
if (sourceMap && result.cssSourceMapText) {
|
|
132
|
+
const map = Buffer.from(result.cssSourceMapText).toString("base64");
|
|
133
|
+
cssText += `/*# sourceMappingURL=data:application/json;base64,${map}*/`;
|
|
134
|
+
const linariaMap = Buffer.from(
|
|
135
|
+
JSON.stringify(result.sourceMap),
|
|
136
|
+
).toString("base64");
|
|
137
|
+
contents += `/*# sourceMappingURL=data:application/json;base64,${linariaMap}*/`;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
cssLookup.set(cssFilename, cssText);
|
|
141
|
+
|
|
142
|
+
return {
|
|
143
|
+
contents,
|
|
144
|
+
loader,
|
|
145
|
+
resolveDir: path.dirname(args.path),
|
|
146
|
+
};
|
|
147
|
+
});
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
}
|