Skip to content

Commit fe0f7c5

Browse files
committed
Got compiler building
1 parent 5bcfcae commit fe0f7c5

39 files changed

+168
-96
lines changed

package-lock.json

Lines changed: 29 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"workspaces": [
1515
"packages/compiler",
1616
"packages/react",
17-
"packages/config",
17+
"packages/shared",
1818
"examples/docusaurus/pokeapi",
1919
"examples/docusaurus/mistral",
2020
"examples/nextra/pokeapi",

packages/compiler/eslint.config.mjs

Lines changed: 4 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,29 @@
11
import { resolve } from "node:path";
22

3-
import { getReactEslintConfig } from "@speakeasy-api/config";
3+
import { getNodeESLintConfig } from "@speakeasy-api/docs-md-shared";
44
import { getDirname } from "cross-dirname";
5-
import globals from "globals";
65

76
const gitignorePath = resolve(getDirname(), "..", "..", ".gitignore");
87

98
export default [
10-
...getReactEslintConfig({
9+
...getNodeESLintConfig({
1110
gitignorePaths: gitignorePath,
1211
rootDir: getDirname(),
1312
entryPoints: {
1413
"eslint.config.mjs": ["default"],
15-
"src/react/index.ts": /.*/,
1614
"src/compiler/compiler.ts": /.*/,
1715
},
18-
ignores: ["src/compiler/data/wasm_exec.js", ".storybook/**/*"],
16+
ignores: ["src/compiler/data/wasm_exec.js"],
1917
restrictedImports: [
2018
{
2119
type: "third-party",
2220
moduleSpecifier: "node:fs",
2321
allowed: [/src\/compiler\/cli\//],
2422
message:
25-
"File system access is only allowed in the CLI wrapper because other code is used in web environments",
26-
},
27-
{
28-
type: "first-party",
29-
filepath: /src\/compiler\//,
30-
allowed: [/src\/compiler\//],
31-
message: "Only compiler code is allowed to import compiler code",
32-
},
33-
{
34-
type: "third-party",
35-
moduleSpecifier: /^node:/,
36-
denied: [/src\/react\//],
37-
message:
38-
"React components run in an environment that doesn't have access to Node.js modules",
39-
},
40-
{
41-
type: "first-party",
42-
filepath: /src\/react/,
43-
allowed: [/src\/react\//],
44-
message: "Only React code is allowed to import React code",
45-
excludeTypeImports: true,
46-
},
47-
{
48-
type: "first-party",
49-
filepath: /src\/react\/components\/([a-zA-Z0-9-_]+)\/.*\.tsx?$/,
50-
allowed: [
51-
/src\/react\/components\/$1\/.*\.tsx?$/,
52-
/src\/react\/index\.tsx?$/,
53-
],
54-
excludeTypeImports: true,
55-
message:
56-
"Reminder: any time a top-level component imports another top-level component, it should be taken in as a runtime value that can be overridden. Use eslint-disable-next-line once there is an overridable property.",
23+
"File system access is only allowed in the CLI wrapper because other code needs to be isomorphic",
5724
},
5825
],
5926
}),
60-
// Since we're a mix of running in both Node.js and React, we override the
61-
// globals set by the React config to include Node.js globals as well.
62-
{
63-
languageOptions: {
64-
globals: { ...globals.browser, ...globals.node },
65-
},
66-
},
67-
// Disable unused exports rule for Storybook files
68-
{
69-
files: ["**/*.stories.{ts,tsx}", ".storybook/*.{ts,tsx}"],
70-
rules: {
71-
"fast-import/no-unused-exports": "off",
72-
},
73-
},
7427
// Disallow console calls in compiler code (use logging.ts functions instead)
7528
{
7629
files: ["src/compiler/**/*.{ts,js,mts,mjs}"],

packages/compiler/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
"dependencies": {
4242
"@codesandbox/sandpack-client": "^2.19.8",
4343
"@codesandbox/sandpack-react": "^2.20.0",
44+
"@speakeasy-api/docs-md-react": "*",
45+
"@speakeasy-api/docs-md-shared": "*",
4446
"arg": "^5.0.2",
4547
"chalk": "^5.3.0",
4648
"change-case": "^5.4.4",

packages/compiler/src/compiler/content/chunks/about.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import type { AboutChunk } from "../../../types/chunk.ts";
1+
import type { AboutChunk } from "@speakeasy-api/docs-md-shared/types";
2+
23
import { getSettings } from "../.././settings.ts";
34
import type { Renderer } from "../..//renderers/base/base.ts";
45
import { debug } from "../../logging.ts";

packages/compiler/src/compiler/content/chunks/globalSecurity.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import type { GlobalSecurityChunk } from "../../../types/chunk.ts";
1+
import type { GlobalSecurityChunk } from "@speakeasy-api/docs-md-shared/types";
2+
23
import { debug } from "../../logging.ts";
34
import type { Renderer } from "../../renderers/base/base.ts";
45
import { getSettings } from "../../settings.ts";

packages/compiler/src/compiler/content/chunks/operation.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import type { OperationChunk } from "../../../types/chunk.ts";
2-
import type { PropertyAnnotations } from "../../../types/shared.ts";
1+
import type { OperationChunk } from "@speakeasy-api/docs-md-shared/types";
2+
import type { PropertyAnnotations } from "@speakeasy-api/docs-md-shared/types";
3+
34
import { assertNever } from "../../../util/assertNever.ts";
45
import type { CodeSampleLanguage } from "../.././settings.ts";
56
import { getSettings } from "../.././settings.ts";

packages/compiler/src/compiler/content/chunks/schema.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import type { ObjectValue, SchemaValue } from "../../../types/chunk.ts";
1+
import type { ObjectValue, SchemaValue } from "@speakeasy-api/docs-md-shared/types";
22
import type {
33
DisplayTypeInfo,
44
PropertyAnnotations,
5-
} from "../../../types/shared.ts";
5+
} from "@speakeasy-api/docs-md-shared/types";
6+
67
import { assertNever } from "../../../util/assertNever.ts";
78
import { InternalError } from "../../../util/internalError.ts";
89
import type { Renderer } from "../..//renderers/base/base.ts";

packages/compiler/src/compiler/content/renderContent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import type { Chunk, TagChunk } from "@speakeasy-api/docs-md-shared/types";
12
import { capitalCase } from "change-case";
23

3-
import type { Chunk, TagChunk } from "../../types/chunk.ts";
44
import { InternalError } from "../../util/internalError.ts";
55
import type { Site } from "..//renderers/base/base.ts";
66
import type { DocsCodeSnippets } from "../data/generateCodeSnippets.ts";

packages/compiler/src/compiler/content/util.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import type { Chunk } from "../../types/chunk.ts";
1+
import type { Chunk } from "@speakeasy-api/docs-md-shared/types";
2+
23
import { InternalError } from "../../util/internalError.ts";
34

45
export function getSecurityFromId(

0 commit comments

Comments
 (0)