@codepress/codepress-engine 0.4.0-dev.tsc.20251014070419 → 0.4.0-dev.tsc.20251015042406
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/README.md +90 -64
- package/dist/index.d.ts +1 -7
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/dist/swc/index.d.ts +2 -3
- package/dist/swc/index.js.map +1 -1
- package/dist/types.d.ts +4 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +1 -1
- package/swc/codepress_engine.v0_82_87.wasm +0 -0
- package/swc/codepress_engine.v26.wasm +0 -0
- package/swc/codepress_engine.v42.wasm +0 -0
- package/swc/index.js +4 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## CodePress Engine
|
|
2
2
|
|
|
3
|
-
TypeScript-powered instrumentation for the CodePress visual editor. The package ships a Babel plugin, SWC
|
|
3
|
+
TypeScript-powered instrumentation for the CodePress visual editor. The package ships a Babel plugin, SWC plugin, development server, and CLI so React or Next.js projects can expose file-level context to the editor.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -20,26 +20,80 @@ TypeScript-powered instrumentation for the CodePress visual editor. The package
|
|
|
20
20
|
npm install @codepress/codepress-engine
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
+
## SWC plugin (Next.js) usage
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
// next.config.mjs (Next.js 14/15)
|
|
27
|
+
import { createSWCPlugin } from "@codepress/codepress-engine/swc";
|
|
28
|
+
|
|
29
|
+
const nextConfig = {
|
|
30
|
+
experimental: {
|
|
31
|
+
swcPlugins: [
|
|
32
|
+
// Auto-detects repo/branch; no options required
|
|
33
|
+
createSWCPlugin(),
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default nextConfig;
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Note: When using ESM (`next.config.mjs`), prefer the named import above due to CJS interop. For CommonJS configs you can use:
|
|
42
|
+
|
|
43
|
+
```js
|
|
44
|
+
// next.config.cjs
|
|
45
|
+
const { createSWCPlugin } = require("@codepress/codepress-engine/swc");
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The SWC plugin auto-detects your repository and branch from `git` and common CI env vars. WASM selection is automatic based on your Next.js / `@swc/core` version; see the WASM exports below for manual overrides.
|
|
49
|
+
|
|
50
|
+
Optional options for `createSWCPlugin` (all are optional; omit to use auto-detection):
|
|
51
|
+
|
|
52
|
+
| Option | Type | Default | Purpose |
|
|
53
|
+
| ------------- | ------ | ------------------------------- | ---------------------------------------- |
|
|
54
|
+
| `repo_name` | string | auto-detected from `git remote` | Force repository id in `owner/repo` form |
|
|
55
|
+
| `branch_name` | string | auto-detected from env/`git` | Force branch name |
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Babel plugin usage
|
|
60
|
+
|
|
61
|
+
```js
|
|
62
|
+
// babel.config.mjs
|
|
63
|
+
export default {
|
|
64
|
+
plugins: ["@codepress/codepress-engine"],
|
|
65
|
+
};
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Each JSX element receives a `codepress-data-fp` attribute whose value encodes the relative path and start/end line numbers. On the first root container (`html`, `body`, or `div`), the plugin also injects repository and branch metadata.
|
|
69
|
+
|
|
70
|
+
Optional options for the Babel plugin (all are optional; omit to use auto-detection):
|
|
71
|
+
|
|
72
|
+
| Option | Type | Default | Purpose |
|
|
73
|
+
| ------------- | ------ | ------------------------------- | ---------------------------------------- |
|
|
74
|
+
| `repo_name` | string | auto-detected from `git remote` | Force repository id in `owner/repo` form |
|
|
75
|
+
| `branch_name` | string | auto-detected from env/`git` | Force branch name |
|
|
76
|
+
|
|
23
77
|
Entry points exposed by the package:
|
|
24
78
|
|
|
25
|
-
| Export | Description
|
|
26
|
-
| ------------------------------------ |
|
|
27
|
-
| `@codepress/codepress-engine/babel` | Compiled Babel plugin (CommonJS)
|
|
28
|
-
| `@codepress/codepress-engine/swc` | SWC
|
|
29
|
-
| `@codepress/codepress-engine/server` | Fastify development server factory
|
|
30
|
-
| `@codepress/codepress-engine/cli` | CLI used by the `codepress` binary
|
|
79
|
+
| Export | Description |
|
|
80
|
+
| ------------------------------------ | ---------------------------------- |
|
|
81
|
+
| `@codepress/codepress-engine/babel` | Compiled Babel plugin (CommonJS) |
|
|
82
|
+
| `@codepress/codepress-engine/swc` | SWC plugin factory & WASM helpers |
|
|
83
|
+
| `@codepress/codepress-engine/server` | Fastify development server factory |
|
|
84
|
+
| `@codepress/codepress-engine/cli` | CLI used by the `codepress` binary |
|
|
31
85
|
|
|
32
86
|
---
|
|
33
87
|
|
|
34
88
|
## Project layout
|
|
35
89
|
|
|
36
|
-
| Path | Details
|
|
37
|
-
| ----------------- |
|
|
38
|
-
| `src/` | TypeScript sources for the Babel plugin, CLI, dev server, and utils
|
|
39
|
-
| `dist/` | Compiled JavaScript + declaration files (`npm run build`)
|
|
40
|
-
| `babel/` | Lightweight proxy that re-exports the compiled Babel plugin
|
|
41
|
-
| `swc/` | WASM binaries (`wasm-v42`, `wasm-v26`, `wasm-v0_82_87`) and
|
|
42
|
-
| `tests/`, `test/` | Jest suites covering Babel, SWC, and server helpers
|
|
90
|
+
| Path | Details |
|
|
91
|
+
| ----------------- | ------------------------------------------------------------------------ |
|
|
92
|
+
| `src/` | TypeScript sources for the Babel plugin, CLI, dev server, and utils |
|
|
93
|
+
| `dist/` | Compiled JavaScript + declaration files (`npm run build`) |
|
|
94
|
+
| `babel/` | Lightweight proxy that re-exports the compiled Babel plugin |
|
|
95
|
+
| `swc/` | WASM binaries (`wasm-v42`, `wasm-v26`, `wasm-v0_82_87`) and plugin entry |
|
|
96
|
+
| `tests/`, `test/` | Jest suites covering Babel, SWC, and server helpers |
|
|
43
97
|
|
|
44
98
|
---
|
|
45
99
|
|
|
@@ -60,23 +114,35 @@ The build step must run before publishing or linking locally because Babel and C
|
|
|
60
114
|
|
|
61
115
|
---
|
|
62
116
|
|
|
63
|
-
##
|
|
117
|
+
## Local development
|
|
118
|
+
|
|
119
|
+
Run the local CodePress server alongside your app to visually edit code on disk (no GitHub commits):
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# npm
|
|
123
|
+
npx codepress && npm start
|
|
124
|
+
|
|
125
|
+
# pnpm
|
|
126
|
+
pnpm dlx codepress && pnpm start
|
|
127
|
+
|
|
128
|
+
# yarn
|
|
129
|
+
yarn dlx codepress && yarn start
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Useful commands:
|
|
64
133
|
|
|
65
134
|
```bash
|
|
66
135
|
# Show available commands
|
|
67
136
|
npx codepress help
|
|
68
137
|
|
|
69
|
-
# Launch the
|
|
138
|
+
# Launch the server explicitly on port 4321
|
|
70
139
|
npx codepress server
|
|
71
140
|
|
|
72
|
-
# Scaffold .env entries
|
|
141
|
+
# Scaffold .env entries required by the server
|
|
73
142
|
npx codepress setup
|
|
74
|
-
|
|
75
|
-
# Run your own command with the dev server in the background
|
|
76
|
-
npx codepress npm start
|
|
77
143
|
```
|
|
78
144
|
|
|
79
|
-
Environment variables (
|
|
145
|
+
Environment variables (from `.env` when present):
|
|
80
146
|
|
|
81
147
|
| Variable | Default | Purpose |
|
|
82
148
|
| ------------------------ | ----------- | -------------------------------------------- |
|
|
@@ -85,51 +151,11 @@ Environment variables (loaded from `.env` when present):
|
|
|
85
151
|
| `CODEPRESS_BACKEND_PORT` | `8007` | Backend REST port |
|
|
86
152
|
| `CODEPRESS_API_TOKEN` | _unset_ | API token used for authenticated proxy calls |
|
|
87
153
|
|
|
88
|
-
The server performs git-aware writes
|
|
154
|
+
The server performs git-aware writes and enriches responses with repository metadata. It writes changes to your local filesystem and is not used in production builds.
|
|
89
155
|
|
|
90
156
|
---
|
|
91
157
|
|
|
92
|
-
##
|
|
93
|
-
|
|
94
|
-
```js
|
|
95
|
-
// babel.config.js
|
|
96
|
-
module.exports = {
|
|
97
|
-
plugins: [
|
|
98
|
-
[
|
|
99
|
-
"@codepress/codepress-engine",
|
|
100
|
-
{
|
|
101
|
-
attributeName: "codepress-data-fp",
|
|
102
|
-
repoAttributeName: "codepress-github-repo-name",
|
|
103
|
-
branchAttributeName: "codepress-github-branch",
|
|
104
|
-
},
|
|
105
|
-
],
|
|
106
|
-
],
|
|
107
|
-
};
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
Each JSX element receives a `codepress-data-fp` attribute whose value encodes the relative path and start/end line numbers. Repository and branch metadata are attached to container elements (`html`, `body`, `div`) to help the visual editor route updates.
|
|
111
|
-
|
|
112
|
-
---
|
|
113
|
-
|
|
114
|
-
## SWC transform usage
|
|
115
|
-
|
|
116
|
-
```js
|
|
117
|
-
const {
|
|
118
|
-
transformWithCodePress,
|
|
119
|
-
} = require("@codepress/codepress-engine/swc-plugin");
|
|
120
|
-
|
|
121
|
-
async function transform(source, filePath) {
|
|
122
|
-
const result = await transformWithCodePress(source, filePath, {
|
|
123
|
-
attributeName: "codepress-data-fp",
|
|
124
|
-
repoAttributeName: "codepress-github-repo-name",
|
|
125
|
-
branchAttributeName: "codepress-github-branch",
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
return result.code;
|
|
129
|
-
}
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
`package.json` exports:
|
|
158
|
+
## SWC package exports and WASM selection
|
|
133
159
|
|
|
134
160
|
| Export | Target |
|
|
135
161
|
| --------------------- | -------------------------------------- |
|
|
@@ -145,7 +171,7 @@ The helper automatically selects the correct WASM binary based on detected Next.
|
|
|
145
171
|
|
|
146
172
|
## Feature comparison
|
|
147
173
|
|
|
148
|
-
| Capability | Babel plugin | SWC
|
|
174
|
+
| Capability | Babel plugin | SWC plugin |
|
|
149
175
|
| --------------------- | ------------------------ | ------------------------------- |
|
|
150
176
|
| Git-aware attributes | ✅ | ✅ |
|
|
151
177
|
| Encoded path security | XOR + base64 | XOR + base64 |
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import type * as Babel from "@babel/core";
|
|
2
|
-
|
|
3
|
-
attributeName?: string;
|
|
4
|
-
repoAttributeName?: string;
|
|
5
|
-
branchAttributeName?: string;
|
|
6
|
-
repo_name?: string;
|
|
7
|
-
branch_name?: string;
|
|
8
|
-
}
|
|
2
|
+
import type { CodePressPluginOptions } from "./types";
|
|
9
3
|
interface CodePressPluginState extends Babel.PluginPass {
|
|
10
4
|
file: Babel.BabelFile & {
|
|
11
5
|
encodedPath?: string;
|
package/dist/index.js
CHANGED
|
@@ -97,7 +97,9 @@ function codePressPlugin(babel, options = {}) {
|
|
|
97
97
|
const currentRepoName = detectGitRepoName();
|
|
98
98
|
let globalAttributesAdded = false;
|
|
99
99
|
let processedFileCount = 0;
|
|
100
|
-
const
|
|
100
|
+
const FILE_PATH_ATTRIBUTE_NAME = "codepress-data-fp";
|
|
101
|
+
const REPO_ATTRIBUTE_NAME = "codepress-github-repo-name";
|
|
102
|
+
const BRANCH_ATTRIBUTE_NAME = "codepress-github-branch";
|
|
101
103
|
const repoName = options.repo_name || currentRepoName;
|
|
102
104
|
const branch = options.branch_name || currentBranch;
|
|
103
105
|
return {
|
|
@@ -127,12 +129,12 @@ function codePressPlugin(babel, options = {}) {
|
|
|
127
129
|
const endLine = (_c = parentLoc === null || parentLoc === void 0 ? void 0 : parentLoc.end.line) !== null && _c !== void 0 ? _c : startLine;
|
|
128
130
|
const attributeValue = `${encodedPath}:${startLine}-${endLine}`;
|
|
129
131
|
const existingAttribute = node.attributes.find((attr) => t.isJSXAttribute(attr) &&
|
|
130
|
-
t.isJSXIdentifier(attr.name, { name:
|
|
132
|
+
t.isJSXIdentifier(attr.name, { name: FILE_PATH_ATTRIBUTE_NAME }));
|
|
131
133
|
if (existingAttribute) {
|
|
132
134
|
existingAttribute.value = t.stringLiteral(attributeValue);
|
|
133
135
|
}
|
|
134
136
|
else {
|
|
135
|
-
node.attributes.push(t.jsxAttribute(t.jsxIdentifier(
|
|
137
|
+
node.attributes.push(t.jsxAttribute(t.jsxIdentifier(FILE_PATH_ATTRIBUTE_NAME), t.stringLiteral(attributeValue)));
|
|
136
138
|
}
|
|
137
139
|
if (!repoName || globalAttributesAdded) {
|
|
138
140
|
return;
|
|
@@ -146,16 +148,16 @@ function codePressPlugin(babel, options = {}) {
|
|
|
146
148
|
return;
|
|
147
149
|
}
|
|
148
150
|
const hasRepoAttribute = node.attributes.some((attr) => t.isJSXAttribute(attr) &&
|
|
149
|
-
t.isJSXIdentifier(attr.name, { name:
|
|
151
|
+
t.isJSXIdentifier(attr.name, { name: REPO_ATTRIBUTE_NAME }));
|
|
150
152
|
if (!hasRepoAttribute) {
|
|
151
153
|
console.log(`\x1b[32m✓ Adding repo attribute globally to <${elementName}> in ${path_1.default.basename((_d = state.file.opts.filename) !== null && _d !== void 0 ? _d : "unknown")}\x1b[0m`);
|
|
152
|
-
node.attributes.push(t.jsxAttribute(t.jsxIdentifier(
|
|
154
|
+
node.attributes.push(t.jsxAttribute(t.jsxIdentifier(REPO_ATTRIBUTE_NAME), t.stringLiteral(repoName)));
|
|
153
155
|
}
|
|
154
156
|
const hasBranchAttribute = node.attributes.some((attr) => t.isJSXAttribute(attr) &&
|
|
155
|
-
t.isJSXIdentifier(attr.name, { name:
|
|
157
|
+
t.isJSXIdentifier(attr.name, { name: BRANCH_ATTRIBUTE_NAME }));
|
|
156
158
|
if (!hasBranchAttribute && branch) {
|
|
157
159
|
console.log(`\x1b[32m✓ Adding branch attribute globally to <${elementName}> in ${path_1.default.basename((_e = state.file.opts.filename) !== null && _e !== void 0 ? _e : "unknown")}\x1b[0m`);
|
|
158
|
-
node.attributes.push(t.jsxAttribute(t.jsxIdentifier(
|
|
160
|
+
node.attributes.push(t.jsxAttribute(t.jsxIdentifier(BRANCH_ATTRIBUTE_NAME), t.stringLiteral(branch)));
|
|
159
161
|
}
|
|
160
162
|
globalAttributesAdded = true;
|
|
161
163
|
console.log("\x1b[36mℹ Repo/branch attributes added globally. Won't add again.\x1b[0m");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAmCA,wBAcC;AA0ED,kCAwIC;AAlQD,iDAAyC;AACzC,gDAAwB;AAIxB,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;AAEzD,MAAM,4BAA4B,GAA2B;IAC3D,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,EAAE;CACR,CAAC;AAEF,MAAM,uBAAuB,GAA2B;IACtD,GAAG,EAAE,GAAG;IACR,CAAC,EAAE,GAAG;CACP,CAAC;AAMF,SAAS,MAAM,CAAC,OAAe;IAC7B,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IACxB,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACtD,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IAChE,CAAC;IAED,OAAO,MAAM;SACV,QAAQ,CAAC,QAAQ,CAAC;SAClB,OAAO,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,4BAA4B,CAAC,IAAI,CAAC,CAAC,CAAC;AACrE,CAAC;AAED,SAAgB,MAAM,CAAC,cAAyC;IAC9D,IAAI,CAAC,cAAc;QAAE,OAAO,EAAE,CAAC;IAE/B,MAAM,MAAM,GAAG,cAAc,CAAC,OAAO,CACnC,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,0EAA0E,CAC3E,CAAC;YACJ,CAAC;SACF;QACD,IAAI;YACF,IAAI,kBAAkB,GAAG,CAAC,EAAE,CAAC;gBAC3B,OAAO,CAAC,GAAG,CACT,uBAAuB,kBAAkB,8BAA8B,CACxE,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,GAAG,CAAC,uDAAuD,CAAC,CAAC;YACvE,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/swc/index.d.ts
CHANGED
|
@@ -3,11 +3,10 @@ interface BandSelection {
|
|
|
3
3
|
band?: Band;
|
|
4
4
|
wasmPath?: string;
|
|
5
5
|
}
|
|
6
|
+
import type { CodePressPluginOptions } from "../types";
|
|
6
7
|
interface SWCUserConfig extends Record<string, unknown> {
|
|
7
8
|
}
|
|
8
|
-
interface SWCConfig extends SWCUserConfig {
|
|
9
|
-
repo_name: string | null;
|
|
10
|
-
branch_name: string | null;
|
|
9
|
+
interface SWCConfig extends SWCUserConfig, Required<CodePressPluginOptions> {
|
|
11
10
|
}
|
|
12
11
|
declare function pickBand(): BandSelection;
|
|
13
12
|
declare function resolveWasmFile(selection: BandSelection): string;
|
package/dist/swc/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/swc/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/swc/index.ts"],"names":[],"mappings":";;;AAkK0B,4BAAQ;AAAE,0CAAe;AAlKnD,iDAAyC;AAezC,MAAM,aAAa,GAAG,6BAA6B,CAAC;AAEpD,SAAS,aAAa,CAAC,OAAe;IACpC,IAAI,CAAC;QACH,OAAO,IAAA,wBAAQ,EAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC;IAChE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,C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AAC;YACrD,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,OAAO,CAAC,IAAI,CACV,6IAA6I,CAC9I,CAAC;IACJ,CAAC;IAED,MAAM,eAAe,GAAyB;QAC5C,QAAQ,EAAE,GAAG,aAAa,oBAAoB;QAC9C,GAAG,EAAE,GAAG,aAAa,eAAe;QACpC,GAAG,EAAE,GAAG,aAAa,eAAe;KACrC,CAAC;IAEF,OAAO,eAAe,CAAC,MAAA,SAAS,CAAC,IAAI,mCAAI,KAAK,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,eAAe,GAAG,CACtB,aAA4B,EAAE,EACT,EAAE;IACvB,MAAM,MAAM,GAAc;QACxB,SAAS,EAAE,iBAAiB,EAAE;QAC9B,WAAW,EAAE,eAAe,EAAE;QAC9B,GAAI,UAAqC;KAC7B,CAAC;IAEf,MAAM,aAAa,GAAG,eAAe,CAAC,QAAQ,EAAE,CAAC,CAAC;IAClD,OAAO,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;AACjC,CAAC,CAAC;AAEO,0CAAe;AAExB,kBAAe,eAAe,CAAC"}
|
package/dist/types.d.ts
ADDED
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/swc/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
const compiled = require(
|
|
3
|
+
const compiled = require("../dist/swc/index.js");
|
|
4
4
|
const exported = compiled && compiled.default ? compiled.default : compiled;
|
|
5
5
|
|
|
6
6
|
module.exports = exported;
|
|
7
7
|
|
|
8
|
-
if (compiled && typeof compiled ===
|
|
8
|
+
if (compiled && typeof compiled === "object") {
|
|
9
9
|
Object.keys(compiled).forEach((key) => {
|
|
10
|
-
if (key !==
|
|
10
|
+
if (key !== "default") {
|
|
11
11
|
module.exports[key] = compiled[key];
|
|
12
12
|
}
|
|
13
13
|
});
|