Skip to content

Commit

Permalink
ESM and import fixes (#41)
Browse files Browse the repository at this point in the history
* Stashed changes to imports and esm build

* Restore earlier import

* Add changelog entry
  • Loading branch information
spautz committed Sep 19, 2022
1 parent d2ceb8e commit f598f24
Show file tree
Hide file tree
Showing 17 changed files with 67 additions and 47 deletions.
6 changes: 6 additions & 0 deletions .changeset/silver-ties-deny.md
@@ -0,0 +1,6 @@
---
'@dynamic-selectors/core': patch
'@dynamic-selectors/with-reselect': patch
---

Include esm-related fixes that were supposed to be in v1.1.0
6 changes: 3 additions & 3 deletions packages/core/package.json
Expand Up @@ -67,7 +67,7 @@
"____ INDIVIDUAL COMMANDS ___________________________________________": "",
"build": "pnpm run build:main && pnpm run size && pnpm run build:legacytypes",
"build:clean": "rimraf ./dist ./legacy-types",
"build:main": "pnpm run build:clean && tsup src/index.ts ./src/index.devOnly.ts --format esm,cjs && tsc -p ./tsconfig.build.json --declaration --emitDeclarationOnly",
"build:main": "pnpm run build:clean && tsup src/index.ts ./src/index.devOnly.ts --format cjs && tsc -p ./tsconfig.build.json",
"build:legacytypes": "pnpm run build:legacytypes:3.5 && pnpm run build:legacytypes:4.0 && pnpm run build:legacytypes:4.5",
"build:legacytypes:3.5": "downlevel-dts ./dist ./legacy-types/ts3.5 --to=3.5",
"build:legacytypes:4.0": "downlevel-dts ./dist ./legacy-types/ts4.0 --to=4.0",
Expand All @@ -88,11 +88,11 @@
"types": "tsc -p ./tsconfig.json --noEmit"
},
"dependencies": {
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
"shallowequal": "^1.1.0"
},
"devDependencies": {
"@types/lodash": "4.14.185",
"@types/lodash-es": "4.17.6",
"@types/node": "18.7.18",
"@types/shallowequal": "1.1.1"
},
Expand Down
14 changes: 9 additions & 5 deletions packages/core/src/createDynamicSelector.ts
@@ -1,14 +1,18 @@
import get from 'lodash/get.js';
import { get } from 'lodash-es';
import shallowEqual from 'shallowequal';

import { dynamicSelectorForState } from './dynamicSelectorForState';
import type { DynamicSelectorResultCache, DynamicSelectorResultEntry } from './internals';
import { dynamicSelectorForState } from './dynamicSelectorForState.js';
import type { DynamicSelectorResultCache, DynamicSelectorResultEntry } from './internals/index.js';
import type {
DefaultStateType,
DynamicSelectorOptions,
DynamicSelectorStateOptions,
} from './types';
import { DynamicSelectorFnFromInnerFn, DynamicSelectorInnerFn, RemoveFirstElement } from './types';
} from './types.js';
import {
DynamicSelectorFnFromInnerFn,
DynamicSelectorInnerFn,
RemoveFirstElement,
} from './types.js';

/**
* Default cache for dynamic-selector call results
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/devOnlyUtils/DebugInfoCheckUtil.ts
@@ -1,6 +1,6 @@
/* c8 ignore start */

import type { DynamicSelectorDebugInfo } from '../internals/debugInfo';
import type { DynamicSelectorDebugInfo } from '../internals/debugInfo.js';
import {
createDebugInfo,
debugAbortedRun,
Expand All @@ -9,8 +9,8 @@ import {
debugInvoked,
debugPhantomRun,
debugSkippedRun,
} from '../internals/debugInfo';
import type { AnyDynamicSelectorFn, DynamicSelectorParams } from '../types';
} from '../internals/debugInfo.js';
import type { AnyDynamicSelectorFn, DynamicSelectorParams } from '../types.js';

type ExpectedDebugInfoEntryType = 'depCheck' | 'invoked';
type ExpectedDebugInfoResultType = 'skipped' | 'phantom' | 'run' | 'aborted';
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/dynamicSelectorForState.ts
Expand Up @@ -2,7 +2,7 @@ import type {
DynamicSelectorDebugInfo,
DynamicSelectorResultCache,
DynamicSelectorResultEntry,
} from './internals';
} from './internals/index.js';
import {
RESULT_ENTRY__STATE_OPTIONS,
RESULT_ENTRY__STATE,
Expand All @@ -29,7 +29,7 @@ import {
pushCallStackEntry,
validateOptions,
validateStateOptions,
} from './internals';
} from './internals/index.js';
import type {
DefaultExtraArgsType,
DefaultReturnType,
Expand All @@ -40,8 +40,8 @@ import type {
DynamicSelectorParams,
DynamicSelectorStateOptions,
StatePath,
} from './types';
import { DynamicSelectorFnFromInnerFn, RemoveFirstElement } from './types';
} from './types.js';
import { DynamicSelectorFnFromInnerFn, RemoveFirstElement } from './types.js';

const dynamicSelectorForState = <StateType = DefaultStateType>(
stateOptions: DynamicSelectorStateOptions<StateType>,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/index.devOnly.ts
@@ -1,2 +1,2 @@
export * from './devOnlyUtils/DebugInfoCheckUtil';
export * from './types';
export * from './devOnlyUtils/DebugInfoCheckUtil.js';
export * from './types.js';
6 changes: 3 additions & 3 deletions packages/core/src/index.ts
@@ -1,4 +1,4 @@
export * from './createDynamicSelector';
export * from './dynamicSelectorForState';
export * from './createDynamicSelector.js';
export * from './dynamicSelectorForState.js';

export * from './types';
export * from './types.js';
2 changes: 1 addition & 1 deletion packages/core/src/internals/callStack.ts
@@ -1,4 +1,4 @@
import type { DynamicSelectorResultEntry } from './resultCache';
import type { DynamicSelectorResultEntry } from './resultCache.js';

/**
* The CallStack tracks Results which aren't yet finished: when any Dynamic Selector is run, its (pending) Result
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/internals/dependencies.ts
@@ -1,14 +1,14 @@
import { popCallStackEntry, pushCallStackEntry } from './callStack';
import { popCallStackEntry, pushCallStackEntry } from './callStack.js';
import {
createDepCheckEntry,
RESULT_ENTRY__HAS_RETURN_VALUE,
RESULT_ENTRY__RETURN_VALUE,
} from './resultCache';
} from './resultCache.js';
import type {
DynamicSelectorFnFromTypes,
DynamicSelectorParams,
DynamicSelectorStateGetFn,
} from '../types';
} from '../types.js';

/**
* We track wo types of dependencies:
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/internals/index.ts
@@ -1,5 +1,5 @@
export * from './callStack';
export * from './debugInfo';
export * from './dependencies';
export * from './resultCache';
export * from './validateOptions';
export * from './callStack.js';
export * from './debugInfo.js';
export * from './dependencies.js';
export * from './resultCache.js';
export * from './validateOptions.js';
10 changes: 5 additions & 5 deletions packages/core/src/internals/resultCache.ts
@@ -1,11 +1,11 @@
import { getTopCallStackEntry } from './callStack';
import type { DynamicSelectorDebugInfo } from './debugInfo';
import { createDebugInfo } from './debugInfo';
import { getTopCallStackEntry } from './callStack.js';
import type { DynamicSelectorDebugInfo } from './debugInfo.js';
import { createDebugInfo } from './debugInfo.js';
import type {
DynamicSelectorCallDependencies,
DynamicSelectorStateDependencies,
} from './dependencies';
import type { DynamicSelectorStateOptions } from '../types';
} from './dependencies.js';
import type { DynamicSelectorStateOptions } from '../types.js';

/**
* This is where things happen: this tracks everything about a single Dynamic Selector call: what was called,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/internals/validateOptions.ts
@@ -1,4 +1,4 @@
import type { DynamicSelectorOptions, DynamicSelectorStateOptions } from '../types';
import type { DynamicSelectorOptions, DynamicSelectorStateOptions } from '../types.js';

const validateOptions = (options: DynamicSelectorOptions) => {
/* c8 ignore start */
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/types.ts
Expand Up @@ -4,7 +4,7 @@ import type {
DynamicSelectorDebugInfo,
DynamicSelectorResultCache,
DynamicSelectorResultEntry,
} from './internals';
} from './internals/index.js';

type AnyPrimitive = boolean | number | string | null | undefined;

Expand Down
2 changes: 1 addition & 1 deletion packages/with-reselect/package.json
Expand Up @@ -62,7 +62,7 @@
"____ INDIVIDUAL COMMANDS ___________________________________________": "",
"build": "pnpm run build:main && pnpm run size && pnpm run build:legacytypes",
"build:clean": "rimraf ./dist ./legacy-types",
"build:main": "pnpm run build:clean && tsup src/index.ts --format esm,cjs && tsc -p ./tsconfig.build.json --declaration --emitDeclarationOnly",
"build:main": "pnpm run build:clean && tsup src/index.ts --format cjs && tsc -p ./tsconfig.build.json",
"build:legacytypes": "pnpm run build:legacytypes:3.5 && pnpm run build:legacytypes:4.0 && pnpm run build:legacytypes:4.5",
"build:legacytypes:3.5": "downlevel-dts ./dist ./legacy-types/ts3.5 --to=3.5",
"build:legacytypes:4.0": "downlevel-dts ./dist ./legacy-types/ts4.0 --to=4.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/with-reselect/src/index.ts
@@ -1,2 +1,2 @@
export * from './dynamicSelectorFromReselect';
export * from './reselectSelectorFromDynamic';
export * from './dynamicSelectorFromReselect.js';
export * from './reselectSelectorFromDynamic.js';
25 changes: 18 additions & 7 deletions pnpm-lock.yaml

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

1 change: 0 additions & 1 deletion scripts/full-everything.sh
Expand Up @@ -13,7 +13,6 @@ source ./scripts/helpers/helpers.sh
echo "Going to doing everything: this will take a while..."
./scripts/clean-everything.sh
./scripts/setup-environment.sh
./scripts/full-ci.sh
./scripts/build-everything.sh

###################################################################################################
Expand Down

0 comments on commit f598f24

Please sign in to comment.