Browse Source

remove unnecessary tools

Yuki Takei 2 years ago
parent
commit
3dc66a011a

+ 0 - 159
apps/app/bin/cdn/cdn-resources-downloader.ts

@@ -1,159 +0,0 @@
-import path from 'path';
-import { URL } from 'url';
-import urljoin from 'url-join';
-import { Transform } from 'stream';
-import replaceStream from 'replacestream';
-
-import { cdnLocalScriptRoot, cdnLocalStyleRoot, cdnLocalStyleWebRoot } from '^/config/cdn';
-import * as cdnManifests from '^/resource/cdn-manifests';
-
-import { CdnResource, CdnManifest } from '~/interfaces/cdn';
-import loggerFactory from '~/utils/logger';
-import { downloadTo } from '~/utils/download';
-
-const logger = loggerFactory('growi:service:CdnResourcesDownloader');
-
-export default class CdnResourcesDownloader {
-
-  async downloadAndWriteAll(): Promise<any> {
-    const cdnScriptResources: CdnResource[] = cdnManifests.js.map((manifest: CdnManifest) => {
-      return { manifest, outDir: cdnLocalScriptRoot };
-    });
-
-    const cdnStyleResources: CdnResource[] = cdnManifests.style.map((manifest) => {
-      return { manifest, outDir: cdnLocalStyleRoot };
-    });
-
-    const dlStylesOptions = {
-      replaceUrl: {
-        webroot: cdnLocalStyleWebRoot,
-      },
-    };
-
-    return Promise.all([
-      this.downloadScripts(cdnScriptResources),
-      this.downloadStyles(cdnStyleResources, dlStylesOptions),
-    ]);
-  }
-
-  /**
-   * Download script files from CDN
-   * @param cdnResources JavaScript resource data
-   * @param options
-   */
-  private async downloadScripts(cdnResources: CdnResource[], options?: any): Promise<any> {
-    logger.debug('Downloading scripts', cdnResources);
-
-    const opts = Object.assign({}, options);
-    const ext = opts.ext || 'js';
-
-    const promises = cdnResources.map((cdnResource) => {
-      const { manifest } = cdnResource;
-
-      logger.info(`Processing CdnResource '${manifest.name}'`);
-
-      return downloadTo(
-        manifest.url,
-        cdnResource.outDir,
-        `${manifest.name}.${ext}`,
-      );
-    });
-
-    return Promise.all(promises);
-  }
-
-  /**
-   * Download style sheet file from CDN
-   *  Assets in CSS is also downloaded
-   * @param cdnResources CSS resource data
-   * @param options
-   */
-  private async downloadStyles(cdnResources: CdnResource[], options?: any): Promise<any> {
-    logger.debug('Downloading styles', cdnResources);
-
-    const opts = Object.assign({}, options);
-    const ext = opts.ext || 'css';
-
-    // styles
-    const assetsResourcesStore: CdnResource[] = [];
-    const promisesForStyle = cdnResources.map((cdnResource) => {
-      const { manifest } = cdnResource;
-
-      logger.info(`Processing CdnResource '${manifest.name}'`);
-
-      let urlReplacer: Transform|null = null;
-
-      // generate replaceStream instance
-      if (opts.replaceUrl != null) {
-        urlReplacer = this.generateReplaceUrlInCssStream(cdnResource, assetsResourcesStore, opts.replaceUrl.webroot);
-      }
-
-      return downloadTo(
-        manifest.url,
-        cdnResource.outDir,
-        `${manifest.name}.${ext}`,
-        urlReplacer,
-      );
-    });
-
-    // wait until all styles are downloaded
-    await Promise.all(promisesForStyle);
-
-    logger.debug('Downloading assets', assetsResourcesStore);
-
-    // assets in css
-    const promisesForAssets = assetsResourcesStore.map((cdnResource) => {
-      const { manifest } = cdnResource;
-
-      logger.info(`Processing assts in css '${manifest.name}'`);
-
-      return downloadTo(
-        manifest.url,
-        cdnResource.outDir,
-        manifest.name,
-      );
-    });
-
-    return Promise.all(promisesForAssets);
-  }
-
-  /**
-   * Generate replaceStream instance to replace 'url(..)'
-   *
-   * e.g.
-   *  Before  : url(../images/logo.svg)
-   *  After   : url(/path/to/webroot/${cdnResources.name}/logo.svg)
-   *
-   * @param cdnResource CSS resource data
-   * @param assetsResourcesStore An array to store CdnResource that is detected by 'url()' in CSS
-   * @param webroot
-   */
-  private generateReplaceUrlInCssStream(cdnResource: CdnResource, assetsResourcesStore: CdnResource[], webroot: string): Transform {
-    return replaceStream(
-      /url\((?!['"]?data:)["']?(.+?)["']?\)/g, // https://regex101.com/r/Sds38A/3
-      (match, url) => {
-        // generate URL Object
-        const parsedUrl = url.startsWith('http')
-          ? new URL(url) // when url is fqcn
-          : new URL(url, cdnResource.manifest.url); // when url is relative
-        const basename = path.basename(parsedUrl.pathname);
-
-        logger.debug(`${cdnResource.manifest.name} has ${parsedUrl.toString()}`);
-
-        // add assets metadata to download later
-        const replacedCdnResource = {
-          manifest: {
-            name: basename,
-            url: parsedUrl.toString(),
-          },
-          outDir: path.join(cdnResource.outDir, cdnResource.manifest.name),
-        };
-        assetsResourcesStore.push(replacedCdnResource);
-
-        const replaceUrl = urljoin(webroot, cdnResource.manifest.name, basename);
-        return `url(${replaceUrl})`;
-      },
-    );
-  }
-
-}

+ 0 - 33
apps/app/bin/download-cdn-resources.ts

@@ -1,33 +0,0 @@
-/**
- * the tool for download CDN resources and save as file
- *
- * @author Yuki Takei <yuki@weseek.co.jp>
- */
-import { envUtils } from '@growi/core/dist/utils';
-
-import loggerFactory from '../src/utils/logger';
-
-import CdnResourcesDownloader from './cdn/cdn-resources-downloader';
-
-const logger = loggerFactory('growi:bin:download-cdn-resources');
-
-// check env var
-const noCdn: boolean = envUtils.toBoolean(process.env.NO_CDN);
-if (!noCdn) {
-  logger.info('Using CDN. No resources are downloaded.');
-  // exit
-  process.exit(0);
-}
-
-logger.info('This is NO_CDN mode. Start to download resources.');
-
-
-const downloader = new CdnResourcesDownloader();
-
-downloader.downloadAndWriteAll()
-  .then(() => {
-    logger.info('Download is completed successfully');
-  })
-  .catch((err) => {
-    logger.error(err);
-  });

+ 0 - 1
apps/app/config/logger/config.dev.js

@@ -25,7 +25,6 @@ module.exports = {
   // 'growi:lib:importer': 'debug',
   // 'growi:routes:page': 'debug',
   'growi-plugin:*': 'debug',
-  // 'growi:InterceptorManager': 'debug',
   'growi:service:search-delegator:elasticsearch': 'debug',
   'growi:service:g2g-transfer': 'debug',
   'growi:service:questionnaire': 'debug',

+ 0 - 221
apps/app/resource/cdn-manifests.js

@@ -1,221 +0,0 @@
-module.exports = {
-  js: [
-    {
-      name: 'basis',
-      // eslint-disable-next-line max-len
-      url: 'https://cdn.jsdelivr.net/combine/npm/jquery@3.4.0,npm/popper.js@1.15.0,npm/bootstrap@4.5.0/dist/js/bootstrap.min.js,npm/scrollpos-styler@0.7.1,npm/jquery-slimscroll@1.3.8/jquery.slimscroll.min.js',
-      groups: ['basis'],
-      args: {
-        integrity: '',
-      },
-    },
-    {
-      name: 'highlight',
-      url: 'https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.13.0/build/highlight.min.js',
-      groups: ['basis'],
-      args: {
-        integrity: '',
-      },
-    },
-    {
-      name: 'highlight-addons',
-      url: 'https://cdn.jsdelivr.net/combine/'
-        + 'gh/highlightjs/cdn-release@9.13.0/build/languages/dockerfile.min.js,'
-        + 'gh/highlightjs/cdn-release@9.13.0/build/languages/go.min.js,'
-        + 'gh/highlightjs/cdn-release@9.13.0/build/languages/gradle.min.js,'
-        + 'gh/highlightjs/cdn-release@9.13.0/build/languages/json.min.js,'
-        + 'gh/highlightjs/cdn-release@9.13.0/build/languages/less.min.js,'
-        + 'gh/highlightjs/cdn-release@9.13.0/build/languages/plaintext.min.js,'
-        + 'gh/highlightjs/cdn-release@9.13.0/build/languages/scss.min.js,'
-        + 'gh/highlightjs/cdn-release@9.13.0/build/languages/typescript.min.js,'
-        + 'gh/highlightjs/cdn-release@9.13.0/build/languages/yaml.min.js,'
-        + 'gh/highlightjs/cdn-release@9.13.0/build/languages/swift.min.js,'
-        + 'gh/highlightjs/cdn-release@9.13.0/build/languages/kotlin.min.js,'
-        + 'npm/highlightjs-line-numbers.js@2.6.0/dist/highlightjs-line-numbers.min.js',
-      args: {
-        async: true,
-        integrity: '',
-      },
-    },
-    {
-      name: 'mathjax',
-      url: 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js',
-      args: {
-        async: true,
-        integrity: '',
-      },
-    },
-    {
-      name: 'drawio-viewer',
-      url: 'https://jgraph.github.io/drawio/src/main/webapp/js/viewer.min.js',
-      args: {
-        async: true,
-        integrity: '',
-      },
-    },
-    {
-      name: 'codemirror-dialog',
-      url: 'https://cdn.jsdelivr.net/npm/codemirror@5.64.0/addon/dialog/dialog.min.js',
-      args: {
-        integrity: '',
-      },
-    },
-    {
-      name: 'codemirror-keymap-vim',
-      url: 'https://cdn.jsdelivr.net/npm/codemirror@5.64.0/keymap/vim.min.js',
-      args: {
-        integrity: '',
-      },
-    },
-    {
-      name: 'codemirror-keymap-emacs',
-      url: 'https://cdn.jsdelivr.net/npm/codemirror@5.64.0/keymap/emacs.min.js',
-      args: {
-        integrity: '',
-      },
-    },
-    {
-      name: 'codemirror-keymap-sublime',
-      url: 'https://cdn.jsdelivr.net/npm/codemirror@5.64.0/keymap/sublime.min.js',
-      args: {
-        integrity: '',
-      },
-    },
-    {
-      name: 'redoc-standalone',
-      url: 'https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js',
-      args: {
-        integrity: '',
-      },
-    },
-  ],
-  style: [
-    {
-      name: 'lato',
-      url: 'https://fonts.googleapis.com/css?family=Lato:400,700',
-      groups: ['basis'],
-      args: {
-        integrity: '',
-      },
-    },
-    {
-      name: 'Press Start 2P',
-      url: 'https://fonts.googleapis.com/css?family=Press+Start+2P',
-      groups: ['basis'],
-      args: {
-        integrity: '',
-      },
-    },
-    {
-      name: 'font-awesome',
-      url: 'https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css',
-      groups: ['basis'],
-      args: {
-        integrity: '',
-      },
-    },
-    {
-      name: 'themify-icons',
-      url: 'https://cdn.jsdelivr.net/npm/cd-themify-icons@0.0.1/index.min.css',
-      groups: ['basis'],
-      args: {
-        integrity: '',
-      },
-    },
-    {
-      name: 'simple-line-icons',
-      url: 'https://cdn.jsdelivr.net/npm/simple-line-icons@2.4.1/css/simple-line-icons.min.css',
-      groups: ['basis'],
-      args: {
-        integrity: '',
-      },
-    },
-    {
-      name: 'material-icons',
-      url: 'https://cdn.jsdelivr.net/npm/material-icons@0.3.1/iconfont/material-icons.min.css',
-      groups: ['basis'],
-      args: {
-        integrity: '',
-      },
-    },
-
-    {
-      name: 'animate.css',
-      url: 'https://cdn.jsdelivr.net/npm/animate.css@3.7.2/animate.min.css',
-      groups: ['basis'],
-      args: {
-        integrity: '',
-      },
-    },
-    {
-      name: 'highlight-theme-github',
-      url: 'https://cdn.jsdelivr.net/npm/highlight.js@9.13.0/styles/github.css',
-      args: {
-        integrity: '',
-      },
-    },
-    {
-      name: 'codemirror-dialog',
-      url: 'https://cdn.jsdelivr.net/npm/codemirror@5.64.0/addon/dialog/dialog.min.css',
-      args: {
-        integrity: '',
-      },
-    },
-    {
-      name: 'codemirror-theme-eclipse',
-      url: 'https://cdn.jsdelivr.net/npm/codemirror@5.64.0/theme/eclipse.min.css',
-      args: {
-        integrity: '',
-      },
-    },
-    {
-      name: 'codemirror-theme-elegant',
-      url: 'https://cdn.jsdelivr.net/npm/codemirror@5.64.0/theme/elegant.min.css',
-      args: {
-        integrity: '',
-      },
-    },
-    {
-      name: 'codemirror-theme-neo',
-      url: 'https://cdn.jsdelivr.net/npm/codemirror@5.64.0/theme/neo.min.css',
-      args: {
-        integrity: '',
-      },
-    },
-    {
-      name: 'codemirror-theme-mdn-like',
-      url: 'https://cdn.jsdelivr.net/npm/codemirror@5.64.0/theme/mdn-like.min.css',
-      args: {
-        integrity: '',
-      },
-    },
-    {
-      name: 'codemirror-theme-material',
-      url: 'https://cdn.jsdelivr.net/npm/codemirror@5.64.0/theme/material.min.css',
-      args: {
-        integrity: '',
-      },
-    },
-    {
-      name: 'codemirror-theme-dracula',
-      url: 'https://cdn.jsdelivr.net/npm/codemirror@5.64.0/theme/dracula.min.css',
-      args: {
-        integrity: '',
-      },
-    },
-    {
-      name: 'codemirror-theme-monokai',
-      url: 'https://cdn.jsdelivr.net/npm/codemirror@5.64.0/theme/monokai.min.css',
-      args: {
-        integrity: '',
-      },
-    },
-    {
-      name: 'codemirror-theme-twilight',
-      url: 'https://cdn.jsdelivr.net/npm/codemirror@5.64.0/theme/twilight.min.css',
-      args: {
-        integrity: '',
-      },
-    },
-  ],
-};

+ 0 - 15
apps/app/src/interfaces/interceptor-manager.ts

@@ -1,15 +0,0 @@
-interface BasicInterceptor {
-  getId: () => string,
-  isInterceptWhen: (contextName: string) => boolean,
-  isProcessableParallel: () => boolean,
-  process: (contextName: string, args: any) => Promise<any>
-}
-
-export interface IInterceptorManager {
-  interceptorAndOrders: {interceptor: BasicInterceptor, order: number}[],
-  interceptors: BasicInterceptor[],
-  addInterceptor: (inerceptor: BasicInterceptor, order: number) => void,
-  addInterceptors: (inerceptors: BasicInterceptor[], order: number) => void,
-  process: (contextName: string, args: any) => Promise<void>,
-  doProcess: (inerceptor: BasicInterceptor, contextName: string, args: any) => Promise<void>
-}

+ 0 - 2
apps/app/src/server/crowi/index.js

@@ -14,7 +14,6 @@ import { KeycloakUserGroupSyncService } from '~/features/external-user-group/ser
 import { LdapUserGroupSyncService } from '~/features/external-user-group/server/service/ldap-user-group-sync';
 import QuestionnaireService from '~/features/questionnaire/server/service/questionnaire';
 import QuestionnaireCronService from '~/features/questionnaire/server/service/questionnaire-cron';
-import CdnResourcesService from '~/services/cdn-resources-service';
 import Xss from '~/services/xss';
 import loggerFactory from '~/utils/logger';
 import { projectRoot } from '~/utils/project-dir-utils';
@@ -92,7 +91,6 @@ class Crowi {
     this.searchService = null;
     this.socketIoService = null;
     this.syncPageStatusService = null;
-    this.cdnResourcesService = new CdnResourcesService();
     this.slackIntegrationService = null;
     this.inAppNotificationService = null;
     this.activityService = null;

+ 0 - 172
apps/app/src/services/cdn-resources-service.js

@@ -1,172 +0,0 @@
-import loggerFactory from '~/utils/logger';
-import { resolveFromRoot } from '~/utils/project-dir-utils';
-
-const { URL } = require('url');
-const urljoin = require('url-join');
-
-const { envUtils } = require('@growi/core');
-
-const cdnLocalScriptRoot = 'public/static/js/cdn';
-const cdnLocalScriptWebRoot = '/static/js/cdn';
-const cdnLocalStyleRoot = 'public/static/styles/cdn';
-const cdnLocalStyleWebRoot = '/static/styles/cdn';
-
-
-class CdnResourcesService {
-
-  constructor() {
-    this.logger = loggerFactory('growi:service:CdnResourcesService');
-
-    this.loadManifests();
-  }
-
-  get noCdn() {
-    return envUtils.toBoolean(process.env.NO_CDN);
-  }
-
-  loadManifests() {
-    this.cdnManifests = require('^/resource/cdn-manifests');
-    this.logger.debug('manifest data loaded : ', this.cdnManifests);
-  }
-
-  getScriptManifestByName(name) {
-    const manifests = this.cdnManifests.js
-      .filter((manifest) => { return manifest.name === name });
-
-    return (manifests.length > 0) ? manifests[0] : null;
-  }
-
-  getStyleManifestByName(name) {
-    const manifests = this.cdnManifests.style
-      .filter((manifest) => { return manifest.name === name });
-
-    return (manifests.length > 0) ? manifests[0] : null;
-  }
-
-  /**
-   * download all resources from CDN and write to FS
-   *
-   * !! This method should be invoked only by /bin/download-cdn-resources when build client !!
-   *
-   * @param {CdnResourceDownloader} cdnResourceDownloader
-   */
-  async downloadAndWriteAll(cdnResourceDownloader) {
-    const CdnResource = require('~/models/cdn-resource');
-
-    const cdnScriptResources = this.cdnManifests.js.map((manifest) => {
-      const outDir = resolveFromRoot(cdnLocalScriptRoot);
-      return new CdnResource(manifest.name, manifest.url, outDir);
-    });
-    const cdnStyleResources = this.cdnManifests.style.map((manifest) => {
-      const outDir = resolveFromRoot(cdnLocalStyleRoot);
-      return new CdnResource(manifest.name, manifest.url, outDir);
-    });
-
-    const dlStylesOptions = {
-      replaceUrl: {
-        webroot: cdnLocalStyleWebRoot,
-      },
-    };
-
-    return Promise.all([
-      cdnResourceDownloader.downloadScripts(cdnScriptResources),
-      cdnResourceDownloader.downloadStyles(cdnStyleResources, dlStylesOptions),
-    ]);
-  }
-
-  /**
-   * Generate script tag string
-   *
-   * @param {Object} manifest
-   */
-  generateScriptTag(manifest) {
-    const attrs = [];
-    const args = manifest.args || {};
-
-    if (args.async) {
-      attrs.push('async');
-    }
-    if (args.defer) {
-      attrs.push('defer');
-    }
-
-    // TODO process integrity
-
-    const url = this.noCdn
-      ? `${urljoin(cdnLocalScriptWebRoot, manifest.name)}.js`
-      : manifest.url;
-    return `<script src="${url}" ${attrs.join(' ')}></script>`;
-  }
-
-  getScriptTagByName(name) {
-    const manifest = this.getScriptManifestByName(name);
-    return this.generateScriptTag(manifest);
-  }
-
-  getScriptTagsByGroup(group) {
-    return this.cdnManifests.js
-      .filter((manifest) => {
-        return manifest.groups != null && manifest.groups.includes(group);
-      })
-      .map((manifest) => {
-        return this.generateScriptTag(manifest);
-      });
-  }
-
-  /**
-   * Generate style tag string
-   *
-   * @param {Object} manifest
-   */
-  generateStyleTag(manifest) {
-    const attrs = [];
-    const args = manifest.args || {};
-
-    if (args.async) {
-      attrs.push('async');
-    }
-    if (args.defer) {
-      attrs.push('defer');
-    }
-
-    // TODO process integrity
-
-    const url = this.noCdn
-      ? `${urljoin(cdnLocalStyleWebRoot, manifest.name)}.css`
-      : manifest.url;
-
-    return `<link rel="stylesheet" href="${url}" ${attrs.join(' ')}>`;
-  }
-
-  getStyleTagByName(name) {
-    const manifest = this.getStyleManifestByName(name);
-    return this.generateStyleTag(manifest);
-  }
-
-  getStyleTagsByGroup(group) {
-    return this.cdnManifests.style
-      .filter((manifest) => {
-        return manifest.groups != null && manifest.groups.includes(group);
-      })
-      .map((manifest) => {
-        return this.generateStyleTag(manifest);
-      });
-  }
-
-  getHighlightJsStyleTag(styleName) {
-    let manifest = this.getStyleManifestByName('highlight-theme-github');
-
-    // replace style
-    if (!this.noCdn) {
-      const url = new URL(`${styleName}.css`, manifest.url); // resolve `${styleName}.css` from manifest.url
-
-      // clone manifest
-      manifest = Object.assign(manifest, { url: url.toString() });
-    }
-
-    return this.generateStyleTag(manifest);
-  }
-
-}
-
-module.exports = CdnResourcesService;

+ 0 - 107
apps/app/src/services/interceptor-manager.js

@@ -1,107 +0,0 @@
-import loggerFactory from '~/utils/logger';
-
-const logger = loggerFactory('growi:InterceptorManager');
-
-/**
- * the manager class of Interceptor
- */
-class InterceptorManager {
-
-  constructor() {
-    this.interceptorAndOrders = []; /* [
-                                          {interceptor: instanceA, order: 200 },
-                                          {interceptor: instanceB, order: 100 },
-                                          ...
-                                       ] */
-    this.interceptors = [];
-  }
-
-  /**
-   * add an Interceptor
-   * @param {BasicInterceptor} interceptor
-   * @param {number} order
-   */
-  addInterceptor(interceptor, order) {
-    this.addInterceptors([interceptor], order);
-  }
-
-  /**
-   * add Interceptors
-   * @param {BasicInterceptor[]} interceptors
-   * @param {number} order
-   */
-  addInterceptors(interceptors, order) {
-    let isDefaultOrder = false;
-    if (order == null) {
-      order = 100; // eslint-disable-line
-      isDefaultOrder = true;
-    }
-
-    const interceptorIds = interceptors.map((i) => { return i.getId() });
-    logger.info(`'addInterceptors' invoked. adding interceptors '${interceptorIds}' at order=${order}${isDefaultOrder ? '(default)' : ''}`);
-
-    this.interceptorAndOrders = this.interceptorAndOrders.concat(
-      interceptors.map((interceptor) => {
-        return { interceptor, order };
-      }),
-    );
-
-    // sort asc
-    this.interceptorAndOrders.sort((a, b) => { return a.order - b.order });
-    // store sorted list
-    this.interceptors = this.interceptorAndOrders.map((obj) => { return obj.interceptor });
-
-    const thisInterceptorIds = this.interceptors.map((i) => { return i.getId() });
-    logger.info(`interceptors list has initialized: ${thisInterceptorIds}`);
-  }
-
-  /**
-   * process Interceptors
-   *
-   * @param {string} contextName
-   * @param {any} args
-   */
-  process(contextName, ...args) {
-    logger.debug(`processing the context '${contextName}'`);
-
-    // filter only contexts matches to specified 'contextName'
-    const matchInterceptors = this.interceptors.filter((i) => { return i.isInterceptWhen(contextName) });
-
-    const parallels = matchInterceptors.filter((i) => { return i.isProcessableParallel() });
-    const sequentials = matchInterceptors.filter((i) => { return !i.isProcessableParallel() });
-
-    logger.debug(`${parallels.length} parallel interceptors found.`);
-    logger.debug(`${sequentials.length} sequencial interceptors found.`);
-
-    return Promise.all(
-      // parallel
-      parallels.map((interceptor) => {
-        return this.doProcess(interceptor, contextName, ...args);
-      })
-      // sequential
-        .concat([
-          sequentials.reduce((prevPromise, nextInterceptor) => {
-            return prevPromise.then((...results) => { return this.doProcess(nextInterceptor, contextName, ...results) });
-          }, Promise.resolve(...args)/* initial Promise */),
-        ]),
-    ).then(() => {
-      logger.debug(`end processing the context '${contextName}'`);
-    });
-  }
-
-  doProcess(interceptor, contextName, ...args) {
-    return interceptor.process(contextName, ...args)
-      .then((...results) => {
-        logger.debug(`processing '${interceptor.getId()}' in the context '${contextName}'`);
-        return Promise.resolve(...results);
-      })
-      .catch((reason) => {
-        logger.debug(`failed when processing '${interceptor.getId()}' in the context '${contextName}'`);
-        logger.debug(reason);
-        return Promise.resolve(...args);
-      });
-  }
-
-}
-
-export default InterceptorManager;

+ 0 - 5
apps/app/src/stores/context.tsx

@@ -6,7 +6,6 @@ import useSWRImmutable from 'swr/immutable';
 
 import type { SupportedActionType } from '~/interfaces/activity';
 import type { RendererConfig } from '~/interfaces/services/renderer';
-import InterceptorManager from '~/services/interceptor-manager';
 
 import type { TargetAndAncestors } from '../interfaces/page-listing-results';
 
@@ -17,10 +16,6 @@ import { useStaticSWR } from './use-static-swr';
 type Nullable<T> = T | null;
 
 
-export const useInterceptorManager = (): SWRResponse<InterceptorManager, Error> => {
-  return useContextSWR<InterceptorManager, Error>('interceptorManager', undefined, { fallbackData: new InterceptorManager() });
-};
-
 export const useCsrfToken = (initialData?: string): SWRResponse<string, Error> => {
   return useContextSWR<string, Error>('csrfToken', initialData);
 };

+ 0 - 45
packages/core/src/utils/basic-interceptor.js

@@ -1,45 +0,0 @@
-/**
- * Basic Interceptor class
- */
-export class BasicInterceptor {
-
-  /**
-   * getter for id
-   */
-  getId() {
-    return this.constructor.name;
-  }
-
-  /**
-   * return whether this interceptor works by specified contextName
-   *
-   * @param {string} contextName
-   * @return {boolean}
-   */
-  isInterceptWhen(contextName) {
-    // implement this
-    return false;
-  }
-
-  /**
-   * return whether this interceptor processes in parallel mode or sequencial mode
-   * @return {boolean}
-   */
-  isProcessableParallel() {
-    // implement this
-    return true;
-  }
-
-  /**
-   * process method
-   *
-   * @param {string} contextName
-   * @param {any} args
-   * @return {Promise<any>}
-   */
-  process(contextName, ...args) {
-    // override this
-    return Promise.resolve(...args);
-  }
-
-}

+ 0 - 1
packages/core/src/utils/index.ts

@@ -10,6 +10,5 @@ export * as pagePathUtils from './page-path-utils';
 export * as pathUtils from './path-utils';
 export * as pageUtils from './page-utils';
 
-export * from './basic-interceptor';
 export * from './browser-utils';
 export * from './growi-theme-metadata';