@teambit/compilation.aspect-docs.compiler 0.0.0-09b88e96563aa08e063b60dcb468bb0326ca4f34
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/compiler.composition.tsx +12 -0
- package/compiler.docs.mdx +34 -0
- package/compiler.mdx +63 -0
- package/dist/compiler.composition.d.ts +2 -0
- package/dist/compiler.composition.js +15 -0
- package/dist/compiler.composition.js.map +1 -0
- package/dist/compiler.docs.mdx +34 -0
- package/dist/compiler.mdx.js +114 -0
- package/dist/compiler.mdx.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/preview-1779193244761.js +7 -0
- package/index.ts +1 -0
- package/package.json +52 -0
- package/types/asset.d.ts +29 -0
- package/types/style.d.ts +42 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ThemeCompositions } from '@teambit/documenter.theme.theme-compositions';
|
|
3
|
+
import { MDXLayout } from '@teambit/mdx.ui.mdx-layout';
|
|
4
|
+
import { Compiler } from './index';
|
|
5
|
+
|
|
6
|
+
export const CompilerDocs = () => (
|
|
7
|
+
<ThemeCompositions>
|
|
8
|
+
<MDXLayout>
|
|
9
|
+
<Compiler />
|
|
10
|
+
</MDXLayout>
|
|
11
|
+
</ThemeCompositions>
|
|
12
|
+
);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'Docs for Compiler aspect'
|
|
3
|
+
labels: ['docs', 'aspect', 'extensions']
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { Compiler } from './index';
|
|
7
|
+
|
|
8
|
+
## Static Content Page in MDX
|
|
9
|
+
|
|
10
|
+
Docs for Compiler aspect
|
|
11
|
+
|
|
12
|
+
### Component usage
|
|
13
|
+
|
|
14
|
+
Use your component in any mdx file:
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
import { Compiler } from '@teambit/aspect-docs.compiler';
|
|
18
|
+
|
|
19
|
+
<Compiler />;
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Render with theme and MDX providers
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
import { ThemeCompositions } from '@teambit/documenter.theme.theme-compositions';
|
|
26
|
+
import { MDXLayout } from '@teambit/ui.mdx-layout';
|
|
27
|
+
import { Compiler } from '@teambit/aspect-docs.compiler';
|
|
28
|
+
|
|
29
|
+
<ThemeCompositions>
|
|
30
|
+
<MDXLayout>
|
|
31
|
+
<Compiler />
|
|
32
|
+
</MDXLayout>
|
|
33
|
+
</ThemeCompositions>;
|
|
34
|
+
```
|
package/compiler.mdx
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
## Workspace Configuration
|
|
2
|
+
|
|
3
|
+
The compiler is configured inside an environment and not directly on the component level.
|
|
4
|
+
|
|
5
|
+
### As a task
|
|
6
|
+
|
|
7
|
+
A task is running with `bit build` or during the tag process on the capsules or the workspace (depends on the specific compiler implementation).
|
|
8
|
+
|
|
9
|
+
The env extension should have this compiler extension as a dependency first, then add to the `getBuildPipe()` array the following: `this.compiler.createTask()`.
|
|
10
|
+
|
|
11
|
+
### As a command
|
|
12
|
+
|
|
13
|
+
A command is running on the workspace.
|
|
14
|
+
|
|
15
|
+
To run: `bit compile`.
|
|
16
|
+
|
|
17
|
+
An example of configuring a compiler in the React env.
|
|
18
|
+
|
|
19
|
+
```jsx
|
|
20
|
+
/**
|
|
21
|
+
* returns a component compiler.
|
|
22
|
+
*/
|
|
23
|
+
getCompiler(): Compiler {
|
|
24
|
+
// eslint-disable-next-line global-require
|
|
25
|
+
const tsConfig = require('./typescript/tsconfig.json');
|
|
26
|
+
return this.ts.createCompiler(tsConfig);
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Compiler Implementation
|
|
31
|
+
|
|
32
|
+
The compiler is responsible for two processes:
|
|
33
|
+
|
|
34
|
+
### compile during development
|
|
35
|
+
|
|
36
|
+
This compilation takes place on the workspace and the dists are saved inside the component dir.
|
|
37
|
+
The provider should implement `transpileFile` function as follows:
|
|
38
|
+
|
|
39
|
+
```jsx
|
|
40
|
+
transpileFile: (fileContent: string, options: { componentDir: string, filePath: string }) => Array<{ outputText: string, outputPath: string }> | null;
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
In case the compiler receives an unsupported file, it should return null.
|
|
44
|
+
|
|
45
|
+
### compile for build (during the tag command)
|
|
46
|
+
|
|
47
|
+
This compilation takes place on the isolated capsule.
|
|
48
|
+
The provider should implement `build` function which returns the exit-code and the dist dir.
|
|
49
|
+
From Compiler interface:
|
|
50
|
+
|
|
51
|
+
```jsx
|
|
52
|
+
build(context: BuildContext): Promise<BuildResults>;
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Points to consider when writing a compiler
|
|
56
|
+
|
|
57
|
+
### Debugging experience on the workspace
|
|
58
|
+
|
|
59
|
+
Since the dists are written into the node_modules/component-name/dist-dir, the debugger needs to know where to find the source files. This can be easily achieved by setting the `sourceRoot` of the source-map file to the component-dir. As a reminder, this directory is passed to the `transpile()` method.
|
|
60
|
+
|
|
61
|
+
### Error handling during build process
|
|
62
|
+
|
|
63
|
+
Without proper error handling, the `build()` will exit an the first error found. Catch the errors and add them to the `ComponentResult.errors[]` you return per component.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CompilerDocs = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const documenter_theme_theme_compositions_1 = require("@teambit/documenter.theme.theme-compositions");
|
|
9
|
+
const mdx_ui_mdx_layout_1 = require("@teambit/mdx.ui.mdx-layout");
|
|
10
|
+
const index_1 = require("./index");
|
|
11
|
+
const CompilerDocs = () => (react_1.default.createElement(documenter_theme_theme_compositions_1.ThemeCompositions, null,
|
|
12
|
+
react_1.default.createElement(mdx_ui_mdx_layout_1.MDXLayout, null,
|
|
13
|
+
react_1.default.createElement(index_1.Compiler, null))));
|
|
14
|
+
exports.CompilerDocs = CompilerDocs;
|
|
15
|
+
//# sourceMappingURL=compiler.composition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiler.composition.js","sourceRoot":"","sources":["../compiler.composition.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,sGAAiF;AACjF,kEAAuD;AACvD,mCAAmC;AAE5B,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,CAChC,8BAAC,uDAAiB;IAChB,8BAAC,6BAAS;QACR,8BAAC,gBAAQ,OAAG,CACF,CACM,CACrB,CAAC;AANW,QAAA,YAAY,gBAMvB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'Docs for Compiler aspect'
|
|
3
|
+
labels: ['docs', 'aspect', 'extensions']
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { Compiler } from './index';
|
|
7
|
+
|
|
8
|
+
## Static Content Page in MDX
|
|
9
|
+
|
|
10
|
+
Docs for Compiler aspect
|
|
11
|
+
|
|
12
|
+
### Component usage
|
|
13
|
+
|
|
14
|
+
Use your component in any mdx file:
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
import { Compiler } from '@teambit/aspect-docs.compiler';
|
|
18
|
+
|
|
19
|
+
<Compiler />;
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Render with theme and MDX providers
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
import { ThemeCompositions } from '@teambit/documenter.theme.theme-compositions';
|
|
26
|
+
import { MDXLayout } from '@teambit/ui.mdx-layout';
|
|
27
|
+
import { Compiler } from '@teambit/aspect-docs.compiler';
|
|
28
|
+
|
|
29
|
+
<ThemeCompositions>
|
|
30
|
+
<MDXLayout>
|
|
31
|
+
<Compiler />
|
|
32
|
+
</MDXLayout>
|
|
33
|
+
</ThemeCompositions>;
|
|
34
|
+
```
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = MDXContent;
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
var _react = require("@mdx-js/react");
|
|
9
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
10
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
14
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
|
+
MDXContent.isMDXComponent = true;
|
|
16
|
+
function _createMdxContent(props) {
|
|
17
|
+
var _components = _objectSpread(_objectSpread({
|
|
18
|
+
code: "code",
|
|
19
|
+
h2: "h2",
|
|
20
|
+
h3: "h3",
|
|
21
|
+
p: "p",
|
|
22
|
+
pre: "pre"
|
|
23
|
+
}, (0, _react.useMDXComponents)()), props.components);
|
|
24
|
+
return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
25
|
+
children: [(0, _jsxRuntime.jsx)(_components.h2, {
|
|
26
|
+
children: "Workspace Configuration"
|
|
27
|
+
}), "\n", (0, _jsxRuntime.jsx)(_components.p, {
|
|
28
|
+
children: "The compiler is configured inside an environment and not directly on the component level."
|
|
29
|
+
}), "\n", (0, _jsxRuntime.jsx)(_components.h3, {
|
|
30
|
+
children: "As a task"
|
|
31
|
+
}), "\n", (0, _jsxRuntime.jsxs)(_components.p, {
|
|
32
|
+
children: ["A task is running with ", (0, _jsxRuntime.jsx)(_components.code, {
|
|
33
|
+
children: "bit build"
|
|
34
|
+
}), " or during the tag process on the capsules or the workspace (depends on the specific compiler implementation)."]
|
|
35
|
+
}), "\n", (0, _jsxRuntime.jsxs)(_components.p, {
|
|
36
|
+
children: ["The env extension should have this compiler extension as a dependency first, then add to the ", (0, _jsxRuntime.jsx)(_components.code, {
|
|
37
|
+
children: "getBuildPipe()"
|
|
38
|
+
}), " array the following: ", (0, _jsxRuntime.jsx)(_components.code, {
|
|
39
|
+
children: "this.compiler.createTask()"
|
|
40
|
+
}), "."]
|
|
41
|
+
}), "\n", (0, _jsxRuntime.jsx)(_components.h3, {
|
|
42
|
+
children: "As a command"
|
|
43
|
+
}), "\n", (0, _jsxRuntime.jsx)(_components.p, {
|
|
44
|
+
children: "A command is running on the workspace."
|
|
45
|
+
}), "\n", (0, _jsxRuntime.jsxs)(_components.p, {
|
|
46
|
+
children: ["To run: ", (0, _jsxRuntime.jsx)(_components.code, {
|
|
47
|
+
children: "bit compile"
|
|
48
|
+
}), "."]
|
|
49
|
+
}), "\n", (0, _jsxRuntime.jsx)(_components.p, {
|
|
50
|
+
children: "An example of configuring a compiler in the React env."
|
|
51
|
+
}), "\n", (0, _jsxRuntime.jsx)(_components.pre, {
|
|
52
|
+
children: (0, _jsxRuntime.jsx)(_components.code, {
|
|
53
|
+
className: "language-jsx",
|
|
54
|
+
children: "/**\n * returns a component compiler.\n */\ngetCompiler(): Compiler {\n // eslint-disable-next-line global-require\n const tsConfig = require('./typescript/tsconfig.json');\n return this.ts.createCompiler(tsConfig);\n}\n"
|
|
55
|
+
})
|
|
56
|
+
}), "\n", (0, _jsxRuntime.jsx)(_components.h2, {
|
|
57
|
+
children: "Compiler Implementation"
|
|
58
|
+
}), "\n", (0, _jsxRuntime.jsx)(_components.p, {
|
|
59
|
+
children: "The compiler is responsible for two processes:"
|
|
60
|
+
}), "\n", (0, _jsxRuntime.jsx)(_components.h3, {
|
|
61
|
+
children: "compile during development"
|
|
62
|
+
}), "\n", (0, _jsxRuntime.jsxs)(_components.p, {
|
|
63
|
+
children: ["This compilation takes place on the workspace and the dists are saved inside the component dir.\nThe provider should implement ", (0, _jsxRuntime.jsx)(_components.code, {
|
|
64
|
+
children: "transpileFile"
|
|
65
|
+
}), " function as follows:"]
|
|
66
|
+
}), "\n", (0, _jsxRuntime.jsx)(_components.pre, {
|
|
67
|
+
children: (0, _jsxRuntime.jsx)(_components.code, {
|
|
68
|
+
className: "language-jsx",
|
|
69
|
+
children: "transpileFile: (fileContent: string, options: { componentDir: string, filePath: string }) => Array<{ outputText: string, outputPath: string }> | null;\n"
|
|
70
|
+
})
|
|
71
|
+
}), "\n", (0, _jsxRuntime.jsx)(_components.p, {
|
|
72
|
+
children: "In case the compiler receives an unsupported file, it should return null."
|
|
73
|
+
}), "\n", (0, _jsxRuntime.jsx)(_components.h3, {
|
|
74
|
+
children: "compile for build (during the tag command)"
|
|
75
|
+
}), "\n", (0, _jsxRuntime.jsxs)(_components.p, {
|
|
76
|
+
children: ["This compilation takes place on the isolated capsule.\nThe provider should implement ", (0, _jsxRuntime.jsx)(_components.code, {
|
|
77
|
+
children: "build"
|
|
78
|
+
}), " function which returns the exit-code and the dist dir.\nFrom Compiler interface:"]
|
|
79
|
+
}), "\n", (0, _jsxRuntime.jsx)(_components.pre, {
|
|
80
|
+
children: (0, _jsxRuntime.jsx)(_components.code, {
|
|
81
|
+
className: "language-jsx",
|
|
82
|
+
children: "build(context: BuildContext): Promise<BuildResults>;\n"
|
|
83
|
+
})
|
|
84
|
+
}), "\n", (0, _jsxRuntime.jsx)(_components.h2, {
|
|
85
|
+
children: "Points to consider when writing a compiler"
|
|
86
|
+
}), "\n", (0, _jsxRuntime.jsx)(_components.h3, {
|
|
87
|
+
children: "Debugging experience on the workspace"
|
|
88
|
+
}), "\n", (0, _jsxRuntime.jsxs)(_components.p, {
|
|
89
|
+
children: ["Since the dists are written into the node_modules/component-name/dist-dir, the debugger needs to know where to find the source files. This can be easily achieved by setting the ", (0, _jsxRuntime.jsx)(_components.code, {
|
|
90
|
+
children: "sourceRoot"
|
|
91
|
+
}), " of the source-map file to the component-dir. As a reminder, this directory is passed to the ", (0, _jsxRuntime.jsx)(_components.code, {
|
|
92
|
+
children: "transpile()"
|
|
93
|
+
}), " method."]
|
|
94
|
+
}), "\n", (0, _jsxRuntime.jsx)(_components.h3, {
|
|
95
|
+
children: "Error handling during build process"
|
|
96
|
+
}), "\n", (0, _jsxRuntime.jsxs)(_components.p, {
|
|
97
|
+
children: ["Without proper error handling, the ", (0, _jsxRuntime.jsx)(_components.code, {
|
|
98
|
+
children: "build()"
|
|
99
|
+
}), " will exit an the first error found. Catch the errors and add them to the ", (0, _jsxRuntime.jsx)(_components.code, {
|
|
100
|
+
children: "ComponentResult.errors[]"
|
|
101
|
+
}), " you return per component."]
|
|
102
|
+
})]
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
function MDXContent() {
|
|
106
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
107
|
+
var _provideComponents$pr = _objectSpread(_objectSpread({}, (0, _react.useMDXComponents)()), props.components),
|
|
108
|
+
MDXLayout = _provideComponents$pr.wrapper;
|
|
109
|
+
return MDXLayout ? (0, _jsxRuntime.jsx)(MDXLayout, _objectSpread(_objectSpread({}, props), {}, {
|
|
110
|
+
children: (0, _jsxRuntime.jsx)(_createMdxContent, _objectSpread({}, props))
|
|
111
|
+
})) : _createMdxContent(props);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
//# sourceMappingURL=compiler.mdx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_jsxRuntime","require","_react","_typeof","o","Symbol","iterator","constructor","prototype","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","toPrimitive","call","TypeError","String","Number","MDXContent","isMDXComponent","_createMdxContent","props","_components","code","h2","h3","p","pre","_provideComponents","components","_jsxs","_Fragment","children","_jsx","className","undefined","_provideComponents$pr","MDXLayout","wrapper"],"sourceRoot":"/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.compilation_aspect-docs_compiler@09b88e96563aa08e063b60dcb468bb0326ca4f34","sources":["compiler.mdx.js"],"sourcesContent":["MDXContent.isMDXComponent = true;\nimport {Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs} from \"react/jsx-runtime\";\nimport {useMDXComponents as _provideComponents} from \"@mdx-js/react\";\nfunction _createMdxContent(props) {\n const _components = {\n code: \"code\",\n h2: \"h2\",\n h3: \"h3\",\n p: \"p\",\n pre: \"pre\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsxs(_Fragment, {\n children: [_jsx(_components.h2, {\n children: \"Workspace Configuration\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"The compiler is configured inside an environment and not directly on the component level.\"\n }), \"\\n\", _jsx(_components.h3, {\n children: \"As a task\"\n }), \"\\n\", _jsxs(_components.p, {\n children: [\"A task is running with \", _jsx(_components.code, {\n children: \"bit build\"\n }), \" or during the tag process on the capsules or the workspace (depends on the specific compiler implementation).\"]\n }), \"\\n\", _jsxs(_components.p, {\n children: [\"The env extension should have this compiler extension as a dependency first, then add to the \", _jsx(_components.code, {\n children: \"getBuildPipe()\"\n }), \" array the following: \", _jsx(_components.code, {\n children: \"this.compiler.createTask()\"\n }), \".\"]\n }), \"\\n\", _jsx(_components.h3, {\n children: \"As a command\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"A command is running on the workspace.\"\n }), \"\\n\", _jsxs(_components.p, {\n children: [\"To run: \", _jsx(_components.code, {\n children: \"bit compile\"\n }), \".\"]\n }), \"\\n\", _jsx(_components.p, {\n children: \"An example of configuring a compiler in the React env.\"\n }), \"\\n\", _jsx(_components.pre, {\n children: _jsx(_components.code, {\n className: \"language-jsx\",\n children: \"/**\\n * returns a component compiler.\\n */\\ngetCompiler(): Compiler {\\n // eslint-disable-next-line global-require\\n const tsConfig = require('./typescript/tsconfig.json');\\n return this.ts.createCompiler(tsConfig);\\n}\\n\"\n })\n }), \"\\n\", _jsx(_components.h2, {\n children: \"Compiler Implementation\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"The compiler is responsible for two processes:\"\n }), \"\\n\", _jsx(_components.h3, {\n children: \"compile during development\"\n }), \"\\n\", _jsxs(_components.p, {\n children: [\"This compilation takes place on the workspace and the dists are saved inside the component dir.\\nThe provider should implement \", _jsx(_components.code, {\n children: \"transpileFile\"\n }), \" function as follows:\"]\n }), \"\\n\", _jsx(_components.pre, {\n children: _jsx(_components.code, {\n className: \"language-jsx\",\n children: \"transpileFile: (fileContent: string, options: { componentDir: string, filePath: string }) => Array<{ outputText: string, outputPath: string }> | null;\\n\"\n })\n }), \"\\n\", _jsx(_components.p, {\n children: \"In case the compiler receives an unsupported file, it should return null.\"\n }), \"\\n\", _jsx(_components.h3, {\n children: \"compile for build (during the tag command)\"\n }), \"\\n\", _jsxs(_components.p, {\n children: [\"This compilation takes place on the isolated capsule.\\nThe provider should implement \", _jsx(_components.code, {\n children: \"build\"\n }), \" function which returns the exit-code and the dist dir.\\nFrom Compiler interface:\"]\n }), \"\\n\", _jsx(_components.pre, {\n children: _jsx(_components.code, {\n className: \"language-jsx\",\n children: \"build(context: BuildContext): Promise<BuildResults>;\\n\"\n })\n }), \"\\n\", _jsx(_components.h2, {\n children: \"Points to consider when writing a compiler\"\n }), \"\\n\", _jsx(_components.h3, {\n children: \"Debugging experience on the workspace\"\n }), \"\\n\", _jsxs(_components.p, {\n children: [\"Since the dists are written into the node_modules/component-name/dist-dir, the debugger needs to know where to find the source files. This can be easily achieved by setting the \", _jsx(_components.code, {\n children: \"sourceRoot\"\n }), \" of the source-map file to the component-dir. As a reminder, this directory is passed to the \", _jsx(_components.code, {\n children: \"transpile()\"\n }), \" method.\"]\n }), \"\\n\", _jsx(_components.h3, {\n children: \"Error handling during build process\"\n }), \"\\n\", _jsxs(_components.p, {\n children: [\"Without proper error handling, the \", _jsx(_components.code, {\n children: \"build()\"\n }), \" will exit an the first error found. Catch the errors and add them to the \", _jsx(_components.code, {\n children: \"ComponentResult.errors[]\"\n }), \" you return per component.\"]\n })]\n });\n}\nexport default function MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\n"],"mappings":";;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAAqE,SAAAE,QAAAC,CAAA,sCAAAD,OAAA,wBAAAE,MAAA,uBAAAA,MAAA,CAAA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;IAClC,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ;AACe,SAASd,UAAUA,CAAA,EAAa;EAAA,IAAZG,KAAK,GAAArB,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAmC,SAAA,GAAAnC,SAAA,MAAG,CAAC,CAAC;EAC3C,IAAAoC,qBAAA,GAAArC,aAAA,CAAAA,aAAA,KACK,IAAA6B,uBAAkB,EAAC,CAAC,GACpBP,KAAK,CAACQ,UAAU;IAFLQ,SAAS,GAAAD,qBAAA,CAAlBE,OAAO;EAId,OAAOD,SAAS,GAAG,IAAAJ,eAAI,EAACI,SAAS,EAAAtC,aAAA,CAAAA,aAAA,KAC5BsB,KAAK;IACRW,QAAQ,EAAE,IAAAC,eAAI,EAACb,iBAAiB,EAAArB,aAAA,KAC3BsB,KAAK,CACT;EAAC,EACH,CAAC,GAAGD,iBAAiB,CAACC,KAAK,CAAC;AAC/B","ignoreList":[]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Compiler } from './compiler.mdx';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Compiler = void 0;
|
|
7
|
+
var compiler_mdx_1 = require("./compiler.mdx");
|
|
8
|
+
Object.defineProperty(exports, "Compiler", { enumerable: true, get: function () { return __importDefault(compiler_mdx_1).default; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;AAAA,+CAAqD;AAA5C,yHAAA,OAAO,OAAY"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.compilation_aspect-docs_compiler@09b88e96563aa08e063b60dcb468bb0326ca4f34/dist/compiler.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.compilation_aspect-docs_compiler@09b88e96563aa08e063b60dcb468bb0326ca4f34/dist/compiler.docs.mdx';
|
|
3
|
+
|
|
4
|
+
export const compositions = [compositions_0];
|
|
5
|
+
export const overview = [overview_0];
|
|
6
|
+
|
|
7
|
+
export const compositions_metadata = {"compositions":[{"displayName":"Compiler docs","identifier":"CompilerDocs"}]};
|
package/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Compiler } from './compiler.mdx';
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@teambit/compilation.aspect-docs.compiler",
|
|
3
|
+
"version": "0.0.0-09b88e96563aa08e063b60dcb468bb0326ca4f34",
|
|
4
|
+
"homepage": "https://bit.cloud/teambit/compilation/aspect-docs/compiler",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"componentId": {
|
|
7
|
+
"scope": "teambit.compilation",
|
|
8
|
+
"name": "aspect-docs/compiler",
|
|
9
|
+
"version": "09b88e96563aa08e063b60dcb468bb0326ca4f34"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"core-js": "^3.0.0",
|
|
13
|
+
"@mdx-js/react": "1.6.22",
|
|
14
|
+
"@teambit/mdx.ui.mdx-scope-context": "1.0.0"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@types/react": "^19.0.0",
|
|
18
|
+
"@types/mocha": "9.1.0",
|
|
19
|
+
"@types/node": "12.20.4",
|
|
20
|
+
"@types/react-dom": "^19.0.0",
|
|
21
|
+
"@types/jest": "^26.0.0",
|
|
22
|
+
"@babel/runtime": "7.20.0",
|
|
23
|
+
"@types/testing-library__jest-dom": "5.9.5",
|
|
24
|
+
"@teambit/documenter.theme.theme-compositions": "4.1.5",
|
|
25
|
+
"@teambit/mdx.ui.mdx-layout": "1.0.12"
|
|
26
|
+
},
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
29
|
+
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
30
|
+
},
|
|
31
|
+
"license": "Apache-2.0",
|
|
32
|
+
"optionalDependencies": {},
|
|
33
|
+
"peerDependenciesMeta": {},
|
|
34
|
+
"private": false,
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=12.22.0"
|
|
37
|
+
},
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "https://github.com/teambit/bit"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"bit",
|
|
44
|
+
"components",
|
|
45
|
+
"collaboration",
|
|
46
|
+
"web",
|
|
47
|
+
"react",
|
|
48
|
+
"react-components",
|
|
49
|
+
"angular",
|
|
50
|
+
"angular-components"
|
|
51
|
+
]
|
|
52
|
+
}
|
package/types/asset.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
declare module '*.png' {
|
|
2
|
+
const value: any;
|
|
3
|
+
export = value;
|
|
4
|
+
}
|
|
5
|
+
declare module '*.svg' {
|
|
6
|
+
import type { FunctionComponent, SVGProps } from 'react';
|
|
7
|
+
|
|
8
|
+
export const ReactComponent: FunctionComponent<SVGProps<SVGSVGElement> & { title?: string }>;
|
|
9
|
+
const src: string;
|
|
10
|
+
export default src;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// @TODO Gilad
|
|
14
|
+
declare module '*.jpg' {
|
|
15
|
+
const value: any;
|
|
16
|
+
export = value;
|
|
17
|
+
}
|
|
18
|
+
declare module '*.jpeg' {
|
|
19
|
+
const value: any;
|
|
20
|
+
export = value;
|
|
21
|
+
}
|
|
22
|
+
declare module '*.gif' {
|
|
23
|
+
const value: any;
|
|
24
|
+
export = value;
|
|
25
|
+
}
|
|
26
|
+
declare module '*.bmp' {
|
|
27
|
+
const value: any;
|
|
28
|
+
export = value;
|
|
29
|
+
}
|
package/types/style.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
declare module '*.module.css' {
|
|
2
|
+
const classes: { readonly [key: string]: string };
|
|
3
|
+
export default classes;
|
|
4
|
+
}
|
|
5
|
+
declare module '*.module.scss' {
|
|
6
|
+
const classes: { readonly [key: string]: string };
|
|
7
|
+
export default classes;
|
|
8
|
+
}
|
|
9
|
+
declare module '*.module.sass' {
|
|
10
|
+
const classes: { readonly [key: string]: string };
|
|
11
|
+
export default classes;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare module '*.module.less' {
|
|
15
|
+
const classes: { readonly [key: string]: string };
|
|
16
|
+
export default classes;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare module '*.less' {
|
|
20
|
+
const classes: { readonly [key: string]: string };
|
|
21
|
+
export default classes;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare module '*.css' {
|
|
25
|
+
const classes: { readonly [key: string]: string };
|
|
26
|
+
export default classes;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare module '*.sass' {
|
|
30
|
+
const classes: { readonly [key: string]: string };
|
|
31
|
+
export default classes;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare module '*.scss' {
|
|
35
|
+
const classes: { readonly [key: string]: string };
|
|
36
|
+
export default classes;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare module '*.mdx' {
|
|
40
|
+
const component: any;
|
|
41
|
+
export default component;
|
|
42
|
+
}
|