profile
viewpoint
Dmitrii Kanatnikov rifler Moscow

bem-node/schema-check-mongo-wrapper 0

Wrapper around native mongodb javascript driver, that provides promise-like interface and data validation with json schema

bem-node/vow-with-domain 0

ES6-compatible and Promises/A+ implementation for Node.js and browsers

rifler/advanced-react-patterns 0

This project contains the implementation of advanced react patterns as presented by Kent C. Dodds in his course on https://egghead.io/courses/advanced-react-component-patterns.

rifler/amphtml 0

AMP HTML source code, samples, and documentation. See below for more info.

rifler/angular 0

One framework. Mobile & desktop.

rifler/babel 0

:tropical_fish: Babel is a compiler for writing next generation JavaScript.

rifler/bem-deps 0

🎯 Manage BEM dependencies

rifler/bem-react-core 0

Core library for develop with React-like libs and BEM methodology

issue commentSchniz/fnm

node 12.19.0: Cannot find module '../lib/utils/unsupported.js'

@Schniz maybe there is a way to install specific version of fnm?

rifler

comment created time in 5 days

issue commentSchniz/fnm

node 12.19.0: Cannot find module '../lib/utils/unsupported.js'

this issue appeared today

rifler

comment created time in 5 days

issue openedSchniz/fnm

node 12.19.0: Cannot find module '../lib/utils/unsupported.js'

while calling npm --version

internal/modules/cjs/loader.js:834
  throw err;
  ^

Error: Cannot find module '../lib/utils/unsupported.js'
Require stack:
- /home/sandbox/.fnm/node-versions/v12.19.0/installation/bin/npm
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15)
    at Function.Module._load (internal/modules/cjs/loader.js:687:27)
    at Module.require (internal/modules/cjs/loader.js:903:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at /home/sandbox/.fnm/node-versions/v12.19.0/installation/bin/npm:19:21
    at Object.<anonymous> (/home/sandbox/.fnm/node-versions/v12.19.0/installation/bin/npm:155:3)
    at Module._compile (internal/modules/cjs/loader.js:1015:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
    at Module.load (internal/modules/cjs/loader.js:879:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/home/sandbox/.fnm/node-versions/v12.19.0/installation/bin/npm' ]
}

created time in 5 days

issue commentsindresorhus/type-fest

Proposal: Tail

for example some of latest release of got brokes many of our types, changed type of context field lets patch some of the types

import { BeforeRedirectHook as GotBeforeRedirectHook, NormalizedOptions } from 'got';

type PatchedNormalizedOptions = Omit<NormalizedOptions, 'context'> & {
    context?: YourType;
};

type BeforeRedirectHook = (options: PatchedNormalizedOptions, ...args: Tail<Parameters<GotBeforeRedirectHook>>) => ReturnType<GotBeforeRedirectHook>;

here I overrite first argument and use Tail to add original arguments to the end

rifler

comment created time in 9 days

issue openedsindresorhus/type-fest

Proposal: Tail

type Tail<T extends any[]> = ((...args: T) => any) extends ((_: any, ...args: infer P) => any) ? P : [];

Tail<[1, 2, 3]> // [2, 3]

created time in 9 days

Pull request review commentsindresorhus/ky

add "main", "module" and "types" field

 	"license": "MIT", 	"repository": "sindresorhus/ky", 	"funding": "https://github.com/sindresorhus/ky?sponsor=1",+	"main": "./umd.js",

why it will break all the things?

rifler

comment created time in 18 days

Pull request review commentsindresorhus/ky

add "main", "module" and "types" field

 	"license": "MIT", 	"repository": "sindresorhus/ky", 	"funding": "https://github.com/sindresorhus/ky?sponsor=1",+	"main": "./umd.js",+	"module": "./index.js",+	"browser": "./index.js",+	"unpkg": "./index.js",+	"types": "./index.d.ts",

Ok, I thought that explicit it better than implicit

rifler

comment created time in 18 days

PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commentsindresorhus/ky

add "main", "module" and "types" field

 	"license": "MIT", 	"repository": "sindresorhus/ky", 	"funding": "https://github.com/sindresorhus/ky?sponsor=1",+	"main": "./umd.js",

Ok! will it work for webpack 4 for example?

rifler

comment created time in 18 days

PullRequestReviewEvent

issue commentsindresorhus/ky

add "main", "module" and "types" field

All I want to say, that current selected way (main is esm) is very uncommon and breaks many scenarios

ecosystem is not ready yet for this

in the next few days I will create fork of ky (if this PR will not merge), and I feel sad about it

rifler

comment created time in 23 days

pull request commentsindresorhus/ky

add "main", "module" and "types" field

Sindre and I prefer to use lockfiles in apps but not in reusable libraries. There's a lot of discussion about it on Sindre's AMA if you want to dig into that more. Anyway, thanks for fixing it.

npm never publish lock file (and doesn't use it in dependency).

lock files are nessesary for libraries for reproducible build in CI and so, to prevent situations like this - test fails, even if I didn't touch any code

rifler

comment created time in 23 days

issue commentsindresorhus/ky

add "main", "module" and "types" field

jsdelivr ok: https://cdn.jsdelivr.net/npm/rifler-test-package

and then fix the Node.js case with exports

will it work if host program is in cjs mode? will it work in all versions of node?

rifler

comment created time in 23 days

issue commentsindresorhus/ky

add "main", "module" and "types" field

@sholladay You are right, I fixed this behaviour in #284

rifler

comment created time in 23 days

pull request commentsindresorhus/ky

add "main", "module" and "types" field

Oh, I see

maybe we should use package-lock.json for that kind of situations? Builds must be reproducible over time

I can add package-lock in this PR

rifler

comment created time in 23 days

push eventrifler/ky

Dmitrii Kanatnikov

commit sha 38ad9e66d51b6eb482b446ee3437f110e13c7049

fix unpkg

view details

push time in 23 days

issue commentsindresorhus/ky

add "main", "module" and "types" field

@sholladay can you please provide an example? I'll check that

rifler

comment created time in 23 days

pull request commentsindresorhus/ky

Declare package as module and specify exports files

Tests are also failing for me locally with Node v13.8.0. Lots of errors like...

Uncaught exception in test/browser.js


file:///private/tmp/ky/test/_require.js:1
import fetch, {Headers, Request, Response} from 'node-fetch';
               ^^^^^^^
SyntaxError: The requested module 'node-fetch' does not provide an export named 'Headers'

Maybe the thing is that node cannot do named imports from CJS package, you have to write

import fetch from 'node-fetch';

const { Headers, Request, Response } = fetch;

you can try 14.13.0, where support for named import was added

https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V14.md#2020-09-29-version-14130-current-mylesborins

ubergesundheit

comment created time in 25 days

pull request commentsindresorhus/ky

add "main", "module" and "types" field

CI failed. You can run the tests locally with npm test.

Fixed, thanks!

But this test fails for me in master branch too, I think someone merge PR without passing CI tests

rifler

comment created time in 25 days

push eventrifler/ky

Dmitrii Kanatnikov

commit sha f3b4f6a83f08aa7550740a3a9a6e53625f658050

fix test

view details

push time in 25 days

issue commentsindresorhus/ky

add "main", "module" and "types" field

I would be fine with this if it actually worked everywhere, but I believe module is not as widely supported as you might think, including by Node.js itself and its new ESM loader.

"Module" widely supported by bundlers, first of all it is webpack and rollup.

But I think that this issue and #244 are not competitors and complementing each other: main - for old versions of node & bundlers. It is CJS module - for bundlers that supports this field, webpack < 5, rollup, etc. It is ESM exports - for new versions of node and bundlers (webpack >= 5). It is dual mode (esm & cjs)

rifler

comment created time in 25 days

PR opened sindresorhus/ky

add "main", "module" and "types" field

fixes https://github.com/sindresorhus/ky/issues/283

+3 -0

0 comment

1 changed file

pr created time in 25 days

issue openedsindresorhus/ky

add "main", "module" and "types" field

Because ky delivers index.js in esm format and untranspiled, it generates a bit of a problem for "universal" applications

If I use ky/umd it works well in node and client, until I want to transpile all of my node_modules, to support old browsers. After that babel+webpack breaks about ky/umd (i haven't figured out the reasons yet)

decision - add these lines to package.json:

"main": "./umd.js",
"module": "./index.js",
"types": "./index.d.ts",

Maybe it partially related to https://github.com/sindresorhus/ky/issues/255

created time in 25 days

create barnchrifler/ky

branch : rifler-add-package-json-fields

created branch time in 25 days

push eventrifler/ky

Dmitrii Kanatnikov

commit sha 5fabe0cab287e2a23772716d49b7b42d943a8950

Add `ky/umd` TypeScript definition (#89) Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>

view details

Sindre Sorhus

commit sha d5d3eaa24f903294d1b86d96a7652262c61536eb

0.7.1

view details

Ashinze Ekene

commit sha 8f17a135f271c114936233b2aef7b253cfc4a493

Actually cancel the request after the timeout (#27) Fixes #8 Co-authored-by: Szymon Marczak <36894700+szmarczak@users.noreply.github.com>

view details

Sindre Sorhus

commit sha ce12902195558b84d4c22b0676526153be334328

Make the `.json()` method generic (#98) It can still be used as before without a generic. Fixes #80

view details

Sindre Sorhus

commit sha ca0d3477f2ad0b986ad8f97838fc8e51059f6b24

0.8.0

view details

Sindre Sorhus

commit sha b6ed9dfc17e1081b992b54f95e65969deb633c5a

Improve readme examples Fixes #99

view details

Ian Walter

commit sha c6e69e50532faceb3af8e5592ae4215c817a9540

Replace Cypress with AVA + Puppeteer (#84)

view details

Szymon Marczak

commit sha ffdc62f0886afc96f6e84a8c1b8519dcf2e2d8f7

Remove the minified build link strikethrough It is fixed now

view details

7Pass

commit sha cd33a63b25618606360b78e5bd62149951a5b142

Fix `afterResponse` hook & retry not being called (#95)

view details

doniyor2109

commit sha 66ea8a7aee7a652eed1f7a7aa3e01d72c57d29a3

Improve type system for get and head methods (#87) Fixes #85 Co-authored-by: Szymon Marczak <36894700+szmarczak@users.noreply.github.com>

view details

Sindre Sorhus

commit sha 57e6da971d3f65c9336d4994a4e9fd7e546685e9

Minor tweaks

view details

Sindre Sorhus

commit sha a150ae885496a6ef307ffb65cabfd9ddaa075c40

0.9.0

view details

Sindre Sorhus

commit sha a60054277a83ddf3054c32c2527c6bb5b1919211

Mention `ky-universal` in the readme

view details

Callum Locke

commit sha 8c6abab989367abf756efd8b4faa549e7dfe0a54

Fix note about non-2xx status codes in readme (#104)

view details

Bertrand Marron

commit sha 6bdd75e767e7dcfb484a1a155ec2d99e36cc6571

Remove slash in prefixUrl example (#108) See #11.

view details

Luca Ban

commit sha 81e08da19a872a37d98620ae7a961c34c8805908

Clarify usage of `.json()` (#111)

view details

Michael Stramel

commit sha 8d295b0072c1733d722a9355f06dd370c469e160

Fix Error types (#113)

view details

Etienne Dldc

commit sha bc6aa04b8d440f8599fc819da0b6c05a65991d2e

Fix TypeScript types to allow hooks to return a Promise (#123)

view details

Artemy Tregubenko

commit sha ed17c9a84d3afa6830fcaabd6835aa3f3f23c55b

Fix problem with debugging timed-out requests (#122) Fixes #91

view details

Sindre Sorhus

commit sha d5b16d603a14b33c30dbe5369b3f421cca79f98e

Improve the TypeScript definition

view details

push time in 25 days

issue commentReactTraining/react-router

feature request: protocol and host info in useLocation

just use window.location instead of useLocation

I describe cons of that solution

Router is only for on-page routing. Any other elements of the URL, such as the protocol or host, are unrelated to on-page routing. If they change, that will trigger a page reload and new instances of everything in Router.

I understand, but location word in useLocation signals that this is single source of truth about location information, that have to contain protocol and host

rifler

comment created time in a month

issue closedeprincev-egor/no-cyrillic-string

work with styled-components

import styled from 'styled-components';

const Component = styled.div`
    /* комментарий на русском */
    // комментарий на русском
    color: red;
`;

I understand that plugin works as expected, but maybe you have some thoughts how it can be fixed?

closed time in a month

rifler

issue commenteprincev-egor/no-cyrillic-string

work with styled-components

согласен, добавил игнор на это правило через overrides по файловой маске styles.tsx?

rifler

comment created time in a month

issue openedReactTraining/react-router

feature request: protocol and host info in useLocation

sometimes I need full url of current page to pass somewhere, for example:

const Component = () => {
  const fullUrl = getFullUrlSomeHow();
  return <>
    ..some layout...
    <a href={`https://another-service.com?retpath=${encodeURIComponent(fullUrl)}`}>
      Link to another site, that do some job and redirects back
    </a>
  </>;
}

there are some solutions:

  1. window.location. Cons - checks typeof window !== 'undefined' for ssr (rehydration warning), Component doesn't rerender when url changes
  2. window.location.protocol + window.location.host + useLocation. Cons - checks typeof window !== 'undefined' for ssr (rehydration warning)
  3. Store protocol&host in state (redux/context/etc) from the server, write custom hook that fetches info from useLocation and from store and combines it
  4. add protocol and host to react-router :)

created time in a month

issue openedeprincev-egor/no-cyrillic-string

work with styled-components

import styled from 'styled-components';

const Component = styled.div`
    /* комментарий на русском */
    // комментарий на русском
    color: red;
`;

I understand that plugin works as expected, but maybe you have some thoughts how it can be fixed?

created time in a month

issue openedeprincev-egor/no-cyrillic-string

add support for jsx

<div>русский текст</div>

created time in a month

startedeprincev-egor/no-cyrillic-string

started time in a month

delete branch rifler/stylelint

delete branch : patch-1

delete time in 2 months

push eventddspb/ddspb.github.io

Dmitrii Kanatnikov

commit sha b8e7c260ff7fcc168636ffc9cecdc0d8cf1f2070

Update head.html

view details

push time in 2 months

issue commentkulshekhar/ts-jest

support plugins section from compilerOptions

can I see online documentation for old versions of ts-jest?

rifler

comment created time in 2 months

issue commentkulshekhar/ts-jest

support plugins section from compilerOptions

My point is that will be great to keep custom plugins in one place rather then copy&paste them between tsconfig and jest config. But I agree that it is not standard feature and can lead errors in feature. As I understand, ttypescript use items with transform field from plugins, and TypeScript itself ignores such items?

Any way, thanks for answers, we can close this issue

which are already supported. You can check online documentation here https://kulshekhar.github.io/ts-jest/user/config/astTransformers

I found that page, but this setting doesn't work for me, maybe I have old version of ts-jest 24.3.0

rifler

comment created time in 2 months

issue commentkulshekhar/ts-jest

support plugins section from compilerOptions

I mean transform plugins, for example https://www.npmjs.com/package/@zerollup/ts-transform-paths

Use case: I define "baseUrl": "." in tsconfig.json and write imports like import { xxx } from 'server/middlewares'. Typescript itself doesn't provide any settings to make it work in nodejs/jest, so I have to define NODE_PATH=. variable to notify nodejs where to search modules except node_modules folder. But in my opinion this work should be done by plugins (in an ideal world by TS). For example NODE_PATH will not work for es modules

So @zerollup/ts-transform-paths rewrites from 'server/middlewares' to, for example, from '../../server/middlewares', depending on source module location. There are many other transform plugins, that do different work - https://github.com/cevek/ttypescript#transformers

And it would be great to define them in one place (tsconfig.json) and then jest just "see" them and apply

rifler

comment created time in 2 months

issue openedkulshekhar/ts-jest

support plugins section from compilerOptions

🚀 Feature Proposal

If you use ttypescript, you can define plugins section in compilerOptions It would be great to make it visible in ts-jest <!-- A clear and concise description of what the feature is. -->

Motivation

do not duplicate plugins in tsconfig.json and jest.config.js <!-- Please outline the motivation for the proposal. -->

Example

<!-- Please provide an example for how this feature would be used. -->

created time in 2 months

issue openednodejs/node

doc: esm: explain `* as alias` behaviour with cjs modules

📗 API Reference Docs Problem

<!--

Thank you for wanting to make nodejs.org better!

This template is for issues with the Node.js API reference documentation.

For problems with nodejs.org beyond the API reference documentation, please open an issue using the issue tracker for our site repository.

https://github.com/nodejs/nodejs.org

For more general support, please open an issue using the issue tracker for our help repository.

https://github.com/nodejs/help


For the issue title, please enter a one-line summary after “doc: ” (preferably 50 characters or less and no more than 72).

The “✍️” are placeholders signifying requests for input. Replace them with your responses.

If you are unsure of something, do your best.

-->

<!-- The output of “node --version”. -->

  • Version: 12.18.3

<!-- The output of “uname -a” (UNIX) or version and 32-bit or 64-bit (Windows). -->

  • Platform: Darwin rifler-osx 19.6.0 Darwin Kernel Version 19.6.0: Sun Jul 5 00:43:10 PDT 2020; root:xnu-6153.141.1~9/RELEASE_X86_64 x86_64

<!-- The name of affected core module. -->

  • Subsystem: ECMAScript modules

Location

Section of the site where the content exists

Affected URL(s):

  • https://nodejs.org/dist/latest-v12.x/docs/api/esm.html

Description

Concise explanation of the problem

<!-- If applicable, include any screenshots that may help solve the problem. -->

for example, React@16.13.1 is cjs-only package now

// index.mjs

import React from 'react';
console.log(React);

// {
//     Children: {
//         map: [Function: mapChildren],
//         forEach: [Function: forEachChildren],
//         count: [Function: countChildren],
//         toArray: [Function: toArray],
//         only: [Function: onlyChild]
//     },
//     Component: [Function: Component],
// ........
// index.mjs

import * as React from 'react';
console.log(React);

// [Module] {
// default: {
//         Children: {
//             map: [Function: mapChildren],
//             forEach: [Function: forEachChildren],
//             count: [Function: countChildren],
//             toArray: [Function: toArray],
//             only: [Function: onlyChild]
//         },
//         Component: [Function: Component],
// ........

In my opinion it is not obvious (and maybe not interoperable with existing code) and it will be nice to document


<!-- Use “[x]” to check the box below if you are interested in contributing. -->

  • [x] I would like to work on this issue and submit a pull request.

created time in 2 months

issue commentnodejs/node

esm: provide more detailed error message when named import of cjs module

file:///Users/leko/ghq/github.com/Leko/node/tmp/test.mjs:1 <------------ HERE

will it be ported to 12.x ?

rifler

comment created time in 2 months

issue commentlodash/lodash

How to use lodash-es using import in Node 14?

Old codebases stay on < v5, new codebases or the ones that have the resources to update will use v5

Good idea too! It is important to support two versions at once. Also, if there will be new breaking change (by other reason), lodash will release 2 new versions - 6 and 7

josdejong

comment created time in 2 months

issue commentnodejs/node

esm: provide more detailed error message when named import of cjs module

for message require is not defined too

rifler

comment created time in 2 months

push eventrifler/stylelint

Dmitrii Kanatnikov

commit sha 952bf4fad3dc469ca0ff28786c198d5736c7be04

add stylelint.config.cjs file for commonjs mode fixes #4906

view details

push time in 2 months

issue openednodejs/node

esm: provide more detailed error message when named import of cjs module

<!-- Thank you for suggesting an idea to make Node.js better.

Please fill in as much of the template below as you're able. -->

Is your feature request related to a problem? Please describe. When I try to make named import for commonjs package, error throws:

The requested module 'redux' is expected to be of type CommonJS, which does not support named exports. CommonJS modules can be imported by importing the default export.
For example:
import pkg from 'redux';
const { compose } = pkg;

In large project it can be hard to find in which file error is thrown

Describe the solution you'd like It would be great append path to module, where

The requested from '/path/to/module.js' module 'redux' is expected to be of type CommonJS, which does not support named exports. CommonJS modules can be imported by importing the default export.
For example:
import pkg from 'redux';
const { compose } = pkg;

created time in 2 months

pull request commentstylelint/stylelint

add stylelint.config.cjs file for commonjs mode

oh, I have to update package-lock.json

will fix it soon

rifler

comment created time in 2 months

issue openedstylelint/stylelint

add stylelint.config.cjs file for commonjs mode

This feature is implemented in cosmiconfig 7.0.0.

created time in 2 months

PR opened stylelint/stylelint

add stylelint.config.cjs file for commonjs mode

partially fixes https://github.com/stylelint/stylelint/issues/4447

<!-- Each pull request must be associated with an open issue unless it's a documentation fix. If a corresponding issue does not exist, please create one so we can discuss the change first. -->

<!-- Please answer the following. We close pull requests that don't. -->

Which issue, if any, is this issue related to?

e.g. "Closes #000" or "None, as it's a documentation fix."

Is there anything in the PR that needs further explanation?

e.g. "No, it's self-explanatory."

+1 -1

0 comment

1 changed file

pr created time in 2 months

push eventrifler/stylelint

Dmitrii Kanatnikov

commit sha c4e6f25fc2dee63be20c6d54d75313656d005251

add stylelint.config.cjs file for commonjs mode partially fixes https://github.com/stylelint/stylelint/issues/4447

view details

push time in 2 months

fork rifler/stylelint

A mighty, modern style linter

https://stylelint.io/

fork in 2 months

issue commentstylelint/stylelint

add stylelint.config.mjs and stylelint.config.cjs file for esm and commonjs

Correct. This is something for cosmiconfig to implement. We use cosmiconfig to find configs, and to support different config formats.

cosmiconfig release 7.x version with cjs support

xiaoxiangmoe

comment created time in 2 months

issue commentmadou/typescript-transformer-handbook

Binder Link on README.md is not working!

i fixed it here - https://github.com/madou/typescript-transformer-handbook/pull/18

SerkanSipahi

comment created time in 2 months

delete branch rifler/typescript-transformer-handbook

delete branch : patch-1

delete time in 2 months

issue openedsindresorhus/got

try undici http client

What problem are you trying to solve?

speed improvement

Describe the feature

use new http/1.1 client https://github.com/nodejs/undici, which is faster than builtin http

original tweet - https://twitter.com/matteocollina/status/1298148085210775553

<!-- Include a usage example of the feature. If the feature is currently possible with a workaround, include that too. -->

Checklist

  • [x] I have read the documentation and made sure this feature doesn't already exist.

created time in 2 months

issue commentmadou/typescript-transformer-handbook

Improvements

It will be great to add example about identifying what is imported - type value or runtime value

// source.ts
import { FC, useCallback } from 'react';

// transform.ts (just example)
ts.isTypeValue(FC) // true
ts.isRuntimeValue(useCallback) // true
bendtherules

comment created time in 2 months

push eventrifler/typescript-transformer-handbook

Dmitrii Kanatnikov

commit sha 327baa4ca00612c88fb206186c61c2c8b2811a17

typo

view details

push time in 2 months

fork rifler/typescript-transformer-handbook

📘 A comprehensive handbook on how to create transformers for TypeScript with code examples

fork in 2 months

startedzerkalica/zerollup

started time in 2 months

pull request commentangular/angular

TypeError: Right-hand side of 'instanceof' is not an object

fixed

rifler

comment created time in 2 months

issue commentOniVe/ts-transform-paths

Work with "baseUrl"

I found package, that meets my needs - https://github.com/zerkalica/zerollup/tree/master/packages/ts-transform-paths

thank you

rifler

comment created time in 2 months

startedIgorbek/typescript-plugin-styled-components

started time in 2 months

startedLeDDGroup/typescript-transform-jsx

started time in 2 months

startedBrooooooklyn/ts-import-plugin

started time in 2 months

push eventrifler/angular

Aristeidis Bampakos

commit sha 956b25a1000c1e4d88597cef60f0bb0fb946fe78

docs: apply code styling in template reference variables guide (#38522) PR Close #38522

view details

George Kalpakas

commit sha 364284b0dc14afbaa9b670530830973f969a17be

fix(dev-infra): ignore comments when validating commit messages (#38438) When creating a commit with the git cli, git pre-populates the editor used to enter the commit message with some comments (i.e. lines starting with `#`). These comments contain helpful instructions or information regarding the changes that are part of the commit. As happens with all commit message comments, they are removed by git and do not end up in the final commit message. However, the file that is passed to the `commit-msg` to be validated still contains these comments. This may affect the outcome of the commit message validation. In such cases, the author will not realize that the commit message is not in the desired format until the linting checks fail on CI (which validates the final commit messages and is not affected by this issue), usually several minutes later. Possible ways in which the commit message validation outcome can be affected: - The minimum body length check may pass incorrectly, even if there is no actual body, because the comments are counted as part of the body. - The maximum line length check may fail incorrectly due to a very long line in the comments. This commit fixes the problem by removing comment lines before validating a commit message. Fixes #37865 PR Close #38438

view details

Ajit Singh

commit sha 2a643e1ab61d0be33ad7e36134cd6cb9967c2986

docs: change function name from async -> waitForAsync (#38548) async function name was changed to waitForAsync but it was left in testing-utility-api file. PR Close #38548

view details

crisbeto

commit sha e7da4040d64bc9055c183cc3ecbbb24eee82596f

fix(compiler-cli): adding references to const enums in runtime code (#38542) We had a couple of places where we were assuming that if a particular symbol has a value, then it will exist at runtime. This is true in most cases, but it breaks down for `const` enums. Fixes #38513. PR Close #38542

view details

JoostK

commit sha 874792dc43a70dc55c9b926807ca6bbcb5cafb9e

feat(compiler): support unary operators for more accurate type checking (#37918) Prior to this change, the unary + and - operators would be parsed as `x - 0` and `0 - x` respectively. The runtime semantics of these expressions are equivalent, however they may introduce inaccurate template type checking errors as the literal type is lost, for example: ```ts @Component({ template: `<button [disabled]="isAdjacent(-1)"></button>` }) export class Example { isAdjacent(direction: -1 | 1): boolean { return false; } } ``` would incorrectly report a type-check error: > error TS2345: Argument of type 'number' is not assignable to parameter of type '-1 | 1'. Additionally, the translated expression for the unary + operator would be considered as arithmetic expression with an incompatible left-hand side: > error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type. To resolve this issues, the implicit transformation should be avoided. This commit adds a new unary AST node to represent these expressions, allowing for more accurate type-checking. Fixes #20845 Fixes #36178 PR Close #37918

view details

Keen Yee Liau

commit sha b48cc6ead56472d04385370cd83dbb5d072a69a6

feat(language-service): introduce hybrid visitor to locate AST node (#38540) This commit introduces two visitors, one for Template AST and the other for Expression AST to allow us to easily find the node that most closely corresponds to a given cursor position. This is crucial because many language service APIs take in a `position` parameter, and the information returned depends on how well we can find a good candidate node. In View Engine implementation of language service, the search for the node and the processing of information to return the result are strongly coupled. This makes the code hard to understand and hard to debug because the stack trace is often littered with layers of visitor calls. With this new feature, we could test the "searching" part separately and colocate all the logic (aka hacks) that's required to retrieve an accurate span for a given node. Right now, only the most "narrow" node is returned by the main exported function `findNodeAtPosition`. If needed, we could expose the entire AST path, or expose other methods to provide more context for a node. Note that due to limitations in the template AST interface, there are a few known cases where microsyntax spans are not recorded properly. This will be dealt with in a follow-up PR. PR Close #38540

view details

Keen Yee Liau

commit sha 4985267211145ba5cd83d433ccb4153bce965a9e

test(language-service): [Ivy] return cursor position in overwritten template (#38552) In many testing scenarios, there is a common pattern: 1. Overwrite template (inline or external) 2. Find cursor position 3. Call one of language service APIs 4. Inspect spans in result In order to faciliate this pattern, this commit refactors `MockHost.overwrite()` and `MockHost.overwriteInlineTemplate()` to allow a faux cursor symbol `¦` to be injected into the template, and the methods will automatically remove it before updating the script snapshot. Both methods will return the cursor position and the new text without the cursor symbol. This makes testing very convenient. Here's a typical example: ```ts const {position, text} = mockHost.overwrite('template.html', `{{ ti¦tle }}`); const quickInfo = ngLS.getQuickInfoAtPosition('template.html', position); const {start, length} = quickInfo!.textSpan; expect(text.substring(start, start + length)).toBe('title'); ``` PR Close #38552

view details

windmichael

commit sha 6e643d9874ac1daebec42282bb94e9c773a09786

docs(localize): fix angular.json syntax (#38553) In chapter internationalization (i18n) at section "Deploy multiple locales" the syntax for angular.json is wrong. This commit fixes the angular.json, when specifying the translation file and the baseHref for a locale. PR Close #38553

view details

Sonu Kapoor

commit sha 201a546af864ece7331c4fa8198d55ae0908679c

perf(forms): use internal `ngDevMode` flag to tree-shake error messages in prod builds (#37821) This commit adds a guard before throwing any forms errors. This will tree-shake error messages which cannot be minified. It should also help to reduce the bundle size of the `forms` package in production by ~20%. Closes #37697 PR Close #37821

view details

Dmitrii Kanatnikov

commit sha 472a7167fbd1bff588c64ef6e7af12541ba51861

fix(zone.js): zone.js toString patch should check typeof Promise is function Close #38361 zone.js monkey patch toString, and check the instance is `Promise` or not by using `instanceof Promise`, sometimes when Promise is not available, the `instanceof` operation fails and throw `TypeError: Right-hand side of 'instanceof' is not an object` this PR check `typeof Promise` equals to function or not to prevent the error.

view details

push time in 2 months

push eventrifler/angular

Aristeidis Bampakos

commit sha 956b25a1000c1e4d88597cef60f0bb0fb946fe78

docs: apply code styling in template reference variables guide (#38522) PR Close #38522

view details

George Kalpakas

commit sha 364284b0dc14afbaa9b670530830973f969a17be

fix(dev-infra): ignore comments when validating commit messages (#38438) When creating a commit with the git cli, git pre-populates the editor used to enter the commit message with some comments (i.e. lines starting with `#`). These comments contain helpful instructions or information regarding the changes that are part of the commit. As happens with all commit message comments, they are removed by git and do not end up in the final commit message. However, the file that is passed to the `commit-msg` to be validated still contains these comments. This may affect the outcome of the commit message validation. In such cases, the author will not realize that the commit message is not in the desired format until the linting checks fail on CI (which validates the final commit messages and is not affected by this issue), usually several minutes later. Possible ways in which the commit message validation outcome can be affected: - The minimum body length check may pass incorrectly, even if there is no actual body, because the comments are counted as part of the body. - The maximum line length check may fail incorrectly due to a very long line in the comments. This commit fixes the problem by removing comment lines before validating a commit message. Fixes #37865 PR Close #38438

view details

Ajit Singh

commit sha 2a643e1ab61d0be33ad7e36134cd6cb9967c2986

docs: change function name from async -> waitForAsync (#38548) async function name was changed to waitForAsync but it was left in testing-utility-api file. PR Close #38548

view details

crisbeto

commit sha e7da4040d64bc9055c183cc3ecbbb24eee82596f

fix(compiler-cli): adding references to const enums in runtime code (#38542) We had a couple of places where we were assuming that if a particular symbol has a value, then it will exist at runtime. This is true in most cases, but it breaks down for `const` enums. Fixes #38513. PR Close #38542

view details

JoostK

commit sha 874792dc43a70dc55c9b926807ca6bbcb5cafb9e

feat(compiler): support unary operators for more accurate type checking (#37918) Prior to this change, the unary + and - operators would be parsed as `x - 0` and `0 - x` respectively. The runtime semantics of these expressions are equivalent, however they may introduce inaccurate template type checking errors as the literal type is lost, for example: ```ts @Component({ template: `<button [disabled]="isAdjacent(-1)"></button>` }) export class Example { isAdjacent(direction: -1 | 1): boolean { return false; } } ``` would incorrectly report a type-check error: > error TS2345: Argument of type 'number' is not assignable to parameter of type '-1 | 1'. Additionally, the translated expression for the unary + operator would be considered as arithmetic expression with an incompatible left-hand side: > error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type. To resolve this issues, the implicit transformation should be avoided. This commit adds a new unary AST node to represent these expressions, allowing for more accurate type-checking. Fixes #20845 Fixes #36178 PR Close #37918

view details

Keen Yee Liau

commit sha b48cc6ead56472d04385370cd83dbb5d072a69a6

feat(language-service): introduce hybrid visitor to locate AST node (#38540) This commit introduces two visitors, one for Template AST and the other for Expression AST to allow us to easily find the node that most closely corresponds to a given cursor position. This is crucial because many language service APIs take in a `position` parameter, and the information returned depends on how well we can find a good candidate node. In View Engine implementation of language service, the search for the node and the processing of information to return the result are strongly coupled. This makes the code hard to understand and hard to debug because the stack trace is often littered with layers of visitor calls. With this new feature, we could test the "searching" part separately and colocate all the logic (aka hacks) that's required to retrieve an accurate span for a given node. Right now, only the most "narrow" node is returned by the main exported function `findNodeAtPosition`. If needed, we could expose the entire AST path, or expose other methods to provide more context for a node. Note that due to limitations in the template AST interface, there are a few known cases where microsyntax spans are not recorded properly. This will be dealt with in a follow-up PR. PR Close #38540

view details

Keen Yee Liau

commit sha 4985267211145ba5cd83d433ccb4153bce965a9e

test(language-service): [Ivy] return cursor position in overwritten template (#38552) In many testing scenarios, there is a common pattern: 1. Overwrite template (inline or external) 2. Find cursor position 3. Call one of language service APIs 4. Inspect spans in result In order to faciliate this pattern, this commit refactors `MockHost.overwrite()` and `MockHost.overwriteInlineTemplate()` to allow a faux cursor symbol `¦` to be injected into the template, and the methods will automatically remove it before updating the script snapshot. Both methods will return the cursor position and the new text without the cursor symbol. This makes testing very convenient. Here's a typical example: ```ts const {position, text} = mockHost.overwrite('template.html', `{{ ti¦tle }}`); const quickInfo = ngLS.getQuickInfoAtPosition('template.html', position); const {start, length} = quickInfo!.textSpan; expect(text.substring(start, start + length)).toBe('title'); ``` PR Close #38552

view details

windmichael

commit sha 6e643d9874ac1daebec42282bb94e9c773a09786

docs(localize): fix angular.json syntax (#38553) In chapter internationalization (i18n) at section "Deploy multiple locales" the syntax for angular.json is wrong. This commit fixes the angular.json, when specifying the translation file and the baseHref for a locale. PR Close #38553

view details

Sonu Kapoor

commit sha 201a546af864ece7331c4fa8198d55ae0908679c

perf(forms): use internal `ngDevMode` flag to tree-shake error messages in prod builds (#37821) This commit adds a guard before throwing any forms errors. This will tree-shake error messages which cannot be minified. It should also help to reduce the bundle size of the `forms` package in production by ~20%. Closes #37697 PR Close #37821

view details

push time in 2 months

pull request commentangular/angular

TypeError: Right-hand side of 'instanceof' is not an object

@JiaLiPassion can you please give me advice how to write unit test for Zone.__load_patch?

Maybe type checking is enough here?

rifler

comment created time in 2 months

push eventrifler/angular

Dmitrij Kuba

commit sha 1609815743323f17aa19309af32dd3af74bbfb17

feat(router): better warning message when a router outlet has not been instantiated (#30246) It is confusing when routes are successfully activated but a component is not present on a page, with this message it's more clear. PR Close #30246

view details

Pete Bacon Darwin

commit sha 8227b56f9e052f33f3ba0d4aaac39590d4d123ec

style(docs-infra): reformat ScrollService file (#30630) Pre-empting code formatting changes when the code is updated in a subsequent commit. PR Close #30630

view details

marcvincenti

commit sha bb88c9fa3daac80086efbda951d81c159e3840f4

fix(common): ensure scrollRestoration is writable (#30630) Some specialised browsers that do not support scroll restoration (e.g. some web crawlers) do not allow `scrollRestoration` to be writable. We already sniff the browser to see if it has the `window.scrollTo` method, so now we also check whether `window.history.scrollRestoration` is writable too. Fixes #30629 PR Close #30630

view details

Sonu Kapoor

commit sha 0c2490368e10dd939353b21fc3ba20f441c97e5e

refactor(platform-browser): specify return type of parseEventName (#38089) This commit refactors the argument of the `parseEventName` function to use an object with named properties instead of using an object indexer. PR Close #38089

view details

mgechev

commit sha d7c043ba350def55b8247ab94106fadceb3cbfb3

docs: add a page with the Angular roadmap (#38358) PR Close #38358

view details

Ajit Singh

commit sha 696a9b01ef01c6ab6d83cf846a4b7b8dc6b5568c

docs: remove https://angular.io from internal links (#38360) PR #36601 introduces icons on all links if the link contains https:// or http:// but there were some internal links left which contained https://angular.io. Removed https://angular.io from all these links. PR Close #38360

view details

Doug Parker

commit sha a18f82b458d6f7ca9b3501c29e9bf2f0e743addf

refactor(core): add `noSideEffects()` as private export (#38320) This is to enable the compiler to generate `noSideEffects()` calls. This is a private export, gated by `ɵ`. PR Close #38320

view details

Doug Parker

commit sha 2a745c8df85261004fda3e518498b6215ea295be

refactor(compiler): add `ModuleInfo` interface (#38320) This introduces a new `ModuleInfo` interface to represent some of the statically analyzed data from an `NgModule`. This gets passed into transforms to give them more context around a given `NgModule` in the compilation. PR Close #38320

view details

Doug Parker

commit sha dca4443a8ed65d341356fe62f6df9934e6314dfe

fix(compiler-cli): mark eager `NgModuleFactory` construction as not side effectful (#38320) Roll forward of #38147. This allows Closure compiler to tree shake unused constructor calls to `NgModuleFactory`, which is otherwise considered side-effectful. The Angular compiler generates factory objects which are exported but typically not used, as they are only needed for compatibility with View Engine. This results in top-level constructor calls, such as: ```typescript export const FooNgFactory = new NgModuleFactory(Foo); ``` `NgModuleFactory` has a side-effecting constructor, so this statement cannot be tree shaken, even if `FooNgFactory` is never imported. The `NgModuleFactory` continues to reference its associated `NgModule` and prevents the module and all its unused dependencies from being tree shaken, making Closure builds significantly larger than necessary. The fix here is to wrap `NgModuleFactory` constructor with `noSideEffects(() => /* ... */)`, which tricks the Closure compiler into assuming that the invoked function has no side effects. This allows it to tree-shake unused `NgModuleFactory()` constructors when they aren't imported. Since the factory can be removed, the module can also be removed (if nothing else references it), thus tree shaking unused dependencies as expected. The one notable edge case is for lazy loaded modules. Internally, lazy loading is done as a side effect when the lazy script is evaluated. For Angular, this side effect is registering the `NgModule`. In Ivy this is done by the `NgModuleFactory` constructor, so lazy loaded modules **cannot** have their top-level `NgModuleFactory` constructor call tree shaken. We handle this case by looking for the `id` field on `@NgModule` annotations. All lazy loaded modules include an `id`. When this `id` is found, the `NgModuleFactory` is generated **without** with `noSideEffects()` call, so Closure will not tree shake it and the module will lazy-load correctly. PR Close #38320

view details

George Kalpakas

commit sha 0551fbdf889dc1a7a509c3ebb19789b231b10917

fix(docs-infra): correctly generate CLI commands docs when the overview page moves (#38365) Previously, the [processCliCommands][1] dgeni processor, which is used to generate the docs pages for the CLI commands, expected the CLI commands overview page (with a URL of `cli`) to exist as a child of a top-level navigation section (`CLI Commands`). If one tried to move the `CLI Commands` section inside another section, `processCliCommnads` would fail to find it and thus fail to generate the CLI commands docs. This problem came up in #38353. This commit updates the `processCliCommands` processor to be able to find it regardless of the position of the `CLI Commands` section inside the navigation doc. [1]: https://github.com/angular/angular/blob/dca4443a8ed65d341356fe62f6df9934e6314dfe/aio/tools/transforms/cli-docs-package/processors/processCliCommands.js#L7-L9 PR Close #38365

view details

George Kalpakas

commit sha 18cd1a99379edbec66887e7949761363aa448e0f

docs(service-worker): describe how asset-/data-group order affects request handling (#38364) The order of asset- and data-groups in `ngsw-config.json` affects how a request is handled by the ServiceWorker. Previously, this was not clearly documented. This commit describes how the order of asset-/data-groups affects request handling. Closes #21189 PR Close #38364

view details

Misko Hevery

commit sha 3821dc5f6c2e63cd08eac5cf4f898d3f8081af94

refactor(core): add human readable `debug` for i18n (#38154) I18n code breaks up internationalization into opCodes which are then stored in arrays. To make it easier to debug the codebase this PR adds `debug` property to the arrays which presents the data in human readable format. PR Close #38154

view details

Misko Hevery

commit sha 26be5b4994db2f561c8907a3719913891bd5996a

refactor(core): extract `icuSwitchCase`, `icuUpdateCase`, `removeNestedIcu` (#38154) Extract `icuSwitchCase`, `icuUpdateCase`, `removeNestedIcu` into separate functions to align them with the `.debug` property text. PR Close #38154

view details

JoostK

commit sha 570d156ce469ef6ff5e9d2863f807a9dafd2da26

test: update components repo to test against recent revision (#38273) The changes in angular/components#20136 are required to allow the framework tests to succeed. PR Close #38273

view details

JoostK

commit sha 7525f3afc114ba65c72bb98818d83c7c34d49042

fix(compiler-cli): type-check inputs that include undefined when there's coercion members (#38273) For attribute bindings that target a directive's input, the template type checker is able to verify that the type of the input expression is compatible with the directive's declaration for said input. This checking adheres to the `strictNullChecks` flag as configured in the TypeScript compilation, such that errors are reported for expressions that include `undefined` or `null` in their type if the input's declaration does not include those types. There was a bug with this level of type-checking for directives that also declare coercion members, where binding an expression that includes the `undefined` type to a directive's input that does not include the `undefined` type would not be reported as error. This commit fixes the bug by changing the type-constructor in type-check code to use an intersection type of regular inputs and coerced inputs, instead of a union type. The union type would inadvertently allow `undefined` types to be assigned into the regular inputs, as that would still satisfy the characteristics of a union type. As a result of this change, you may start to see build failures if `strictTemplates` is enabled and `strictInputTypes` is not disabled. These errors are legitimate and some action is required to achieve a successful build: 1. Update the templates for which an error is reported and introduce the non-null assertion operator at the end of the expression. This removes the `undefined` type from the expression's type, making it appear as a valid assignment. 2. Disable `strictNullInputTypes` in the compiler options. This will implicitly add the non-null assertion operators similar to option 1, but all templates in the compilation are affected. 3. Update the directive's input declaration to include the `undefined` type, if the directive is not implemented in an external library. PR Close #38273

view details

Sonu Kapoor

commit sha df7f3b04b5189401814da29433f64c7915660fe9

fix(service-worker): fix the chrome debugger syntax highlighter (#38332) The Chrome debugger is not able to render the syntax properly when the code contains backticks. This is a known issue in Chrome and they have an open [issue](https://bugs.chromium.org/p/chromium/issues/detail?id=659515) for that. This commit adds the work-around to use double backslash with one backtick ``\\` `` at the end of the line. This can be reproduced by running the following command: `yarn bazel test //packages/forms/test --config=debug` When opening the chrome debugger tools, you should see the correct code highlighting syntax. PR Close #38332

view details

Misko Hevery

commit sha 702958e9684a21f3e079a21ff7e796fe2906dde0

refactor(core): add debug ranges to `LViewDebug` with matchers (#38359) This change provides better typing for the `LView.debug` property which is intended to be used by humans while debugging the application with `ngDevMode` turned on. In addition this chang also adds jasmine matchers for better asserting that `LView` is in the correct state. PR Close #38359

view details

Alessandro

commit sha 354e66efad728b39026fe1664903b55b65fc6786

refactor(common): use getElementById in ViewportScroller.scrollToAnchor (#30143) This commit uses getElementById and getElementsByName when an anchor scroll happens, to avoid escaping the anchor and wrapping the code in a try/catch block. Related to #28960 PR Close #30143

view details

Andrew Kushnir

commit sha 856db56cca87b369cd46d55c0f1b3b7977583e6c

refactor(forms): get rid of duplicate functions (#38371) This commit performs minor refactoring in Forms package to get rid of duplicate functions. It looks like the functions were duplicated due to a slightly different type signatures, but their logic is completely identical. The logic in retained functions remains the same and now these function also accept a generic type to achieve the same level of type safety. PR Close #38371

view details

Shmuela Jacobs

commit sha 445ac15a785121cd7de099a33a3fded0c8b9ab83

docs: fix purpose description of "builders.json" (#36830) PR Close #36830

view details

push time in 2 months

push eventrifler/angular

Dmitrij Kuba

commit sha 1609815743323f17aa19309af32dd3af74bbfb17

feat(router): better warning message when a router outlet has not been instantiated (#30246) It is confusing when routes are successfully activated but a component is not present on a page, with this message it's more clear. PR Close #30246

view details

Pete Bacon Darwin

commit sha 8227b56f9e052f33f3ba0d4aaac39590d4d123ec

style(docs-infra): reformat ScrollService file (#30630) Pre-empting code formatting changes when the code is updated in a subsequent commit. PR Close #30630

view details

marcvincenti

commit sha bb88c9fa3daac80086efbda951d81c159e3840f4

fix(common): ensure scrollRestoration is writable (#30630) Some specialised browsers that do not support scroll restoration (e.g. some web crawlers) do not allow `scrollRestoration` to be writable. We already sniff the browser to see if it has the `window.scrollTo` method, so now we also check whether `window.history.scrollRestoration` is writable too. Fixes #30629 PR Close #30630

view details

Sonu Kapoor

commit sha 0c2490368e10dd939353b21fc3ba20f441c97e5e

refactor(platform-browser): specify return type of parseEventName (#38089) This commit refactors the argument of the `parseEventName` function to use an object with named properties instead of using an object indexer. PR Close #38089

view details

mgechev

commit sha d7c043ba350def55b8247ab94106fadceb3cbfb3

docs: add a page with the Angular roadmap (#38358) PR Close #38358

view details

Ajit Singh

commit sha 696a9b01ef01c6ab6d83cf846a4b7b8dc6b5568c

docs: remove https://angular.io from internal links (#38360) PR #36601 introduces icons on all links if the link contains https:// or http:// but there were some internal links left which contained https://angular.io. Removed https://angular.io from all these links. PR Close #38360

view details

Doug Parker

commit sha a18f82b458d6f7ca9b3501c29e9bf2f0e743addf

refactor(core): add `noSideEffects()` as private export (#38320) This is to enable the compiler to generate `noSideEffects()` calls. This is a private export, gated by `ɵ`. PR Close #38320

view details

Doug Parker

commit sha 2a745c8df85261004fda3e518498b6215ea295be

refactor(compiler): add `ModuleInfo` interface (#38320) This introduces a new `ModuleInfo` interface to represent some of the statically analyzed data from an `NgModule`. This gets passed into transforms to give them more context around a given `NgModule` in the compilation. PR Close #38320

view details

Doug Parker

commit sha dca4443a8ed65d341356fe62f6df9934e6314dfe

fix(compiler-cli): mark eager `NgModuleFactory` construction as not side effectful (#38320) Roll forward of #38147. This allows Closure compiler to tree shake unused constructor calls to `NgModuleFactory`, which is otherwise considered side-effectful. The Angular compiler generates factory objects which are exported but typically not used, as they are only needed for compatibility with View Engine. This results in top-level constructor calls, such as: ```typescript export const FooNgFactory = new NgModuleFactory(Foo); ``` `NgModuleFactory` has a side-effecting constructor, so this statement cannot be tree shaken, even if `FooNgFactory` is never imported. The `NgModuleFactory` continues to reference its associated `NgModule` and prevents the module and all its unused dependencies from being tree shaken, making Closure builds significantly larger than necessary. The fix here is to wrap `NgModuleFactory` constructor with `noSideEffects(() => /* ... */)`, which tricks the Closure compiler into assuming that the invoked function has no side effects. This allows it to tree-shake unused `NgModuleFactory()` constructors when they aren't imported. Since the factory can be removed, the module can also be removed (if nothing else references it), thus tree shaking unused dependencies as expected. The one notable edge case is for lazy loaded modules. Internally, lazy loading is done as a side effect when the lazy script is evaluated. For Angular, this side effect is registering the `NgModule`. In Ivy this is done by the `NgModuleFactory` constructor, so lazy loaded modules **cannot** have their top-level `NgModuleFactory` constructor call tree shaken. We handle this case by looking for the `id` field on `@NgModule` annotations. All lazy loaded modules include an `id`. When this `id` is found, the `NgModuleFactory` is generated **without** with `noSideEffects()` call, so Closure will not tree shake it and the module will lazy-load correctly. PR Close #38320

view details

George Kalpakas

commit sha 0551fbdf889dc1a7a509c3ebb19789b231b10917

fix(docs-infra): correctly generate CLI commands docs when the overview page moves (#38365) Previously, the [processCliCommands][1] dgeni processor, which is used to generate the docs pages for the CLI commands, expected the CLI commands overview page (with a URL of `cli`) to exist as a child of a top-level navigation section (`CLI Commands`). If one tried to move the `CLI Commands` section inside another section, `processCliCommnads` would fail to find it and thus fail to generate the CLI commands docs. This problem came up in #38353. This commit updates the `processCliCommands` processor to be able to find it regardless of the position of the `CLI Commands` section inside the navigation doc. [1]: https://github.com/angular/angular/blob/dca4443a8ed65d341356fe62f6df9934e6314dfe/aio/tools/transforms/cli-docs-package/processors/processCliCommands.js#L7-L9 PR Close #38365

view details

George Kalpakas

commit sha 18cd1a99379edbec66887e7949761363aa448e0f

docs(service-worker): describe how asset-/data-group order affects request handling (#38364) The order of asset- and data-groups in `ngsw-config.json` affects how a request is handled by the ServiceWorker. Previously, this was not clearly documented. This commit describes how the order of asset-/data-groups affects request handling. Closes #21189 PR Close #38364

view details

Misko Hevery

commit sha 3821dc5f6c2e63cd08eac5cf4f898d3f8081af94

refactor(core): add human readable `debug` for i18n (#38154) I18n code breaks up internationalization into opCodes which are then stored in arrays. To make it easier to debug the codebase this PR adds `debug` property to the arrays which presents the data in human readable format. PR Close #38154

view details

Misko Hevery

commit sha 26be5b4994db2f561c8907a3719913891bd5996a

refactor(core): extract `icuSwitchCase`, `icuUpdateCase`, `removeNestedIcu` (#38154) Extract `icuSwitchCase`, `icuUpdateCase`, `removeNestedIcu` into separate functions to align them with the `.debug` property text. PR Close #38154

view details

JoostK

commit sha 570d156ce469ef6ff5e9d2863f807a9dafd2da26

test: update components repo to test against recent revision (#38273) The changes in angular/components#20136 are required to allow the framework tests to succeed. PR Close #38273

view details

JoostK

commit sha 7525f3afc114ba65c72bb98818d83c7c34d49042

fix(compiler-cli): type-check inputs that include undefined when there's coercion members (#38273) For attribute bindings that target a directive's input, the template type checker is able to verify that the type of the input expression is compatible with the directive's declaration for said input. This checking adheres to the `strictNullChecks` flag as configured in the TypeScript compilation, such that errors are reported for expressions that include `undefined` or `null` in their type if the input's declaration does not include those types. There was a bug with this level of type-checking for directives that also declare coercion members, where binding an expression that includes the `undefined` type to a directive's input that does not include the `undefined` type would not be reported as error. This commit fixes the bug by changing the type-constructor in type-check code to use an intersection type of regular inputs and coerced inputs, instead of a union type. The union type would inadvertently allow `undefined` types to be assigned into the regular inputs, as that would still satisfy the characteristics of a union type. As a result of this change, you may start to see build failures if `strictTemplates` is enabled and `strictInputTypes` is not disabled. These errors are legitimate and some action is required to achieve a successful build: 1. Update the templates for which an error is reported and introduce the non-null assertion operator at the end of the expression. This removes the `undefined` type from the expression's type, making it appear as a valid assignment. 2. Disable `strictNullInputTypes` in the compiler options. This will implicitly add the non-null assertion operators similar to option 1, but all templates in the compilation are affected. 3. Update the directive's input declaration to include the `undefined` type, if the directive is not implemented in an external library. PR Close #38273

view details

Sonu Kapoor

commit sha df7f3b04b5189401814da29433f64c7915660fe9

fix(service-worker): fix the chrome debugger syntax highlighter (#38332) The Chrome debugger is not able to render the syntax properly when the code contains backticks. This is a known issue in Chrome and they have an open [issue](https://bugs.chromium.org/p/chromium/issues/detail?id=659515) for that. This commit adds the work-around to use double backslash with one backtick ``\\` `` at the end of the line. This can be reproduced by running the following command: `yarn bazel test //packages/forms/test --config=debug` When opening the chrome debugger tools, you should see the correct code highlighting syntax. PR Close #38332

view details

Misko Hevery

commit sha 702958e9684a21f3e079a21ff7e796fe2906dde0

refactor(core): add debug ranges to `LViewDebug` with matchers (#38359) This change provides better typing for the `LView.debug` property which is intended to be used by humans while debugging the application with `ngDevMode` turned on. In addition this chang also adds jasmine matchers for better asserting that `LView` is in the correct state. PR Close #38359

view details

Alessandro

commit sha 354e66efad728b39026fe1664903b55b65fc6786

refactor(common): use getElementById in ViewportScroller.scrollToAnchor (#30143) This commit uses getElementById and getElementsByName when an anchor scroll happens, to avoid escaping the anchor and wrapping the code in a try/catch block. Related to #28960 PR Close #30143

view details

Andrew Kushnir

commit sha 856db56cca87b369cd46d55c0f1b3b7977583e6c

refactor(forms): get rid of duplicate functions (#38371) This commit performs minor refactoring in Forms package to get rid of duplicate functions. It looks like the functions were duplicated due to a slightly different type signatures, but their logic is completely identical. The logic in retained functions remains the same and now these function also accept a generic type to achieve the same level of type safety. PR Close #38371

view details

Shmuela Jacobs

commit sha 445ac15a785121cd7de099a33a3fded0c8b9ab83

docs: fix purpose description of "builders.json" (#36830) PR Close #36830

view details

push time in 2 months

fork rifler/emotion

👩‍🎤 CSS-in-JS library designed for high performance style composition

https://emotion.sh/

fork in 2 months

fork rifler/styled-components

Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress 💅

https://styled-components.com

fork in 2 months

create barnchrifler/react-redux

branch : rifler-node-esm

created branch time in 2 months

fork rifler/react-redux

Official React bindings for Redux

https://react-redux.js.org

fork in 2 months

Pull request review commentreduxjs/redux

add support for native es modules in Node

 If we were to write out the code for a typical async thunk by hand, it might loo  ```js const getRepoDetailsStarted = () => ({-  type: "repoDetails/fetchStarted"+  type: 'repoDetails/fetchStarted'

hmm, it's not my fixes, I just run npm run format

rifler

comment created time in 2 months

PullRequestReviewEvent

PR opened reduxjs/redux

add support for native es modules in Node

name: "\U0001F41B Bug fix or new feature" about: Fixing a problem with Redux

PR Type

Does this PR add a new feature, or fix a bug?

Why should this PR be included?

Checklist

  • [x] Have you added an explanation of what your changes do and why you'd like us to include them?
  • [x] Is there an existing issue for this PR?
    • https://github.com/reduxjs/redux/issues/3860
  • [x] Have the files been linted and formatted?
  • [ ] Have the docs been updated to match the changes in the PR?
  • [ ] Have the tests been updated to match the changes in the PR?
  • [x] Have you run the tests locally to confirm they pass?

New Features

What new capabilities does this PR add?

What docs changes are needed to explain this?

Bug Fixes

What is the current behavior, and the steps to reproduce the issue?

What is the expected behavior?

How does this PR fix the problem?

+18 -11

0 comment

6 changed files

pr created time in 2 months

push eventrifler/redux

Dmitrii Kanatnikov

commit sha 25db94fcfcd3283971c51e6566074f76a2b92f94

add support for native es modules in Node

view details

push time in 2 months

create barnchrifler/redux

branch : rifler-node-esm

created branch time in 2 months

issue commentreduxjs/redux

add support for native es modules in Node

some old related issue https://github.com/reduxjs/redux/issues/2614

rifler

comment created time in 2 months

issue openedreduxjs/redux

add support for native es modules in Node

<!-- Thank you for contributing to open source!

Do you need some help?

The issue tracker is meant for feature requests and bug reports only. This isn't the best place for support or usage questions. Questions here don't have as much visibility as they do elsewhere. Before you ask a question, here are some resources to get help first:

  • Read the docs: https://redux.js.org/
  • Check out the troubleshooting guide: https://redux.js.org/troubleshooting
  • Look for/ask questions on Stack Overflow: https://stackoverflow.com/questions/tagged/redux
  • Ask in chat: https://www.reactiflux.com/

Have a feature request?

Remove the template from below and provide thoughtful commentary and code samples on what this feature means for your product. What will it allow you to do that you can't do today? How will it make current work-arounds straightforward? What potential bugs and edge cases does it help to avoid? etc. Please keep it product-centric.

-->

New Features

What is the new or updated feature that you are suggesting?

Native ES modules were landed in node@12.7.0 (see proposal-pkg-exports).

I created small repo with interested for me packages like express, lodash, redux, redux-saga, etc - and try to run app in esm mode.

By default, there are many errors, but they easily fixed by npm run patch.

Some packages need to fix their source, but redux package need to fix only package.json. You can see example of fixes here - https://github.com/rifler/node-esm-example/blob/master/patches/packageJsonConfigs.js

Node.js allows to create dual commonjs/es modules

Why should this feature be included?

If user imports redux on serverside in Node ESM mode, he can use module destructuring (i hope i use right term):

import { createStore, combineReducers } from 'redux';

otherwise he has to write more code:

import Redux from 'redux';

const { createStore, combineReducers } = Redux;

What docs changes are needed to explain this?

Maybe we should add note about it in FAQ (?)

created time in 2 months

fork rifler/redux

Predictable state container for JavaScript apps

https://redux.js.org

fork in 2 months

push eventrifler/redux-saga

Dmitrii Kanatnikov

commit sha d14abbe73f5aefbe6db8eda419267a740fe402f6

make dual packages

view details

push time in 2 months

issue commentredux-saga/redux-saga

add support for native es modules in Node

Also, it would be nice to create dual commonjs/es module - https://nodejs.org/dist/latest-v12.x/docs/api/esm.html#esm_dual_commonjs_es_module_packages

but here we should rename all *.cjs.js files to *.cjs, otherwise node throws error

rifler

comment created time in 2 months

PR opened redux-saga/redux-saga

add support for native es modules in Node #2105

<!-- Before making a PR, please read our contributing guidelines https://github.com/redux-saga/redux-saga/blob/master/CONTRIBUTING.md

For issue references: Add a comma-separated list of a closing word followed by the ticket number fixed by the PR. (it should be underlined in the preview if done correctly)

-->

Q A <!--(Can use an emoji 👍) -->
Fixed Issues? #2105
Patch: Bug Fix?
Major: Breaking Change? 👍
Minor: New Feature?
Tests Added + Pass? Yes
Any Dependency Changes?

<!-- Describe your changes below in as much detail as possible -->

+26 -0

0 comment

6 changed files

pr created time in 2 months

create barnchrifler/redux-saga

branch : rifler-native-esm

created branch time in 2 months

fork rifler/redux-saga

An alternative side effect model for Redux apps

https://redux-saga.js.org/

fork in 2 months

issue openedredux-saga/redux-saga

add support for native es modules in Node

Description

Native ES modules were landed in node@12.7.0 (see proposal-pkg-exports).

I created small repo with interested for me packages like express, lodash, redux, redux-saga, etc - and try to run app in esm mode.

By default, there are many errors, but they easily fixed by npm run patch.

Some packages need to fix their source, but redux-saga packages need to fix only package.json. You can see example of fixes here - https://github.com/rifler/node-esm-example/blob/master/patches/packageJsonConfigs.js

created time in 2 months

push eventrifler/node-esm-example

Dmitrii Kanatnikov

commit sha 1dc7d8ac1a35a40a6722f6f153c7567d9f0c2c65

update readme

view details

push time in 2 months

push eventrifler/node-esm-example

Dmitrii Kanatnikov

commit sha 6092a804874fe614c6c2a7bc0e171bb629c47437

fix README

view details

push time in 2 months

push eventrifler/node-esm-example

Dmitrii Kanatnikov

commit sha 0c555caa39838fb6f7113b055677133f1e80d175

remove unused

view details

push time in 2 months

push eventrifler/node-esm-example

Dmitrii Kanatnikov

commit sha 594f7cab437ae16a82a9dccaeeeea3da5a6c689c

add redux and react-redux

view details

Dmitrii Kanatnikov

commit sha 946094675d11cf95052c15272b3f028f7833f9e0

add styled components

view details

push time in 2 months

push eventrifler/node-esm-example

Dmitrii Kanatnikov

commit sha 51acf34987af4b5bcd467b49d9d9de96b8173a49

wip

view details

push time in 2 months

issue openedds300/patch-package

support changing package.json

Hi!

I make some changes in package.json file, add exports field

but patch-package doesn't see any changes in it

created time in 2 months

issue commentlodash/lodash

How to use lodash-es using import in Node 14?

also, it would be great to make lodash a dual commonjs/es module package: https://nodejs.org/dist/latest-v14.x/docs/api/esm.html#esm_dual_commonjs_es_module_packages

webpack supported it in v5 - https://github.com/webpack/webpack/issues/9509

after that, lodash-es can be deprecated, because lodash will work with require and import as well

josdejong

comment created time in 2 months

push eventrifler/node-esm-example

Dmitrii Kanatnikov

commit sha 4d2300f3f14a28f48f3790f64d8d1041c4f032c8

update readme

view details

push time in 2 months

push eventrifler/node-esm-example

Dmitrii Kanatnikov

commit sha cd0be1f0f447790eec69279292f65f52378d8655

update readme

view details

push time in 2 months

Pull request review commentlodash/lodash

feat: add type module for esm

   "bugs": "https://github.com/lodash/lodash-cli/issues",   "repository": "lodash/lodash",   "license": "MIT",+  "type": "module",

Or lodash can be converted to dual commonjss/esm package: https://nodejs.org/dist/latest-v14.x/docs/api/esm.html#esm_dual_commonjs_es_module_packages

xiaoxiangmoe

comment created time in 2 months

Pull request review commentlodash/lodash

feat: add type module for esm

   "bugs": "https://github.com/lodash/lodash-cli/issues",   "repository": "lodash/lodash",   "license": "MIT",+  "type": "module",

As I understand, this change must be applied only in lodash-es package. Otherwise it can break usual lodash package, because main nodejs program will think, that lodash is esm package and will throw error require is not defined or something like this

xiaoxiangmoe

comment created time in 2 months

startednodejs/modules

started time in 2 months

issue openedOniVe/ts-transform-paths

Work with "baseUrl"

Hi!

I specify only "baseUrl": "." without "paths" and import modules like so:

import {} from 'server/router';

I think it would be great to support this kind of usage, like https://github.com/dividab/tsconfig-paths did

created time in 2 months

more