@hubspot/ui-extensions-dev-server 1.0.0 → 1.0.1
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.
|
@@ -60,6 +60,15 @@ describe('codeCheckingPlugin', () => {
|
|
|
60
60
|
plugin.writeBundle('', '');
|
|
61
61
|
expect(logger.warn).not.toHaveBeenCalled();
|
|
62
62
|
});
|
|
63
|
+
it('should not log a warning if the v0.11.3+ extend method implementation is found', () => {
|
|
64
|
+
// @ts-expect-error Mock
|
|
65
|
+
fs.readFileSync = vi.fn(() => {
|
|
66
|
+
return `someFunction();const extend_V2 = getWorkerGlobals().extend_V2;someOtherFunc()`;
|
|
67
|
+
});
|
|
68
|
+
// @ts-expect-error TS thinks these aren't functions
|
|
69
|
+
plugin.writeBundle('', '');
|
|
70
|
+
expect(logger.warn).not.toHaveBeenCalled();
|
|
71
|
+
});
|
|
63
72
|
it('should log an error if we are unable to load the code', () => {
|
|
64
73
|
fs.readFileSync = vi.fn(() => {
|
|
65
74
|
throw new Error('OH NO');
|
|
@@ -7,8 +7,12 @@ const codeCheckingPlugin = (options) => {
|
|
|
7
7
|
writeBundle() {
|
|
8
8
|
try {
|
|
9
9
|
const code = fs.readFileSync(output).toString();
|
|
10
|
-
if (
|
|
11
|
-
|
|
10
|
+
if (
|
|
11
|
+
// These checks are for older versions of our library
|
|
12
|
+
!code.includes('const extend = (...args) => self.extend(...args);') &&
|
|
13
|
+
!code.includes('self.extend_V2(renderExtensionCallback)') &&
|
|
14
|
+
// This is for version 0.11.3+ of our library where we changed the worker globals function name
|
|
15
|
+
!code.includes('getWorkerGlobals().extend_V2')) {
|
|
12
16
|
logger.warn('Unable to determine if your extension entry point is calling hubspot.extend, this may prevent it from rendering as expected');
|
|
13
17
|
}
|
|
14
18
|
}
|