@teambit/compilation.aspect-docs.compiler 0.0.168 → 0.0.169
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/compiler.mdx.js
CHANGED
|
@@ -7,10 +7,10 @@ exports["default"] = MDXContent;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _react2 = require("@mdx-js/react");
|
|
9
9
|
var _excluded = ["components"]; // @ts-nocheck
|
|
10
|
-
function _interopRequireDefault(
|
|
11
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
12
|
-
function _objectWithoutProperties(
|
|
13
|
-
function _objectWithoutPropertiesLoose(
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
12
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
13
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
14
14
|
/* @jsxRuntime classic */
|
|
15
15
|
/* @jsx mdx */
|
|
16
16
|
|
package/dist/compiler.mdx.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_react2","_excluded","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_react2","_excluded","e","__esModule","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","_objectWithoutProperties","o","i","_objectWithoutPropertiesLoose","getOwnPropertySymbols","s","includes","propertyIsEnumerable","layoutProps","MDXLayout","MDXContent","_ref","components","props","mdx","mdxType","parentName","isMDXComponent"],"sourceRoot":"/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.compilation_aspect-docs_compiler@0.0.169","sources":["compiler.mdx.js"],"sourcesContent":["\n// @ts-nocheck\nimport React from 'react'\nimport { mdx } from '@mdx-js/react'\n\n/* @jsxRuntime classic */\n/* @jsx mdx */\n\n\n\n\nconst layoutProps = {\n \n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return <MDXLayout {...layoutProps} {...props} components={components} mdxType=\"MDXLayout\">\n <h2>{`Workspace Configuration`}</h2>\n <p>{`The compiler is configured inside an environment and not directly on the component level.`}</p>\n <h3>{`As a task`}</h3>\n <p>{`A task is running with `}<inlineCode parentName=\"p\">{`bit build`}</inlineCode>{` or during the tag process on the capsules or the workspace (depends on the specific compiler implementation).`}</p>\n <p>{`The env extension should have this compiler extension as a dependency first, then add to the `}<inlineCode parentName=\"p\">{`getBuildPipe()`}</inlineCode>{` array the following: `}<inlineCode parentName=\"p\">{`this.compiler.createTask()`}</inlineCode>{`.`}</p>\n <h3>{`As a command`}</h3>\n <p>{`A command is running on the workspace.`}</p>\n <p>{`To run: `}<inlineCode parentName=\"p\">{`bit compile`}</inlineCode>{`.`}</p>\n <p>{`An example of configuring a compiler in the React env.`}</p>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-jsx\"\n }}>{`/**\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`}</code></pre>\n <h2>{`Compiler Implementation`}</h2>\n <p>{`The compiler is responsible for two processes:`}</p>\n <h3>{`compile during development`}</h3>\n <p>{`This compilation takes place on the workspace and the dists are saved inside the component dir.\nThe provider should implement `}<inlineCode parentName=\"p\">{`transpileFile`}</inlineCode>{` function as follows:`}</p>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-jsx\"\n }}>{`transpileFile: (fileContent: string, options: { componentDir: string, filePath: string }) => Array<{ outputText: string, outputPath: string }> | null;\n`}</code></pre>\n <p>{`In case the compiler receives an unsupported file, it should return null.`}</p>\n <h3>{`compile for build (during the tag command)`}</h3>\n <p>{`This compilation takes place on the isolated capsule.\nThe provider should implement `}<inlineCode parentName=\"p\">{`build`}</inlineCode>{` function which returns the exit-code and the dist dir.\nFrom Compiler interface:`}</p>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-jsx\"\n }}>{`build(context: BuildContext): Promise<BuildResults>;\n`}</code></pre>\n <h2>{`Points to consider when writing a compiler`}</h2>\n <h3>{`Debugging experience on the workspace`}</h3>\n <p>{`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 `}<inlineCode parentName=\"p\">{`sourceRoot`}</inlineCode>{` of the source-map file to the component-dir. As a reminder, this directory is passed to the `}<inlineCode parentName=\"p\">{`transpile()`}</inlineCode>{` method.`}</p>\n <h3>{`Error handling during build process`}</h3>\n <p>{`Without proper error handling, the `}<inlineCode parentName=\"p\">{`build()`}</inlineCode>{` will exit an the first error found. Catch the errors and add them to the `}<inlineCode parentName=\"p\">{`ComponentResult.errors[]`}</inlineCode>{` you return per component.`}</p>\n </MDXLayout>;\n}\n;\nMDXContent.isMDXComponent = true;"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAAmC,IAAAE,SAAA,mBAFnC;AAAA,SAAAH,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,gBAAAA,CAAA;AAAA,SAAAE,SAAA,WAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAA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AG,IAAI","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.compilation_aspect-docs_compiler@0.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.compilation_aspect-docs_compiler@0.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.compilation_aspect-docs_compiler@0.0.169/dist/compiler.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.compilation_aspect-docs_compiler@0.0.169/dist/compiler.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/compilation.aspect-docs.compiler",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.169",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/compilation/aspect-docs/compiler",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.compilation",
|
|
8
8
|
"name": "aspect-docs/compiler",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.169"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"core-js": "^3.0.0",
|
package/dist/tsconfig.json
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"lib": [
|
|
4
|
-
"es2019",
|
|
5
|
-
"DOM",
|
|
6
|
-
"ES6",
|
|
7
|
-
"DOM.Iterable"
|
|
8
|
-
],
|
|
9
|
-
"target": "es2015",
|
|
10
|
-
"module": "CommonJS",
|
|
11
|
-
"jsx": "react",
|
|
12
|
-
"declaration": true,
|
|
13
|
-
"sourceMap": true,
|
|
14
|
-
"experimentalDecorators": true,
|
|
15
|
-
"skipLibCheck": true,
|
|
16
|
-
"moduleResolution": "node",
|
|
17
|
-
"esModuleInterop": true,
|
|
18
|
-
"resolveJsonModule": true,
|
|
19
|
-
"allowJs": true,
|
|
20
|
-
"outDir": "dist"
|
|
21
|
-
},
|
|
22
|
-
"exclude": [
|
|
23
|
-
"artifacts",
|
|
24
|
-
"public",
|
|
25
|
-
"dist",
|
|
26
|
-
"node_modules",
|
|
27
|
-
"package.json",
|
|
28
|
-
"**/*.cjs"
|
|
29
|
-
],
|
|
30
|
-
"include": [
|
|
31
|
-
"**/*",
|
|
32
|
-
"**/*.json"
|
|
33
|
-
]
|
|
34
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"lib": [
|
|
4
|
-
"es2019",
|
|
5
|
-
"DOM",
|
|
6
|
-
"ES6",
|
|
7
|
-
"DOM.Iterable"
|
|
8
|
-
],
|
|
9
|
-
"target": "es2015",
|
|
10
|
-
"module": "CommonJS",
|
|
11
|
-
"jsx": "react",
|
|
12
|
-
"declaration": true,
|
|
13
|
-
"sourceMap": true,
|
|
14
|
-
"experimentalDecorators": true,
|
|
15
|
-
"skipLibCheck": true,
|
|
16
|
-
"moduleResolution": "node",
|
|
17
|
-
"esModuleInterop": true,
|
|
18
|
-
"resolveJsonModule": true,
|
|
19
|
-
"allowJs": true,
|
|
20
|
-
"outDir": "dist"
|
|
21
|
-
},
|
|
22
|
-
"exclude": [
|
|
23
|
-
"artifacts",
|
|
24
|
-
"public",
|
|
25
|
-
"dist",
|
|
26
|
-
"node_modules",
|
|
27
|
-
"package.json",
|
|
28
|
-
"**/*.cjs"
|
|
29
|
-
],
|
|
30
|
-
"include": [
|
|
31
|
-
"**/*",
|
|
32
|
-
"**/*.json"
|
|
33
|
-
]
|
|
34
|
-
}
|