deep-foundation / deep-memo-app

The Unlicense
11 stars 8 forks source link

Web extension for VSCode #23

Open FreePhoenix888 opened 1 year ago

FreePhoenix888 commented 1 year ago

Extension must save history about user's file navigation

FreePhoenix888 commented 1 year ago
freephoenix888@freephoenix888:~/Programming/deep$ npm install
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@vscode/test-electron@2.2.3',
npm WARN EBADENGINE   required: { node: '>=16' },
npm WARN EBADENGINE   current: { node: 'v14.21.2', npm: '9.4.0' }
npm WARN EBADENGINE }

up to date, audited 212 packages in 929ms

46 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
FreePhoenix888 commented 1 year ago

Main information

  1. Default web extension works
  2. Works if deeplinks is installed
  3. If we will restart vscode it works
  4. If we add imports from deeplinks
    import { generateApolloClient } from '@deep-foundation/hasura/client';
    import { DeepClient } from '@deep-foundation/deeplinks/imports/client';

    we will get error Cannot use JSX unless the '--jsx' flag is provided Solution https://stackoverflow.com/a/64946881/13545849

  5. If wee run extension command when the imports from deeplinks are added no error will be throwed But if we restart vscode we will get errors These errors dissappear if we run extension again

Extension is working

  1. If we add deep client initialization inside hello world command:

    let disposable = vscode.commands.registerCommand('deep.helloWorld', async () => {
        const nextPublicGqlPath = "";
        const apolloClient = generateApolloClient({
            path: nextPublicGqlPath, 
            ssl: !!nextPublicGqlPath.indexOf('localhost')
              ? false
              : true,
            // admin token in prealpha deep secret key
            // token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwczovL2hhc3VyYS5pby9qd3QvY2xhaW1zIjp7IngtaGFzdXJhLWFsbG93ZWQtcm9sZXMiOlsibGluayJdLCJ4LWhhc3VyYS1kZWZhdWx0LXJvbGUiOiJsaW5rIiwieC1oYXN1cmEtdXNlci1pZCI6IjI2MiJ9LCJpYXQiOjE2NTYxMzYyMTl9.dmyWwtQu9GLdS7ClSLxcXgQiKxmaG-JPDjQVxRXOpxs',
         });
    
         const unloginedDeep = new DeepClient({ apolloClient });
         const guest = await unloginedDeep.guest();
         const guestDeep = new DeepClient({ deep: unloginedDeep, ...guest });
         const admin = await guestDeep.login({
            linkId: await guestDeep.id('deep', 'admin'),
         });
         const deep = new DeepClient({ deep: guestDeep, ...admin });
         vscode.window.showInformationMessage(`deep.linkId: ${deep.linkId}`);
    
        // Display a message box to the user
        vscode.window.showInformationMessage('Hello World from deep in a web extension host!');
    });

    We will get these errors The exact error is not found by google: image

Additional information

extension.ts webpack.config.js

Konard commented 1 year ago

Why didn't you paste the error message directly into issue text using Markdown code block?

FreePhoenix888 commented 1 year ago

Why didn't you paste the error message directly into issue text using Markdown code block?

Because the message will become a mess which will be hard to edit

FreePhoenix888 commented 1 year ago
freephoenix888@freephoenix888:~/Programming/deep$ npm run watch-web 

> deep@0.0.1 watch-web
> webpack --watch

    [webpack-cli] Compiler starting... 
    [webpack-cli] Compiler is using config: '/home/freephoenix888/Programming/deep/webpack.config.js'
    [webpack-cli] Compiler finished
assets by path test/suite/ 796 KiB
  asset test/suite/index.js 795 KiB [compared for emit] [big] (name: test/suite/index) 1 related asset
  asset test/suite/index.d.ts 46 bytes [compared for emit]
  asset test/suite/extension.test.d.ts 11 bytes [compared for emit]
asset extension.js 5.31 KiB [compared for emit] (name: extension) 1 related asset
asset extension.d.ts 152 bytes [compared for emit]
runtime modules 309 bytes 2 modules
modules by path ./node_modules/ 823 KiB 44 modules
modules by path ./src/web/ 4.79 KiB
  modules by path ./src/web/test/suite/*.ts 2.15 KiB
    ./src/web/test/suite/index.ts 748 bytes [built] [code generated]
    ./src/web/test/suite/extension.test.ts 1.42 KiB [built] [code generated]
  ./src/web/extension.ts 2.46 KiB [built] [code generated]
  ./src/web/test/suite/ sync \.test$ 181 bytes [built] [code generated]
external "vscode" 42 bytes [built] [code generated]

WARNING in ./node_modules/mocha/mocha.js 19424:26-55
Critical dependency: the request of a dependency is an expression
 @ ./src/web/test/suite/index.ts 4:0-22

1 warning has detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

ERROR in ./node_modules/@deep-foundation/deeplinks/imports/client.tsx 23:17
Module parse failed: Unexpected token (23:17)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| Debug.enable(`${namespaces ? `${namespaces},` : ``}${error.namespace}`);
| 
> const corePckgIds: { [key: string]: number; } = {};
| corePckg.data.filter(l => !!l.type).forEach((l, i) => {
|   corePckgIds[l.id] = i+1;
 @ ./src/web/extension.ts 28:17-69

ERROR in ./node_modules/@deep-foundation/hasura/client.tsx 16:37
Module parse failed: Unexpected token (16:37)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| }
| 
> const DEEP_FOUNDATION_HASURA_RELATIVE: boolean | undefined = ((r) => r ? !!+r : undefined)(process.env.DEEP_FOUNDATION_HASURA_RELATIVE);
| const NEXT_PUBLIC_DEEP_FOUNDATION_HASURA_RELATIVE: boolean | undefined = ((r) => r ? !!+r : undefined)(process.env.NEXT_PUBLIC_DEEP_FOUNDATION_HASURA_RELATIVE);
| 
 @ ./src/web/extension.ts 27:17-58

webpack 5.75.0 compiled with 2 errors and 1 warning in 3386 ms
    [webpack-cli] Compiler is watching files for updates...