@hubspot/ui-extensions-dev-server 1.0.1 → 1.0.2
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/lib/__tests__/plugins/codeCheckingPlugin.spec.js +97 -68
- package/dist/lib/bin/cli.js +26 -1
- package/dist/lib/build.d.ts +2 -1
- package/dist/lib/build.js +7 -1
- package/dist/lib/plugins/codeCheckingPlugin.d.ts +0 -1
- package/dist/lib/plugins/codeCheckingPlugin.js +80 -16
- package/dist/lib/plugins/devBuildPlugin.js +20 -13
- package/package.json +2 -11
|
@@ -1,82 +1,111 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { tmpdir } from 'os';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import { build } from 'vite';
|
|
5
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
3
6
|
import codeCheckingPlugin from "../../plugins/codeCheckingPlugin.js";
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
7
|
+
import { ROLLUP_OPTIONS } from "../../constants.js";
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const __dirname = path.dirname(__filename);
|
|
10
|
+
const fixturesDir = path.join(__dirname, 'fixtures/codeCheckingPlugin');
|
|
11
|
+
async function runViteBuild(fixtureFile, plugin) {
|
|
12
|
+
const fixturePath = path.join(fixturesDir, fixtureFile);
|
|
13
|
+
const outputDir = path.join(tmpdir(), `vite-test-${Date.now()}-${Math.random().toString(36).substring(7)}`);
|
|
14
|
+
await build({
|
|
15
|
+
logLevel: 'silent',
|
|
16
|
+
root: fixturesDir,
|
|
17
|
+
build: {
|
|
18
|
+
lib: {
|
|
19
|
+
entry: fixturePath,
|
|
20
|
+
name: 'test',
|
|
21
|
+
formats: ['es'],
|
|
22
|
+
fileName: () => 'test.js',
|
|
23
|
+
},
|
|
24
|
+
rollupOptions: {
|
|
25
|
+
...ROLLUP_OPTIONS,
|
|
26
|
+
external: [
|
|
27
|
+
...(ROLLUP_OPTIONS.external || []),
|
|
28
|
+
'@hubspot/ui-extensions',
|
|
29
|
+
'other-package',
|
|
30
|
+
],
|
|
31
|
+
plugins: [plugin],
|
|
32
|
+
},
|
|
33
|
+
outDir: outputDir,
|
|
34
|
+
emptyOutDir: true,
|
|
35
|
+
write: false,
|
|
36
|
+
},
|
|
24
37
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
}
|
|
39
|
+
const createPlugin = (options) => {
|
|
40
|
+
const logger = options?.logger || {
|
|
41
|
+
info: vi.fn(),
|
|
42
|
+
error: vi.fn(),
|
|
43
|
+
debug: vi.fn(),
|
|
44
|
+
warn: vi.fn(),
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
logger,
|
|
48
|
+
plugin: codeCheckingPlugin({ logger, ...options }),
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
describe('codeCheckingPlugin', () => {
|
|
52
|
+
describe('with warning', () => {
|
|
53
|
+
it('should log a warning when entry point has no imports from @hubspot/ui-extensions', async () => {
|
|
54
|
+
const { logger, plugin } = createPlugin();
|
|
55
|
+
await runViteBuild('emptyFile.js', plugin);
|
|
56
|
+
expect(logger.warn).toHaveBeenCalledTimes(1);
|
|
57
|
+
const warnCall = logger.warn.mock
|
|
58
|
+
.calls[0][0];
|
|
59
|
+
expect(warnCall).toContain('WARNING:');
|
|
60
|
+
expect(warnCall).toContain('hubspot');
|
|
61
|
+
expect(warnCall).toContain('@hubspot/ui-extensions');
|
|
32
62
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
plugin.writeBundle('', '');
|
|
63
|
+
it('should log a warning when code does not contain @hubspot/ui-extensions package at all', async () => {
|
|
64
|
+
const { logger, plugin } = createPlugin();
|
|
65
|
+
await runViteBuild('withoutHubspotPackage.js', plugin);
|
|
66
|
+
expect(logger.warn).toHaveBeenCalledTimes(1);
|
|
67
|
+
});
|
|
68
|
+
it('should log a warning when code imports from @hubspot/ui-extensions but does not import hubspot', async () => {
|
|
69
|
+
const { logger, plugin } = createPlugin();
|
|
70
|
+
await runViteBuild('withoutHubspotImport.js', plugin);
|
|
42
71
|
expect(logger.warn).toHaveBeenCalledTimes(1);
|
|
43
|
-
expect(logger.warn).toHaveBeenCalledWith('Unable to determine if your extension entry point is calling hubspot.extend, this may prevent it from rendering as expected');
|
|
44
72
|
});
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
// @ts-expect-error TS thinks these aren't functions
|
|
51
|
-
plugin.writeBundle('', '');
|
|
73
|
+
});
|
|
74
|
+
describe('without warning', () => {
|
|
75
|
+
it('should not log a warning when hubspot is imported from a separate entry point', async () => {
|
|
76
|
+
const { logger, plugin } = createPlugin();
|
|
77
|
+
await runViteBuild('withHubspotImportInSeparateEntry.js', plugin);
|
|
52
78
|
expect(logger.warn).not.toHaveBeenCalled();
|
|
53
79
|
});
|
|
54
|
-
it('should not log a warning
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return `someFunction();self.extend_V2(renderExtensionCallback);someOtherFunc()`;
|
|
58
|
-
});
|
|
59
|
-
// @ts-expect-error TS thinks these aren't functions
|
|
60
|
-
plugin.writeBundle('', '');
|
|
80
|
+
it('should not log a warning when hubspot is imported from @hubspot/ui-extensions', async () => {
|
|
81
|
+
const { logger, plugin } = createPlugin();
|
|
82
|
+
await runViteBuild('withHubspotImport.js', plugin);
|
|
61
83
|
expect(logger.warn).not.toHaveBeenCalled();
|
|
62
84
|
});
|
|
63
|
-
it('should not log a warning
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return `someFunction();const extend_V2 = getWorkerGlobals().extend_V2;someOtherFunc()`;
|
|
67
|
-
});
|
|
68
|
-
// @ts-expect-error TS thinks these aren't functions
|
|
69
|
-
plugin.writeBundle('', '');
|
|
85
|
+
it('should not log a warning when hubspot is imported alongside other exports from @hubspot/ui-extensions', async () => {
|
|
86
|
+
const { logger, plugin } = createPlugin();
|
|
87
|
+
await runViteBuild('withHubspotAndOtherExports.js', plugin);
|
|
70
88
|
expect(logger.warn).not.toHaveBeenCalled();
|
|
71
89
|
});
|
|
72
|
-
it('should log
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
90
|
+
it('should not log a warning when hubspot is imported with other exports in any order', async () => {
|
|
91
|
+
const { logger, plugin } = createPlugin();
|
|
92
|
+
await runViteBuild('withHubspotInMixedExports.js', plugin);
|
|
93
|
+
expect(logger.warn).not.toHaveBeenCalled();
|
|
94
|
+
});
|
|
95
|
+
it('should not log a warning when hubspot is imported using single quotes', async () => {
|
|
96
|
+
const { logger, plugin } = createPlugin();
|
|
97
|
+
await runViteBuild('withHubspotImportSingleQuotes.js', plugin);
|
|
98
|
+
expect(logger.warn).not.toHaveBeenCalled();
|
|
99
|
+
});
|
|
100
|
+
it('should not log a warning when using namespace import from @hubspot/ui-extensions', async () => {
|
|
101
|
+
const { logger, plugin } = createPlugin();
|
|
102
|
+
await runViteBuild('withNamespaceImport.js', plugin);
|
|
103
|
+
expect(logger.warn).not.toHaveBeenCalled();
|
|
104
|
+
});
|
|
105
|
+
it('should not log a warning when hubspot is imported in TypeScript files', async () => {
|
|
106
|
+
const { logger, plugin } = createPlugin();
|
|
107
|
+
await runViteBuild('ts-withHubspotImport.ts', plugin);
|
|
108
|
+
expect(logger.warn).not.toHaveBeenCalled();
|
|
80
109
|
});
|
|
81
110
|
});
|
|
82
111
|
});
|
package/dist/lib/bin/cli.js
CHANGED
|
@@ -6,7 +6,7 @@ import { exec } from 'node:child_process';
|
|
|
6
6
|
import { Command } from 'commander';
|
|
7
7
|
import ora from 'ora';
|
|
8
8
|
import chalk from 'chalk';
|
|
9
|
-
import { remoteBuild } from "../build.js";
|
|
9
|
+
import { remoteBuild, buildSingleExtension } from "../build.js";
|
|
10
10
|
const program = new Command()
|
|
11
11
|
.name('ui-extension-tools')
|
|
12
12
|
.alias('uie')
|
|
@@ -30,6 +30,12 @@ const buildSteps = {
|
|
|
30
30
|
success: 'Extension build complete',
|
|
31
31
|
error: 'Error building extension',
|
|
32
32
|
},
|
|
33
|
+
devBuild: {
|
|
34
|
+
start: 'Building single extension in development mode...',
|
|
35
|
+
fn: devBuild,
|
|
36
|
+
success: 'Extension build complete',
|
|
37
|
+
error: 'Error building extension',
|
|
38
|
+
},
|
|
33
39
|
};
|
|
34
40
|
program
|
|
35
41
|
.option('-v, --profile-variables <path>', 'path to a json file with profile variables')
|
|
@@ -41,6 +47,13 @@ program
|
|
|
41
47
|
await runCommand('install', options);
|
|
42
48
|
await runCommand('build', options);
|
|
43
49
|
});
|
|
50
|
+
program
|
|
51
|
+
.command('build-dev <module>')
|
|
52
|
+
.description('Build extension source code in development mode (no minification).')
|
|
53
|
+
.action(async (module) => {
|
|
54
|
+
const options = getOptions(module);
|
|
55
|
+
await runCommand('devBuild', options);
|
|
56
|
+
});
|
|
44
57
|
program.parse(process.argv);
|
|
45
58
|
async function runCommand(command, options) {
|
|
46
59
|
const { start, fn, success, error } = buildSteps[command];
|
|
@@ -69,6 +82,18 @@ function build({ extensionRoot, extensionDist, entrypoint, profileVariables, })
|
|
|
69
82
|
},
|
|
70
83
|
});
|
|
71
84
|
}
|
|
85
|
+
async function devBuild({ extensionRoot, extensionDist, entrypoint, profileVariables, }) {
|
|
86
|
+
return buildSingleExtension({
|
|
87
|
+
file: entrypoint,
|
|
88
|
+
outputDir: extensionDist,
|
|
89
|
+
root: extensionRoot,
|
|
90
|
+
minify: false,
|
|
91
|
+
appConfig: {
|
|
92
|
+
variables: profileVariables,
|
|
93
|
+
},
|
|
94
|
+
codeCheckingPluginEnabled: true,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
72
97
|
// Mirrors: https://git.hubteam.com/HubSpot/Artifactor/blob/f5cbea91d7a7dfb6278e878ae583e69022384fb5/ArtifactorFunctions/functions/node_18x/uie-remote-build/index.js#L53-L57
|
|
73
98
|
async function installDeps(options) {
|
|
74
99
|
await execAsync('npm ci --ignore-scripts --no-audit --no-optional --no-fund', options);
|
package/dist/lib/build.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ interface BuildSingleExtensionArgs {
|
|
|
8
8
|
root?: string;
|
|
9
9
|
logLevel?: InlineConfig['logLevel'];
|
|
10
10
|
appConfig?: ManifestConfig;
|
|
11
|
+
codeCheckingPluginEnabled?: boolean;
|
|
11
12
|
}
|
|
12
13
|
interface RemoteBuildArgs {
|
|
13
14
|
root: string;
|
|
@@ -18,6 +19,6 @@ interface RemoteBuildArgs {
|
|
|
18
19
|
}
|
|
19
20
|
export declare const extensionErrorBaseMessage: string;
|
|
20
21
|
export declare function buildSingleExtension({ file, outputDir, emptyOutDir, minify, root, // This is the vite default, so using that as our default
|
|
21
|
-
logLevel, appConfig, }: BuildSingleExtensionArgs): Promise<void>;
|
|
22
|
+
logLevel, appConfig, codeCheckingPluginEnabled, }: BuildSingleExtensionArgs): Promise<void>;
|
|
22
23
|
export declare function remoteBuild(args: RemoteBuildArgs): Promise<void>;
|
|
23
24
|
export {};
|
package/dist/lib/build.js
CHANGED
|
@@ -5,10 +5,11 @@ import path from 'path';
|
|
|
5
5
|
import { getUrlSafeFileName } from "./utils.js";
|
|
6
6
|
import codeBlockingPlugin from "./plugins/codeBlockingPlugin.js";
|
|
7
7
|
import friendlyLoggingPlugin from "./plugins/friendlyLoggingPlugin.js";
|
|
8
|
+
import codeCheckingPlugin from "./plugins/codeCheckingPlugin.js";
|
|
8
9
|
const allowedExtensions = ['.js', '.ts', '.tsx', '.jsx'];
|
|
9
10
|
export const extensionErrorBaseMessage = `Supported file extensions are [${allowedExtensions.join(', ')}], received:`;
|
|
10
11
|
export async function buildSingleExtension({ file, outputDir = OUTPUT_DIR, emptyOutDir = true, minify = false, root = process.cwd(), // This is the vite default, so using that as our default
|
|
11
|
-
logLevel = 'info', appConfig, }) {
|
|
12
|
+
logLevel = 'info', appConfig, codeCheckingPluginEnabled = false, }) {
|
|
12
13
|
const output = getUrlSafeFileName(file);
|
|
13
14
|
await build({
|
|
14
15
|
logLevel,
|
|
@@ -34,6 +35,10 @@ logLevel = 'info', appConfig, }) {
|
|
|
34
35
|
}),
|
|
35
36
|
friendlyLoggingPlugin({ logger: console }),
|
|
36
37
|
codeBlockingPlugin({ logger: console, extensionPath: root }),
|
|
38
|
+
codeCheckingPluginEnabled &&
|
|
39
|
+
codeCheckingPlugin({
|
|
40
|
+
logger: console,
|
|
41
|
+
}),
|
|
37
42
|
],
|
|
38
43
|
},
|
|
39
44
|
outDir: outputDir,
|
|
@@ -63,5 +68,6 @@ export async function remoteBuild(args) {
|
|
|
63
68
|
root,
|
|
64
69
|
logLevel,
|
|
65
70
|
appConfig,
|
|
71
|
+
codeCheckingPluginEnabled: false,
|
|
66
72
|
});
|
|
67
73
|
}
|
|
@@ -1,23 +1,87 @@
|
|
|
1
|
-
import
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
// Matches import statements from @hubspot/ui-extensions that include "hubspot" in the import list.
|
|
3
|
+
// Example matches: "import { hubspot } from '@hubspot/ui-extensions'"
|
|
4
|
+
// "import { hubspot, other } from '@hubspot/ui-extensions'"
|
|
5
|
+
// "import { some, hubspot, more } from \"@hubspot/ui-extensions\""
|
|
6
|
+
const HUBSPOT_IMPORT_REGEX = /import\s*\{[^}]*\bhubspot\b[^}]*\}\s*from\s*['"]@hubspot\/ui-extensions['"]/;
|
|
7
|
+
// Matches namespace import statements from @hubspot/ui-extensions.
|
|
8
|
+
// Example matches: "import * as hubspot from '@hubspot/ui-extensions'"
|
|
9
|
+
// "import * as uie from '@hubspot/ui-extensions'"
|
|
10
|
+
const NAMESPACE_IMPORT_REGEX = /import\s+\*\s+as\s+\w+\s+from\s+['"]@hubspot\/ui-extensions['"]/;
|
|
2
11
|
const codeCheckingPlugin = (options) => {
|
|
3
|
-
const {
|
|
12
|
+
const { logger } = options;
|
|
13
|
+
let foundHubspotImport = false;
|
|
4
14
|
return {
|
|
5
15
|
name: 'ui-extensions-code-checking-plugin',
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Called by Rollup once at the beginning of each build, before any modules are processed.
|
|
18
|
+
* This hook is invoked when a new build starts, allowing plugins to reset state or
|
|
19
|
+
* perform initialization tasks. In watch mode, this is called each time a rebuild is triggered.
|
|
20
|
+
*
|
|
21
|
+
* We reset the `foundHubspotImport` flag here to ensure we check for the import
|
|
22
|
+
* in each new build cycle.
|
|
23
|
+
*/
|
|
24
|
+
buildStart() {
|
|
25
|
+
foundHubspotImport = false;
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* Called by Rollup for each module during the build process, after the module's source code
|
|
29
|
+
* has been loaded but before it's parsed and analyzed. This hook allows plugins to transform
|
|
30
|
+
* the source code or perform analysis on it.
|
|
31
|
+
*
|
|
32
|
+
* The `code` parameter contains the raw source code of the module being processed.
|
|
33
|
+
* This hook is called for every module that Rollup processes, including entry points
|
|
34
|
+
* and all their dependencies.
|
|
35
|
+
*
|
|
36
|
+
* We use this hook to scan each module's source code for the required `hubspot` import
|
|
37
|
+
* from `@hubspot/ui-extensions`. Once we find it, we set a flag to avoid unnecessary
|
|
38
|
+
* regex matching on subsequent modules.
|
|
39
|
+
*
|
|
40
|
+
* @param code - The source code of the module being transformed
|
|
41
|
+
* @returns `null` to indicate no transformation is needed (we're only analyzing the code)
|
|
42
|
+
*/
|
|
43
|
+
transform(code) {
|
|
44
|
+
if (foundHubspotImport) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
if (!code.includes('@hubspot/ui-extensions')) {
|
|
48
|
+
return null;
|
|
18
49
|
}
|
|
19
|
-
|
|
20
|
-
|
|
50
|
+
if (HUBSPOT_IMPORT_REGEX.test(code) ||
|
|
51
|
+
NAMESPACE_IMPORT_REGEX.test(code)) {
|
|
52
|
+
foundHubspotImport = true;
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* Called by Rollup once at the end of the build, after all modules have been processed
|
|
58
|
+
* and the build is complete. This hook is invoked regardless of whether the build
|
|
59
|
+
* succeeded or failed, making it useful for cleanup tasks or final validation checks.
|
|
60
|
+
*
|
|
61
|
+
* In watch mode, this hook is called after each rebuild completes.
|
|
62
|
+
*
|
|
63
|
+
* We use this hook to check if we found the required `hubspot` import during the build.
|
|
64
|
+
* If not found, we log a warning to help developers understand why their extension
|
|
65
|
+
* might not render correctly.
|
|
66
|
+
*/
|
|
67
|
+
buildEnd() {
|
|
68
|
+
if (!foundHubspotImport) {
|
|
69
|
+
logger.warn(`
|
|
70
|
+
|
|
71
|
+
${chalk.yellow.bold('WARNING:')} Your extension does not appear to import ${chalk.cyan('hubspot')} from ${chalk.cyan('@hubspot/ui-extensions')}.
|
|
72
|
+
|
|
73
|
+
${chalk.red('Without this import, your extension will not render.')} To fix this:
|
|
74
|
+
|
|
75
|
+
${chalk.bold('1.')} Import ${chalk.cyan('hubspot')} from ${chalk.cyan('@hubspot/ui-extensions')}
|
|
76
|
+
${chalk.bold('2.')} Call ${chalk.cyan('hubspot.extend()')} with your render function
|
|
77
|
+
|
|
78
|
+
${chalk.bold('Example:')}
|
|
79
|
+
${chalk.gray('import')} ${chalk.cyan('{ hubspot }')} ${chalk.gray('from')} ${chalk.yellow("'@hubspot/ui-extensions'")};
|
|
80
|
+
|
|
81
|
+
${chalk.cyan('hubspot')}.${chalk.cyan('extend')}${chalk.gray("<'crm.record.tab'>")}((${chalk.gray('{ context }')}) => {
|
|
82
|
+
${chalk.gray('return')} <MyExtension />;
|
|
83
|
+
});
|
|
84
|
+
`);
|
|
21
85
|
}
|
|
22
86
|
},
|
|
23
87
|
};
|
|
@@ -3,7 +3,6 @@ import { build } from 'vite';
|
|
|
3
3
|
import manifestPlugin from "./manifestPlugin.js";
|
|
4
4
|
import { stripAnsiColorCodes } from "../utils.js";
|
|
5
5
|
import codeCheckingPlugin from "./codeCheckingPlugin.js";
|
|
6
|
-
import path from 'path';
|
|
7
6
|
import friendlyLoggingPlugin from "./friendlyLoggingPlugin.js";
|
|
8
7
|
import relevantModulesPlugin, { getRelevantModules, } from "./relevantModulesPlugin.js";
|
|
9
8
|
import codeBlockingPlugin from "./codeBlockingPlugin.js";
|
|
@@ -29,18 +28,27 @@ const devBuildPlugin = (options) => {
|
|
|
29
28
|
const { error: { plugin, errors, frame, loc, id }, extensionMetadata, } = error;
|
|
30
29
|
// Filter out our custom plugins, but send everything else
|
|
31
30
|
if (!plugin?.startsWith('ui-extensions')) {
|
|
32
|
-
devServerState.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
const ws = devServerState.extensionsWebSocket;
|
|
32
|
+
/**
|
|
33
|
+
* If there's no WebSocket, there are no connected clients to notify of the error.
|
|
34
|
+
* In this case, the error data is already stored in `lastBuildErrorContext` to be sent when a client connects.
|
|
35
|
+
*
|
|
36
|
+
* If there is a WebSocket, broadcast the error to all connected clients
|
|
37
|
+
*/
|
|
38
|
+
if (ws) {
|
|
39
|
+
devServerState.getExtensionsWebSocket().broadcast({
|
|
40
|
+
...addVersionToBaseMessage(extensionMetadata.baseMessage),
|
|
41
|
+
event: 'error',
|
|
42
|
+
error: {
|
|
43
|
+
details: {
|
|
44
|
+
errors,
|
|
45
|
+
formattedError: stripAnsiColorCodes(frame),
|
|
46
|
+
location: loc,
|
|
47
|
+
file: id,
|
|
48
|
+
},
|
|
41
49
|
},
|
|
42
|
-
}
|
|
43
|
-
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
44
52
|
}
|
|
45
53
|
};
|
|
46
54
|
const devBuild = async (server, extensionMetadata, emptyOutDir = false) => {
|
|
@@ -86,7 +94,6 @@ const devBuildPlugin = (options) => {
|
|
|
86
94
|
manifestConfig,
|
|
87
95
|
}),
|
|
88
96
|
codeCheckingPlugin({
|
|
89
|
-
output: path.join(devServerState.outputDir, extensionConfig.output),
|
|
90
97
|
logger,
|
|
91
98
|
}),
|
|
92
99
|
friendlyLoggingPlugin({ logger }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/ui-extensions-dev-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
],
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@hubspot/app-functions-dev-server": "0.
|
|
35
|
+
"@hubspot/app-functions-dev-server": "0.11.0",
|
|
36
36
|
"chalk": "5.4.1",
|
|
37
37
|
"commander": "13.1.0",
|
|
38
38
|
"cors": "2.8.5",
|
|
@@ -68,15 +68,6 @@
|
|
|
68
68
|
"engines": {
|
|
69
69
|
"node": ">=18"
|
|
70
70
|
},
|
|
71
|
-
"peerDependencies": {
|
|
72
|
-
"typescript": "^5.1.6",
|
|
73
|
-
"vite": "^4.4.9"
|
|
74
|
-
},
|
|
75
|
-
"peerDependenciesMeta": {
|
|
76
|
-
"typescript": {
|
|
77
|
-
"optional": true
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
71
|
"gitHead": "3da4a07183d48528ef431d46a8d327c053c4fe94",
|
|
81
72
|
"lint-staged": {
|
|
82
73
|
"**/*.{js,ts}": [
|