How to use the @parcel/diagnostic.getJSONSourceLocation function in @parcel/diagnostic

To help you get started, we’ve selected a few @parcel/diagnostic 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 parcel-bundler / parcel / packages / core / core / src / TargetResolver.js View on Github external
if (typeof targetDist === 'string' || pkgTargets[targetName]) {
        let distDir;
        let distEntry;
        let loc;

        invariant(typeof pkgFilePath === 'string');
        invariant(pkgMap != null);

        let _descriptor: mixed = pkgTargets[targetName] || {};
        if (typeof targetDist === 'string') {
          distDir = path.resolve(pkgDir, path.dirname(targetDist));
          distEntry = path.basename(targetDist);
          loc = {
            filePath: pkgFilePath,
            ...getJSONSourceLocation(pkgMap.pointers[pointer], 'value'),
          };
        } else {
          distDir = path.resolve(pkgDir, DEFAULT_DIST_DIRNAME, targetName);
        }

        let descriptor = parseDescriptor(
          targetName,
          _descriptor,
          pkgFilePath,
          pkgContents,
        );
        let isLibrary =
          typeof distEntry === 'string'
            ? path.extname(distEntry) === '.js'
            : false;
        targets.set(targetName, {
github parcel-bundler / parcel / packages / core / core / src / TargetResolver.js View on Github external
type: 'value',
                    message: 'Expected type string',
                  },
                ]),
              },
            },
          });
        }
        distDir = path.resolve(pkgDir, path.dirname(distPath));
        distEntry = path.basename(distPath);

        invariant(typeof pkgFilePath === 'string');
        invariant(pkgMap != null);
        loc = {
          filePath: pkgFilePath,
          ...getJSONSourceLocation(pkgMap.pointers[`/${targetName}`], 'value'),
        };
      }

      if (_descriptor) {
        let descriptor = parseDescriptor(
          targetName,
          _descriptor,
          pkgFilePath,
          pkgContents,
        );
        targets.set(targetName, {
          name: targetName,
          distDir,
          distEntry,
          publicUrl: descriptor.publicUrl ?? '/',
          env: createEnvironment({

@parcel/diagnostic

Types and utilities for printing source-code located errors, warning and information messages.

MIT
Latest version published 5 days ago

Package Health Score

89 / 100
Full package analysis

Similar packages