@fulcro/transform-core 0.8.1 → 0.10.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/index.d.ts +5 -0
- package/dist/index.js +11 -1
- package/dist/program/index.d.ts +77 -0
- package/dist/program/index.js +7 -4
- package/dist/rewrite/file/index.d.ts +74 -0
- package/dist/rewrite/file/index.js +124 -0
- package/dist/rewrite/fileTransformer/index.d.ts +10 -0
- package/dist/rewrite/fileTransformer/index.js +131 -0
- package/dist/rewrite/fixpoint/index.d.ts +56 -0
- package/dist/rewrite/fixpoint/index.js +61 -0
- package/dist/rewrite/languageService/index.d.ts +40 -0
- package/dist/rewrite/languageService/index.js +286 -0
- package/dist/rewrite/programTransformer/index.d.ts +44 -0
- package/dist/rewrite/programTransformer/index.js +109 -0
- package/dist/rewrite/text/index.d.ts +64 -0
- package/dist/rewrite/text/index.js +161 -0
- package/dist/unplugin/index.d.mts +11 -0
- package/dist/unplugin/index.mjs +22 -6
- package/package.json +62 -62
package/dist/unplugin/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createUnplugin, } from 'unplugin';
|
|
2
2
|
import { createFileTransformer, } from '../program/index.js';
|
|
3
|
+
import { createRewritingFileTransformer } from '../rewrite/fileTransformer/index.js';
|
|
3
4
|
/**
|
|
4
5
|
* Builds the bundler adapters for one set of rewriters.
|
|
5
6
|
*
|
|
@@ -8,7 +9,25 @@ import { createFileTransformer, } from '../program/index.js';
|
|
|
8
9
|
* in its logs and timings.
|
|
9
10
|
* @returns Every adapter `unplugin` can produce.
|
|
10
11
|
*/
|
|
11
|
-
export const createTransformerUnplugin = (rewriters, name) =>
|
|
12
|
+
export const createTransformerUnplugin = (rewriters, name) => createAdapters((options) => createFileTransformer(rewriters, options), name);
|
|
13
|
+
/**
|
|
14
|
+
* Builds the bundler adapters for a rewrite that happens before type checking
|
|
15
|
+
* — one whose output is what the checker would read, such as the operators of
|
|
16
|
+
* `@fulcro/types`.
|
|
17
|
+
*
|
|
18
|
+
* @param rewriter Rewriter of the package publishing the plugin.
|
|
19
|
+
* @param name Name the plugin reports to the bundler.
|
|
20
|
+
* @returns Every adapter `unplugin` can produce.
|
|
21
|
+
*/
|
|
22
|
+
export const createRewriterUnplugin = (rewriter, name) => createAdapters((options) => createRewritingFileTransformer(rewriter, options), name);
|
|
23
|
+
/**
|
|
24
|
+
* Builds the adapters around whichever core a package uses.
|
|
25
|
+
*
|
|
26
|
+
* @param build Builds the core for a set of options.
|
|
27
|
+
* @param name Name the plugin reports to the bundler.
|
|
28
|
+
* @returns Every adapter `unplugin` can produce.
|
|
29
|
+
*/
|
|
30
|
+
const createAdapters = (build, name) => {
|
|
12
31
|
const unpluginFactory = (options = {}) => {
|
|
13
32
|
let transformer;
|
|
14
33
|
/**
|
|
@@ -18,7 +37,7 @@ export const createTransformerUnplugin = (rewriters, name) => {
|
|
|
18
37
|
* @returns The transformer core.
|
|
19
38
|
*/
|
|
20
39
|
const resolve = () => {
|
|
21
|
-
transformer ??=
|
|
40
|
+
transformer ??= build(options);
|
|
22
41
|
return transformer;
|
|
23
42
|
};
|
|
24
43
|
return {
|
|
@@ -39,10 +58,7 @@ export const createTransformerUnplugin = (rewriters, name) => {
|
|
|
39
58
|
// The root of the bundler wins over the working directory, which
|
|
40
59
|
// is what makes the plugin behave inside a monorepo.
|
|
41
60
|
if (config.root !== undefined && options.root === undefined) {
|
|
42
|
-
transformer =
|
|
43
|
-
...options,
|
|
44
|
-
root: config.root,
|
|
45
|
-
});
|
|
61
|
+
transformer = build({ ...options, root: config.root });
|
|
46
62
|
}
|
|
47
63
|
},
|
|
48
64
|
},
|
package/package.json
CHANGED
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@fulcro/transform-core",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Shared machinery behind the Fulcro compile time transformers. Installed for you; not meant to be depended on directly.",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"typescript",
|
|
7
|
-
"transformer",
|
|
8
|
-
"ts-patch",
|
|
9
|
-
"unplugin",
|
|
10
|
-
"compiler"
|
|
11
|
-
],
|
|
12
|
-
"license": "ISC",
|
|
13
|
-
"author": "diguu <rodrigogeribola@hotmail.com>",
|
|
14
|
-
"main": "./dist/index.js",
|
|
15
|
-
"types": "./dist/index.d.ts",
|
|
16
|
-
"exports": {
|
|
17
|
-
".": {
|
|
18
|
-
"types": "./dist/index.d.ts",
|
|
19
|
-
"default": "./dist/index.js"
|
|
20
|
-
},
|
|
21
|
-
"./unplugin": {
|
|
22
|
-
"types": "./dist/unplugin/index.d.mts",
|
|
23
|
-
"default": "./dist/unplugin/index.mjs"
|
|
24
|
-
},
|
|
25
|
-
"./package.json": "./package.json"
|
|
26
|
-
},
|
|
27
|
-
"files": [
|
|
28
|
-
"dist"
|
|
29
|
-
],
|
|
30
|
-
"sideEffects": false,
|
|
31
|
-
"scripts": {
|
|
32
|
-
"build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
33
|
-
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
34
|
-
"prepublishOnly": "npm run build"
|
|
35
|
-
},
|
|
36
|
-
"dependencies": {
|
|
37
|
-
"unplugin": "^3.3.0"
|
|
38
|
-
},
|
|
39
|
-
"peerDependencies": {
|
|
40
|
-
"typescript": ">=5.3.3 <7"
|
|
41
|
-
},
|
|
42
|
-
"peerDependenciesMeta": {
|
|
43
|
-
"typescript": {
|
|
44
|
-
"optional": true
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
"publishConfig": {
|
|
48
|
-
"access": "public"
|
|
49
|
-
},
|
|
50
|
-
"engines": {
|
|
51
|
-
"node": ">=22"
|
|
52
|
-
},
|
|
53
|
-
"repository": {
|
|
54
|
-
"type": "git",
|
|
55
|
-
"url": "git+https://github.com/DigUu-RL/fulcro.git",
|
|
56
|
-
"directory": "packages/transform-core"
|
|
57
|
-
},
|
|
58
|
-
"homepage": "https://github.com/DigUu-RL/fulcro/tree/main/packages/transform-core#readme",
|
|
59
|
-
"bugs": {
|
|
60
|
-
"url": "https://github.com/DigUu-RL/fulcro/issues"
|
|
61
|
-
}
|
|
62
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@fulcro/transform-core",
|
|
3
|
+
"version": "0.10.0",
|
|
4
|
+
"description": "Shared machinery behind the Fulcro compile time transformers. Installed for you; not meant to be depended on directly.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"typescript",
|
|
7
|
+
"transformer",
|
|
8
|
+
"ts-patch",
|
|
9
|
+
"unplugin",
|
|
10
|
+
"compiler"
|
|
11
|
+
],
|
|
12
|
+
"license": "ISC",
|
|
13
|
+
"author": "diguu <rodrigogeribola@hotmail.com>",
|
|
14
|
+
"main": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"default": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./unplugin": {
|
|
22
|
+
"types": "./dist/unplugin/index.d.mts",
|
|
23
|
+
"default": "./dist/unplugin/index.mjs"
|
|
24
|
+
},
|
|
25
|
+
"./package.json": "./package.json"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"sideEffects": false,
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
33
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
34
|
+
"prepublishOnly": "npm run build"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"unplugin": "^3.3.0"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"typescript": ">=5.3.3 <7"
|
|
41
|
+
},
|
|
42
|
+
"peerDependenciesMeta": {
|
|
43
|
+
"typescript": {
|
|
44
|
+
"optional": true
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public"
|
|
49
|
+
},
|
|
50
|
+
"engines": {
|
|
51
|
+
"node": ">=22"
|
|
52
|
+
},
|
|
53
|
+
"repository": {
|
|
54
|
+
"type": "git",
|
|
55
|
+
"url": "git+https://github.com/DigUu-RL/fulcro.git",
|
|
56
|
+
"directory": "packages/transform-core"
|
|
57
|
+
},
|
|
58
|
+
"homepage": "https://github.com/DigUu-RL/fulcro/tree/main/packages/transform-core#readme",
|
|
59
|
+
"bugs": {
|
|
60
|
+
"url": "https://github.com/DigUu-RL/fulcro/issues"
|
|
61
|
+
}
|
|
62
|
+
}
|