How to use the snack-sdk.isModulePreloaded function in snack-sdk

To help you get started, we’ve selected a few snack-sdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github expo / snack-web / src / client / components / DependencyManager.tsx View on Github external
const dependencies = dependencyQueryParam.split(',').reduce((acc, curr) => {
      const first = curr.slice(0, 1);

      // remove the first letter so we don't match stuff like `@expo/` when splitting
      const [dep, version] = curr.slice(1).split('@');
      const name = first + dep;

      if (isModulePreloaded(name, this.props.sdkVersion)) {
        return acc;
      }

      return {
        ...acc,
        [name]: version || null,
      };
    }, {});
github expo / snack-web / snack / components / DependencyManager.js View on Github external
({ name }) =>
                  // If the dependency is already in props, or is in progress, don't add them
                  !(
                    dependencies[name] ||
                    this.props.dependencies[name] ||
                    isModulePreloaded(name, this.props.sdkVersion)
                  )
              )
github expo / snack-web / src / client / components / DependencyManager.tsx View on Github external
({ name }) =>
                  // If the dependency is already in props, or is in progress, don't add them
                  !(
                    dependencies[name] ||
                    this.props.dependencies[name] ||
                    isModulePreloaded(name, this.props.sdkVersion)
                  )
              )
github expo / snack-web / src / client / utils / lintPackageJson.tsx View on Github external
.map((it: any) => {
        if (isModulePreloaded(it.key.value, sdkVersion)) {
          return {
            startLineNumber: it.key.loc.start.line,
            endLineNumber: it.key.loc.end.line,
            startColumn: it.key.loc.start.column,
            endColumn: it.key.loc.end.column,
            message: `The package "${
              it.key.value
            }" can be imported without adding to "dependencies"`,
            severity: 3,
            source,
          };
        }

        if (
          it.value.type !== 'Literal' ||
          !(semver.validRange(it.value.value) || it.value.value === 'latest')
github expo / snack-web / snack / utils / lintPackageJson.js View on Github external
.map(it => {
        if (isModulePreloaded(it.key.value, sdkVersion)) {
          return {
            startLineNumber: it.key.loc.start.line,
            endLineNumber: it.key.loc.end.line,
            startColumn: it.key.loc.start.column,
            endColumn: it.key.loc.end.column,
            message: `The package "${it.key
              .value}" can be imported without adding to "dependencies"`,
            severity: 3,
            source,
          };
        }

        if (
          it.value.type !== 'Literal' ||
          !(semver.validRange(it.value.value) || it.value.value === 'latest')
        ) {
github expo / snack-web / src / client / components / DependencyManager.tsx View on Github external
      pickBy(deps, (_, name) => !isModulePreloaded(name, this.props.sdkVersion))
    );
github expo / snack-web / src / client / components / FileList / FileList.tsx View on Github external
(acc: { [key: string]: string }, name) => {
                          if (!isModulePreloaded(name, this.props.sdkVersion)) {
                            acc[name] = next.dependencies[name];
                          }

                          return acc;
                        },
                        {}

snack-sdk

The Expo Snack SDK

MIT
Latest version published 18 days ago

Package Health Score

73 / 100
Full package analysis

Similar packages