Skip to content

Commit

Permalink
Revert parcel renames back to atlaspack
Browse files Browse the repository at this point in the history
  • Loading branch information
MonicaOlejniczak committed Aug 23, 2024
1 parent b6cbae5 commit 46da87c
Show file tree
Hide file tree
Showing 36 changed files with 86 additions and 76 deletions.
44 changes: 22 additions & 22 deletions packages/core/core/test/Atlaspack.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import WorkerFarm from '@atlaspack/workers';
import sinon from 'sinon';
import assert from 'assert';
import path from 'path';
import Parcel, {createWorkerFarm} from '../src/Atlaspack';
import Atlaspack, {createWorkerFarm} from '../src/Atlaspack';

describe('Atlaspack', function () {
this.timeout(75000);
Expand All @@ -20,18 +20,18 @@ describe('Atlaspack', function () {

it('does not initialize when passed an ending farm', async () => {
workerFarm.ending = true;
let parcel = createAtlaspack({workerFarm});
let atlaspack = createAtlaspack({workerFarm});

// $FlowFixMe
await assert.rejects(() => parcel.run(), {
await assert.rejects(() => atlaspack.run(), {
name: 'Error',
message: 'Supplied WorkerFarm is ending',
});

workerFarm.ending = false;
});

describe('parcel.end()', () => {
describe('atlaspack.end()', () => {
let endSpy;
beforeEach(() => {
endSpy = sinon.spy(WorkerFarm.prototype, 'end');
Expand All @@ -42,31 +42,31 @@ describe('Atlaspack', function () {
});

it('ends any WorkerFarm it creates', async () => {
let parcel = createAtlaspack();
await parcel.run();
let atlaspack = createAtlaspack();
await atlaspack.run();
assert.equal(endSpy.callCount, 1);
});

it('runs and constructs another farm for subsequent builds', async () => {
let parcel = createAtlaspack();
let atlaspack = createAtlaspack();

await parcel.run();
await parcel.run();
await atlaspack.run();
await atlaspack.run();

assert.equal(endSpy.callCount, 2);
});

it('does not end passed WorkerFarms', async () => {
let parcel = createAtlaspack({workerFarm});
await parcel.run();
let atlaspack = createAtlaspack({workerFarm});
await atlaspack.run();
assert.equal(endSpy.callCount, 0);

await workerFarm.end();
});

it('removes shared references it creates', async () => {
let parcel = createAtlaspack({workerFarm});
await parcel.run();
let atlaspack = createAtlaspack({workerFarm});
await atlaspack.run();

assert.equal(workerFarm.sharedReferences.size, 0);
assert.equal(workerFarm.sharedReferencesByValue.size, 0);
Expand All @@ -85,19 +85,19 @@ describe('AtlaspackAPI', function () {

afterEach(() => workerFarm.end());

describe('parcel.unstable_transform()', () => {
describe('atlaspack.unstable_transform()', () => {
it('should transform simple file', async () => {
let parcel = createAtlaspack({workerFarm});
let res = await parcel.unstable_transform({
let atlaspack = createAtlaspack({workerFarm});
let res = await atlaspack.unstable_transform({
filePath: path.join(__dirname, 'fixtures/atlaspack/index.js'),
});
let code = await res[0].getCode();
assert(code.includes(`exports.default = 'test'`));
});

it('should transform with standalone mode', async () => {
let parcel = createAtlaspack({workerFarm});
let res = await parcel.unstable_transform({
let atlaspack = createAtlaspack({workerFarm});
let res = await atlaspack.unstable_transform({
filePath: path.join(__dirname, 'fixtures/atlaspack/other.js'),
query: 'standalone=true',
});
Expand All @@ -109,10 +109,10 @@ describe('AtlaspackAPI', function () {
});
});

describe('parcel.resolve()', () => {
describe('atlaspack.resolve()', () => {
it('should resolve dependencies', async () => {
let parcel = createAtlaspack({workerFarm});
let res = await parcel.unstable_resolve({
let atlaspack = createAtlaspack({workerFarm});
let res = await atlaspack.unstable_resolve({
specifier: './other',
specifierType: 'esm',
resolveFrom: path.join(__dirname, 'fixtures/atlaspack/index.js'),
Expand All @@ -129,7 +129,7 @@ describe('AtlaspackAPI', function () {
});

function createAtlaspack(opts?: InitialAtlaspackOptions) {
return new Parcel({
return new Atlaspack({
entries: [path.join(__dirname, 'fixtures/atlaspack/index.js')],
logLevel: 'info',
defaultConfig: path.join(
Expand Down
2 changes: 1 addition & 1 deletion packages/core/fs/src/NodeFS.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const realpath = promisify(
const isPnP = process.versions.pnp != null;

function getWatchmanWatcher(): typeof watcher {
// This is here to trick parcel into ignoring this require...
// This is here to trick atlaspack into ignoring this require...
const packageName = ['@atlaspack', 'watcher-watchman-js'].join('/');

// $FlowFixMe
Expand Down
2 changes: 1 addition & 1 deletion packages/core/fs/src/OverlayFS.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export class OverlayFS implements FileSystem {
) {
return true;
} else {
// HACK: Parcel fs does not provide `lstatSync`,
// HACK: Atlaspack fs does not provide `lstatSync`,
// so we use `readdirSync` to check if the path is a symlink.
let parent = path.resolve(filePath, '..');
if (parent === filePath) {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/integration-tests/test/atlaspack-register.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe.skip('@atlaspack/register', () => {
);
});

it("enables Parcel's resolver in node", () => {
it("enables Atlaspacks's resolver in node", () => {
let [foo, resolved] = execSync(
`node -r @atlaspack/register ${path.join(
__dirname,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/integration-tests/test/atlaspack-v3.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ describe('AtlaspackV3', function () {
yarn.lock: {}
`;

let parcel = new AtlaspackV3({
let atlaspack = new AtlaspackV3({
corePath: '',
entries: [join(__dirname, 'index.js')],
fs: toFileSystemV3(overlayFS),
nodeWorkers: 1,
packageManager: new NodePackageManager(inputFS, __dirname),
});

await parcel.build();
await atlaspack.build();
});
});
16 changes: 11 additions & 5 deletions packages/core/integration-tests/test/babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {spawnSync} from 'child_process';
import tempy from 'tempy';
import {md} from '@atlaspack/diagnostic';

const parcelCli = require.resolve('@atlaspack/cli/src/bin.js');
const atlaspackCli = require.resolve('@atlaspack/cli/src/bin.js');
const inputDir = path.join(__dirname, '/input');

describe.v2('babel', function () {
Expand Down Expand Up @@ -244,7 +244,7 @@ describe.v2('babel', function () {
await outputFS.rimraf(path.join(fixtureDir, 'dist'));
});

it('should support building with custom babel config when running parcel globally', async function () {
it('should support building with custom babel config when running atlaspack globally', async function () {
let tmpDir = tempy.directory();
let distDir = path.join(tmpDir, 'dist');
await fs.ncp(
Expand Down Expand Up @@ -349,7 +349,7 @@ describe.v2('babel', function () {
assert(file.includes('class Foo'));
});

it('should be "production" if Parcel is run in production mode', async () => {
it('should be "production" if Atlaspack is run in production mode', async () => {
await bundle(
path.join(__dirname, '/integration/babel-env-name/index.js'),
{
Expand Down Expand Up @@ -470,7 +470,7 @@ describe.v2('babel', function () {
spawnSync(
'node',
[
parcelCli,
atlaspackCli,
'build',
'src/index.js',
'--no-optimize',
Expand Down Expand Up @@ -512,7 +512,13 @@ describe.v2('babel', function () {
let build = () =>
spawnSync(
'node',
[parcelCli, 'build', 'index.js', '--no-optimize', '--no-scope-hoist'],
[
atlaspackCli,
'build',
'index.js',
'--no-optimize',
'--no-scope-hoist',
],
{
cwd: inputDir,
env: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "parcel-cache-tests",
"name": "atlaspack-cache-tests",
"version": "1.0.0",
"private": true
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Adopted from https://github.com/nartallax/atlaspack-css-bug
// Adopted from https://github.com/nartallax/parcel-css-bug
// To address https://github.com/parcel-bundler/parcel/issues/8716
import * as aCss from "./a.module.css"
import * as bCss from "./b.module.css"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<html>
<head>
<meta charset="utf-8" />
<title>Parcel encoded-URI testing</title>
<title>Atlaspack encoded-URI testing</title>
</head>
<body>
<H1>Parcel encoded-URI testing</H1>
<img alt="日本語" src="%e6%97%a5%e6%9c%ac%e8%aa%9e.jpg" />
<H1>Atlaspack encoded-URI testing</H1>
<img alt="日本語" src="%e6%97%a5%e6%9c%ac%e8%aa%9e.jpg" />
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Inline JavaScript Parcel</title>
<title>Inline CoffeeScript</title>
</head>
<body>
<script type="application/coffee">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Inline JavaScript Parcel</title>
<title>Inline JavaScript Module</title>
</head>
<body>
<script type="module">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Inline JavaScript Parcel</title>
<title>Inline JavaScript</title>
</head>
<body>
<script type="module">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Inline JavaScript Parcel</title>
<title>Inline JavaScript</title>
</head>
<body>
<script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Inline JavaScript Parcel</title>
<title>Inline Sass</title>
</head>
<body>
<style type="text/sass">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Inline JavaScript Parcel</title>
<title>Inline Styles</title>
</head>
<body>
<style>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import './Foo/foo.css';
will be named `index.css` as expected, but there will be no name collision
because this file did not generate an `index.css` asset itself.
Also, if parcel is run with a cache, on the first execution the
Also, if atlaspack is run with a cache, on the first execution the
AssertionError for the bundle group will be raised. However, on a second
execution, the AssertError will not occur, but the generated `index.css` will
only contain the content of `foo.css` and be missing the content of
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
console.log("Parcel might overwrite index.html");
console.log("Atlaspack might overwrite index.html");
Original file line number Diff line number Diff line change
@@ -1 +1 @@
console.log('I hope Parcel does not overwrite me.');
console.log('I hope Atlaspack does not overwrite me.');
Original file line number Diff line number Diff line change
@@ -1 +1 @@
console.log('I hope Parcel does not overwrite me.');
console.log('I hope Atlaspack does not overwrite me.');
Original file line number Diff line number Diff line change
@@ -1 +1 @@
console.log('I hope Parcel does not overwrite me.');
console.log('I hope Atlaspack does not overwrite me.');
2 changes: 1 addition & 1 deletion packages/core/integration-tests/test/worklets.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
runBundle,
} from '@atlaspack/test-utils';

describe.v2('parcel', function () {
describe.v2('atlaspack', function () {
beforeEach(async () => {
await removeDistDirectory();
});
Expand Down
18 changes: 11 additions & 7 deletions packages/core/register/src/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import defaultConfigContents from '@atlaspack/config-default';
import Module from 'module';
import path from 'path';
import {addHook} from 'pirates';
import Parcel, {INTERNAL_RESOLVE, INTERNAL_TRANSFORM} from '@atlaspack/core';
import Atlaspack, {INTERNAL_RESOLVE, INTERNAL_TRANSFORM} from '@atlaspack/core';

import syncPromise from './syncPromise';

Expand All @@ -34,7 +34,7 @@ function register(inputOpts?: InitialAtlaspackOptions): IDisposable {
lastDisposable.dispose();
}

let parcel = new Parcel({
let atlaspack = new Atlaspack({
logLevel: 'error',
...opts,
});
Expand All @@ -46,11 +46,11 @@ function register(inputOpts?: InitialAtlaspackOptions): IDisposable {
},
};

syncPromise(parcel._init());
syncPromise(atlaspack._init());

let isProcessing = false;

// As Parcel is pretty much fully asynchronous, create an async function and wrap it in a syncPromise later...
// As Atlaspack is pretty much fully asynchronous, create an async function and wrap it in a syncPromise later...
async function fileProcessor(code, filePath) {
if (isProcessing) {
return code;
Expand All @@ -59,7 +59,7 @@ function register(inputOpts?: InitialAtlaspackOptions): IDisposable {
try {
isProcessing = true;
// $FlowFixMe
let result = await parcel[INTERNAL_TRANSFORM]({
let result = await atlaspack[INTERNAL_TRANSFORM]({
filePath,
env,
});
Expand Down Expand Up @@ -92,7 +92,7 @@ function register(inputOpts?: InitialAtlaspackOptions): IDisposable {

let resolved = syncPromise(
// $FlowFixMe
parcel[INTERNAL_RESOLVE]({
atlaspack[INTERNAL_RESOLVE]({
specifier: targetFile,
sourcePath: currFile,
env,
Expand Down Expand Up @@ -126,7 +126,11 @@ function register(inputOpts?: InitialAtlaspackOptions): IDisposable {
// $FlowFixMe[prop-missing]
const originalResolveFilename = Module._resolveFilename;
// $FlowFixMe[prop-missing]
Module._resolveFilename = function parcelResolveFilename(to, from, ...rest) {
Module._resolveFilename = function atlaspackResolveFilename(
to,
from,
...rest
) {
return isProcessing || disposed
? originalResolveFilename(to, from, ...rest)
: resolveFile(from?.filename, to);
Expand Down
Loading

0 comments on commit 46da87c

Please sign in to comment.